Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fontconvert: fractional point support for fine-grained font size control #436

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wydrych
Copy link

@wydrych wydrych commented Oct 18, 2023

This adds fine-grained control over font size by allowing specifying size in the 26.6 fractional points (1/64 pt). This can be achieved by multiplying size by 64 and adding f at the end of the size argument. E.g., size 11 and 704f generate the same glyphs.

Like in other cases of fontconvert – needs to be used responsibly. No real error checking is performed.

Checking backward compatibility (vs 1.11.19) – following command outputs the same:

% ./fontconvert ~/Downloads/Noto_Sans/NotoSans-Regular.ttf 11 | md5
d222a3698ff59122611135467c9f1344

The glyph generation is not influenced. The only difference between 11 and 704f are symbol names:

% diff -u <(./fontconvert ~/Downloads/Noto_Sans/NotoSans-Regular.ttf 11) <(./fontconvert ~/Downloads/Noto_Sans/NotoSans-Regular.ttf 704f)
--- /dev/fd/11  2023-10-18 18:56:00
+++ /dev/fd/12  2023-10-18 18:56:00
@@ -1,4 +1,4 @@
-const uint8_t NotoSans_Regular11pt7bBitmaps[] PROGMEM = {
+const uint8_t NotoSans_Regular704fpt7bBitmaps[] PROGMEM = {
   0x00, 0xFF, 0xFF, 0xFC, 0xBC, 0xCD, 0x34, 0x51, 0x44, 0x0C, 0x40, 0xC4,
   0x08, 0xC0, 0x8C, 0xFF, 0xFF, 0xFF, 0x18, 0x81, 0x18, 0x11, 0x8F, 0xFF,
   0xFF, 0xF3, 0x10, 0x23, 0x02, 0x30, 0x63, 0x00, 0x0C, 0x03, 0x03, 0xFD,
@@ -134,7 +134,7 @@
   0x83, 0x06, 0x0C, 0x18, 0x1E, 0x3C, 0xC1, 0x83, 0x06, 0x0C, 0x18, 0x71,
   0xC0, 0x78, 0x7F, 0xF8, 0x38 };
 
-const GFXglyph NotoSans_Regular11pt7bGlyphs[] PROGMEM = {
+const GFXglyph NotoSans_Regular704fpt7bGlyphs[] PROGMEM = {
   {     0,   1,   1,   6,    0,    0 },   // 0x20 ' '
   {     1,   2,  15,   6,    2,  -14 },   // 0x21 '!'
   {     5,   6,   5,   9,    1,  -14 },   // 0x22 '"'
@@ -231,9 +231,9 @@
   {  1581,   7,  18,   8,    1,  -14 },   // 0x7D '}'
   {  1597,  10,   3,  12,    1,   -8 } }; // 0x7E '~'
 
-const GFXfont NotoSans_Regular11pt7b PROGMEM = {
-  (uint8_t  *)NotoSans_Regular11pt7bBitmaps,
-  (GFXglyph *)NotoSans_Regular11pt7bGlyphs,
+const GFXfont NotoSans_Regular704fpt7b PROGMEM = {
+  (uint8_t  *)NotoSans_Regular704fpt7bBitmaps,
+  (GFXglyph *)NotoSans_Regular704fpt7bGlyphs,
   0x20, 0x7E, 29 };
 
 // Approx. 2273 bytes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant