code wiki / (root) / nx_paint_text.nx

nx_paint_text.nx

buildroot/runtime/nx_paint_text.nx

9967 B259 linesdepth 4pulls 5 transitivereach 97 importersview sourcekind librarytopic paint
docsdependenciesstructsconstsfunctions

about

nx_paint_text.nx -- rasterize an ASCII text string into a Framebuffer using nx_font_bitmap_5x7. Phase 4 sixth primitive of NISHI_BROWSER_ROADMAP. First text-rendering primitive of the bits-up browser substrate. Algorithm: For each char in the text string, lookup its 7 row bit patterns from nx_font_bitmap_5x7, then for each row scan the 5 columns and set a pixel for each "on" bit. Cell stride: 6 columns per character (5 glyph + 1 inter-char space). Vertical advance: 0 (single line; nx_paint_text_lines queued for wrapping). Pixels are written via direct framebuffer access; bounds-checked per pixel (pixels off-screen are silently skipped). For sub-pixel-aware AA glyph edges, use nx_paint_text_aa (queued). What it does NOT handle yet (Phase 4b queued, explicit in header): - line wrapping (caller's responsibility for now) - vertical line advance for multi-line text - Unicode beyond ASCII (multi-byte UTF-8 decode) - kerning pairs / proportional spacing (current is fixed cell) - bold / italic / underline emphasis - text-align / text-decoration CSS support - anti-aliased glyph edges (current 1-bit-per-pixel) - scale != 1x (would need block-fill per pixel; Phase 4c) Per cardinal feedback-honest-perf-verdict-no-aspirational-claims: gap list is EXACT in this header. genealogy_id: classical_bitmap_font_rasterizer + substrate_browser_phase_4_text lineage_id: nishi_browser_paint_text_v1

dependencies 4 imports · 20 importers

nx_syscalls.nx nx_css_color_decode.nx nx_paint_solid_rect.nx nx_font_bitmap_5x7.nx nx_paint_text.nx nx_browser.nx nx_browser_demo_42.nx nx_browser_demo_hello.nx nx_browser_demo_html.nx nx_browser_demo_html_nishi.nx nx_browser_demo_lowercase.nx nx_browser_demo_multiline.nx nx_browser_demo_pangram.nx nx_browser_demo_styled.nx nx_browser_forms_paint.nx

diagram shows first 10 each side; +0 more imports, +10 more importers in the complete lists below.

imports: nx_syscalls.nxnx_css_color_decode.nxnx_paint_solid_rect.nxnx_font_bitmap_5x7.nx

imported by: nx_browser.nxnx_browser_demo_42.nxnx_browser_demo_hello.nxnx_browser_demo_html.nxnx_browser_demo_html_nishi.nxnx_browser_demo_lowercase.nxnx_browser_demo_multiline.nxnx_browser_demo_pangram.nxnx_browser_demo_styled.nxnx_browser_forms_paint.nxnx_browser_render.nxnx_browser_render_own_test.nxnx_caption_burn.nxnx_caption_burn_gate.nxnx_paint_text_test.nxnx_paint_walk_layout.nxnx_paint_walk_layout_text_test.nxnx_render_ascii.nxnx_render_html.nxnx_render_wiki_bmp.nx

structs

none

consts

41const NX_PAINT_TEXT_CELL_W: i64 = 6 // 5 glyph + 1 inter-char space
42const NX_PAINT_TEXT_CELL_H: i64 = 7

functions

48func _paint_text_pixel(fb: *Framebuffer, px: i64, py: i64,
64func _paint_text_glyph(fb: *Framebuffer,
100func nx_paint_text(fb: *Framebuffer,
136func nx_paint_text_scaled(fb: *Framebuffer,
194func nx_paint_text_styled(fb: *Framebuffer,
256func nx_paint_text_measure(text_len: i64) -> i64
called by 1: main