diff --git a/index.html b/index.html index 68faa8d..e11b2f7 100644 --- a/index.html +++ b/index.html @@ -22,6 +22,9 @@
day 15: + pixelfont editor: jgs7 +
day 14: pixelfont editor
+ PixeloidMono + jgs7 +
+ Font: + jgs7 by Adel Faure +
+ Let's see how to encode a pixel based font to a compact format, usable in + a garden that tolerates no external assets. Instead of learning how to + parse TTF files, the pixel data from an existing font can be read from a + canvas: +
+ In this case, each character has a size of 5x9, 45 pixels in total. base64 + can store 6 bits of information per character. Using 8 characters, we can + store 48 bits, which is enough. The base64 string, along with the + character sequence and the col size can be stored in a JSON like this: +
+ To use the font, all we need to do is to copy that JSON, along with the + logic to decode it. Then we can render text to a canvas: +
+ This is exciting! It opens the door to create custom editors, not + constrained by the DOM. Eventually, it could also be fed into a shader.. +