Adafruit-GFX-Library
Adafruit-GFX-Library copied to clipboard
fontconvert: fractional point support for fine-grained font size control
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