Coder Social home page Coder Social logo

bad-apple-font's Introduction

Bad-Apple-Font

Playing Bad Apple!! using HarfBuzz WASM shaper within any editable area.

Check out more abusement of WASM shaper at hsfzxjy/Harfbuzz-WASM-Fantasy!

NOTE Valdemar Erk is credited as the original proposer of this idea, who wrote the first blog post and uploaded the first video on Youtube as demonstration.

Play on Youtube | Play on Bilibili

Some days ago I read a thread titled "BadAppleFont" on HackerNews. The post described an interesting abusement of the experimental HarfBuzz WASM shaper to play "Bad Apple!!" in theoretically any editable areas. Nonetheless, the post lacked sufficiently specific instructions or code snippets to rebuild the artwork, which is regrettable.

This repository aims to offer a pipeline to simplify the replication of the idea. To build your own BadAppleFont and apply onto arbitary applications, all you need is to follow these instructions.

Prerequisites

This project has been developed and tested on Ubuntu 20.04 (amd64). While it may function on other platforms, compatibility is not guaranteed.

First, clone this project to your local machine and update all sub-modules:

git clone https://github.com/hsfzxjy/Bad-Apple-Font
git submodule update --init --recursive

Before we start, make sure the following commands are globally available:

python3 cmake g++ wget tar ffmpeg cargo rustup

NOTE This list may not be exhausted. Feel free to contribute if you find something missing.

In addition, make sure to have a good network condition, since we will download a lot of stuff from Github, Niconico, etc.

Building

The entire build process is partitioned into 7 steps, each corresponding to a directory:

  • 01_Download_Video: Download the original video from Niconico.
  • 02_Extract_Frames: Extract all frames from the video and store as BMP files.
  • 03_Vectorization: Convert all extracted BMP files into SVG files.
  • 04_Make_Font: Convert all SVG files into strokes and stuff them into an .sfd file.
  • 05_WASM: Build the WASM shaper binary (make sure Rust toolchain installed and cargo is available).
  • 06_HarfBuzz: Build a customized copy of libharfbuzz to enable experimental WASM shaper.
  • 07_Install_Font: Build the OpenType font from the .sfd and .wasm file. Install it to ~/.local/share/fonts/.

To run the above steps in sequence, execute ./make.sh as follows:

$ ./make.sh
...output omitted...
ALL DONE!!!

If you see a line of ALL DONE!!! at the tail, the font and libharfbuzz should be ready. Congratulations!

Hacking

To enable WASM shaper for an application, use the ./hack script. For example, if you want to play "Bad Apple!!" in gedit, simply run:

./hack gedit

Then go to Preferences -> Font & Colors -> Editor font, pick a font with name Pfennig Medium and confirm. Your editor is now ready to play the video. Press and hold key . and you will see the animation.

LICENSE

This repository is licensed under the MIT LICENSE.

bad-apple-font's People

Contributors

hsfzxjy avatar matlinuxer2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

matlinuxer2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.