nx_font_1bpp.nx
buildroot/runtime/nx_font_1bpp.nx
about
nx_font_1bpp.nx -- bitmap font (caller-supplied glyph data).
Substrate-layer font primitive. Caller supplies the glyph bytes
(e.g., a public-domain 5x7 monospace ASCII font), substrate
provides the lookup + bounds-checking. Designed for SSD1306-class
1bpp displays where 5x7 = 35 bits = 5 bytes per glyph (with
vertical-byte layout matching the framebuffer).
Glyph layout: each glyph_width column is one byte (top bit = top
pixel for fonts up to height 8). For height > 8, multiple bytes
per column (caller arranges).
Composes:
nx_fb_1bpp -- destination framebuffer
nx_text_render -- draws strings using this font primitive
V1 ships:
- struct NxFont with caller-allocated glyph data
- new + glyph_at for lookup
- glyph_width / glyph_height getters
Gap list:
- no variable-width font support yet (monospace V1)
- no anti-aliasing (1bpp by design)
- no UTF-8 (ASCII only V1)
dependencies 2 imports · 4 importers
imports: nx_syscalls.nxnx_tier.nx
imported by: nx_font_1bpp_test.nxnx_game_engine_compose_test.nxnx_text_render.nxnx_text_render_test.nx
structs
| 36 | struct NxFont |
consts
| 30 | const NX_FT_OK: nx_int = 0 |
| 31 | const NX_FT_ERR_BAD_CHAR: nx_int = 1 |
| 32 | const NX_FT_ERR_BAD_DIM: nx_int = 2 |
functions
| 45 | func nx_font_new(glyph_data: *u8, |
| 69 | func nx_font_glyph_at(f: *NxFont, ch: nx_int) -> *u8 |
| 77 | func nx_font_has_char(f: *NxFont, ch: nx_int) -> nx_int |
| 84 | func nx_font_glyph_width(f: *NxFont) -> nx_size |
| 88 | func nx_font_glyph_height(f: *NxFont) -> nx_size |
| 92 | func nx_font_bytes_per_glyph(f: *NxFont) -> nx_size |
| 102 | func nx_font_glyph_pixel(f: *NxFont, ch: nx_int, |