From ebe0c680679559ad034ef724061051dcac69ed15 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Fri, 22 Nov 2024 10:33:47 +0100 Subject: [PATCH] add jgs version of editor --- index.html | 3 + pixelfonts/pixelfont-editor.html | 4 + pixelfonts/pixelfont-editor2.html | 335 ++++++++++++++++++++++++++++++ pixelfonts/pixelfont-jgs.html | 254 ++++++++++++++++++++++ 4 files changed, 596 insertions(+) create mode 100644 pixelfonts/pixelfont-editor2.html create mode 100644 pixelfonts/pixelfont-jgs.html diff --git a/index.html b/index.html index 68faa8d..e11b2f7 100644 --- a/index.html +++ b/index.html @@ -22,6 +22,9 @@

🌱 garten.salat.dev

+

day 15:
+ pixelfont editor: jgs7 +

day 14:
pixelfont editor

diff --git a/pixelfonts/pixelfont-editor.html b/pixelfonts/pixelfont-editor.html index 11412f6..9c8b750 100644 --- a/pixelfonts/pixelfont-editor.html +++ b/pixelfonts/pixelfont-editor.html @@ -39,6 +39,10 @@

🌱 pixelfont editor

+

+ PixeloidMono + jgs7 +

+ + + + 🌱 pixelfont editor: jgs7 + + + + +

🌱 pixelfont editor: jgs7

+

+ PixeloidMono + jgs7 +

+ +

+ Font: + jgs7 by Adel Faure +

+
+ show page source +

+    
+
+ back to garten.salat +
+ + + diff --git a/pixelfonts/pixelfont-jgs.html b/pixelfonts/pixelfont-jgs.html new file mode 100644 index 0000000..868e316 --- /dev/null +++ b/pixelfonts/pixelfont-jgs.html @@ -0,0 +1,254 @@ + + + + + 🌱 pixelfont encoding + + + + +

🌱 pixelfont encoding: jgs7

+

+ 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.. +

+ +
+ show page source +

+    
+
+ back to garten.salat +
+ + + +