Fonts: anti-aliasing flag, overhanging glyphs, Font Creator byte 18

The Font Creator's anti-aliased fonts are 1-bit glyphs with header flag 0x1E (the simulator draws
them with two colours). Map bytes 3/4 are extra columns left/right of the advance width; glyphs
are drawn starting 'left' px early. Editor-generated fonts now round-trip byte for byte.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-11-16 00:42:03 +01:00
1 parent 6616b47cb4
commit 55c2f9d6b6
6 files changed
+49 -12

No files matched your search

+2 -2
View File
@@ -14,7 +14,7 @@ byte for byte, or a file written by nxhmi was opened in the Editor and showed th
| Components | **31 / 31 types** (20 Basic + 11 Intelligent-only) read/write/create |
| Readable JSON (enum names, colours) | done for every value list the Editor documents |
| Pictures | **complete**: format 0 (Basic) and format 4 (Intelligent, with alpha), all display directions |
| Fonts | black/white **complete** incl. generation from TrueType; anti-aliased **missing** |
| Fonts | **complete** for single-byte encodings: black/white and the anti-aliasing flag, overhanging glyphs, all display directions |
| Rendering pages like the Editor | **pixel-identical** for every Basic component and 9 of 11 Intelligent-only ones; ComboBox and Switch approximate at anti-aliased edges |
| New projects from scratch | `project.new_project(model)` for 12 Basic/Intelligent models; the generated demo is byte-identical to the Editor's re-save |
| Compiling `.tft` firmware | **research only** -- not possible yet |
@@ -94,7 +94,7 @@ byte for byte, or a file written by nxhmi was opened in the Editor and showed th
| Item | Notes |
|---|---|
| Picture quality below 100 (Editor picture list "Q:") | not studied |
| Anti-aliased fonts, multi-byte encodings (GB2312, Big5, ...) | only B/W single-byte fonts seen |
| Multi-byte encodings (GB2312, Big5, ...) | only single-byte fonts studied |
| Other display series | Discovery / Enhanced / Edge not sampled; only Basic + Intelligent templates |
| Display direction | byte 12 decoded and written (`new_project(portrait=...)`); picture order verified for all four (format 4); font glyph order for 90° only |
| Some header fields | main.HMI bytes 8, 13, 36, 0x41; page header 21/23; entry bytes 25-27 |
+9 -3
View File
@@ -247,7 +247,14 @@ multi-byte range (2 bytes), code range first/last, u32 character count, u8 versi
u8 name length (twice) + 0, u32 length of name+map+glyphs, u32 name offset = 0x2C, 16 unknown
bytes. Then the name, the character map, the glyph data.
Character map: 10 bytes per character: u16 code, u8 glyph width, 2 unknown bytes,
Header byte 0x1E = 1 when the Font Creator's "Anti-aliasing of fonts" box was ticked. Such fonts
still hold 1-bit glyphs (Windows' thinner anti-aliased outline, thresholded); the Intelligent
simulator draws them with two colours only. Byte 18 (second name length) is 0 in fresh Font
Creator output and the name length after a re-save; both load.
Character map: 10 bytes per character: u16 code, u8 glyph advance width, u8 extra columns on the
left, u8 extra columns on the right (glyphs that overhang, e.g. `j`, `f`, `W`; the stored glyph is
advance + left + right wide and drawn starting `left` px before the pen position),
u24 glyph offset (relative to the map start), u16 glyph length. In Intelligent projects the glyph
data starts 4-byte aligned (zero padding after the map); Basic fonts have no padding.
@@ -269,8 +276,7 @@ converts a 90
The Editor encodes greedily (transparent run + 1..4 ink if possible, else the 3+3-bit form, else a
plain run); our encoder reproduces a 224-glyph Editor font byte for byte. The v3/v5 write-ups in
github.com/hagronnestad/nextion-font-editor were a useful starting point; v6 differs (scan order,
B/W codes `10`/`11`). **OPEN**: anti-aliased glyphs (other mode bytes), multi-byte encodings,
the 16 unknown header bytes.
B/W codes `10`/`11`). **OPEN**: multi-byte encodings, the remaining unknown header bytes.
## 6. Not yet covered