code wiki / (root) / nx_font.nx

nx_font.nx

buildroot/runtime/nx_font.nx

83266 B1588 linesdepth 3pulls 7 transitivereach 97 importersview sourcekind librarytopic font
docsdependenciesstructsconstsfunctions

about

nx_font.nx -- RUNG 4 of the sovereign font BUILDER: the FONT ENGINE. A char -> its stroke-composition (in 0..1000 em) + advance width; `font_text` lays out a string (pen advances per glyph). This is the table-driven layer the browser calls. Glyphs are stroke-compositions (rung 1-3); growing the set = DATA. Subset here (the letters for a demo phrase); the alphabet + kanji fill in the same way. ORIGINAL.

dependencies 3 imports · 12 importers

nx_glyph_stroke.nx nx_aa_raster.nx nx_utf8.nx nx_font.nx nx_browser_render.nx nx_browser_render_gif_t139.nx nx_font_advdiff.nx nx_font_family_gate.nx nx_font_screen_tiers.nx nx_font_space_tool.nx nx_font_specimen.nx nx_font_test.nx nx_glyph_ink_probe.nx nx_layout_block.nx

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

imports: nx_glyph_stroke.nxnx_aa_raster.nxnx_utf8.nx

imported by: nx_browser_render.nxnx_browser_render_gif_t139.nxnx_font_advdiff.nxnx_font_family_gate.nxnx_font_screen_tiers.nxnx_font_space_tool.nxnx_font_specimen.nxnx_font_test.nxnx_glyph_ink_probe.nxnx_layout_block.nxnx_vecfont_body_bench.nxnx_vecphrase_proof.nx

structs

none

consts

46const FS_FACE_BYTES: i64 = 256
51const FS_FACE_CPS: i64 = 8704
52const FS_FACE_LATIN_END: i64 = 592 // U+0250: end of Latin Extended-B; below it an uncovered codepoint folds to its base letter
59const FS_FACE_MAX: i64 = 8
60const FS_FACE_BOLD: i64 = 1
61const FS_FACE_ITALIC: i64 = 2
62const FS_FACE_SERIF: i64 = 4

functions

28func font_spec(w: i64, over: i64, passes: i64, caps: i64) -> i64 { fs_w=w; fs_over=over; fs_passes=passes; fs_caps=caps; return 0 }
called by 3: maints_rendermain
29func font_spec_mod(m: i64) -> i64 { fs_mod=m; return 0 }
30func font_spec_swell(s: i64) -> i64 { fs_swell=s; return 0 }
31func font_spec_slant(s: i64) -> i64 { fs_slant=s; return 0 }
called by 2: mainmain
32func font_spec_reset() -> i64 { fs_w=0; fs_over=0; fs_passes=0; fs_caps=0; fs_mod=0; fs_swell=0; fs_slant=0; fs_geo=0; fs_wdth=0; return 0 }
33func font_mod() -> i64 { if fs_mod > 0 { return fs_mod } return 88 }
34func font_swell() -> i64 { if fs_swell > 0 { return fs_swell } return 126 }
called by 1: fe_stroke
35func font_slant() -> i64 { return fs_slant }
called by 2: fe_strokefont_emit
36func font_spec_geo(g: i64) -> i64 { fs_geo=g; return 0 }
37func font_spec_wdth(w: i64) -> i64 { fs_wdth=w; return 0 }
called by 2: mainmain
38func font_wdth() -> i64 { if fs_wdth <= 0 { return 100 } return fs_wdth }
66func font_face_pick(bold: i64, italic: i64, serif: i64) -> i64
73func font_face_register(idx: i64, adv: *i64, kern: *i64) -> i64
85func font_face_select(idx: i64) -> i64
98func font_face_cur() -> i64 { return fs_face_cur }
100func font_set_face(adv: *i64, kern: *i64) -> i64
110func font_face_on() -> i64 { if fs_face_adv != 0 { return 1 } return 0 }
111func fs_face_adv_ptr() -> *i64 { return fs_face_adv as *i64 } // BR39: the render's atlas key needs to see an in-table zero
called by 2: bpv_cellbpv_cell
112func font_face_has(ch: i64) -> i64
129func font_next_cp(text: *u8, i: i64, len: i64, cp: *i64) -> i64
140func font_cp_scratch() -> *i64 { if fs_cp_out == 0 { fs_cp_out = sys_mmap(8) as i64 } return fs_cp_out as *i64 }
141func font_run_has_face(text: *u8, len: i64) -> i64
150func font_run_vec_ok(text: *u8, len: i64) -> i64
156func font_pair_kern_em(prev: i64, ch: i64) -> i64
169func font_weight() -> i64 { if fs_w > 0 { return fs_w } if fs_geo == 1 { return 91 } return 123 }
170func font_geo() -> i64 { return fs_geo }
175func geo_arc(xs: *i64, ys: *i64, cstart: *i64, clen: *i64, np: *i64, nc: *i64, cs: *i64, sn: *i64,
called by 1: font_emit_geo calls 1: fe_stroke
198func geo_earc(xs: *i64, ys: *i64, cstart: *i64, clen: *i64, np: *i64, nc: *i64, cs: *i64, sn: *i64,
called by 1: font_emit_geo calls 1: fe_stroke
224func font_ws() -> i64
234func fe_chaikin(sx: *i64, sy: *i64, n: i64, dx: *i64, dy: *i64) -> i64
252func fe_chaikin_cp(sx: *i64, sy: *i64, stag: *i64, n: i64, dx: *i64, dy: *i64, dtag: *i64) -> i64
called by 1: fe_stroke calls 1: gs_isqrt
298func fe_stroke(xs: *i64, ys: *i64, cstart: *i64, clen: *i64, np: *i64, nc: *i64, cs: *i64, sn: *i64,
415func font_sp_shift(ch: i64) -> i64
486func font_adv_em_base(ch: i64) -> i64
called by 2: font_adv_emmain
571func font_sp_shift_geo(ch: i64) -> i64
called by 1: font_sp_shift_disp
646func font_adv_em_base_geo(ch: i64) -> i64
called by 1: font_adv_em
723func font_adv_em(ch: i64) -> i64
729func font_sp_shift_disp(ch: i64) -> i64 { if fs_geo == 1 { return font_sp_shift_geo(ch) } return font_sp_shift(ch) }
730func font_adv(ch: i64, S: i64) -> i64 { return (font_adv_em(ch) * S) / 1000 }
called by 1: font_text calls 1: font_adv_em
735func font_emit_geo(ch: i64, xs: *i64, ys: *i64, cstart: *i64, clen: *i64, np: *i64, nc: *i64, cs: *i64, sn: *i64,
862func font_emit(ch: i64, xs: *i64, ys: *i64, cstart: *i64, clen: *i64, np: *i64, nc: *i64, cs: *i64, sn: *i64,
1401func fe_ring(xs: *i64, ys: *i64, cstart: *i64, clen: *i64, np: *i64, nc: *i64, cs: *i64, sn: *i64,
called by 2: font_emit_geofont_emit calls 1: fe_stroke
1418func font_has(ch: i64) -> i64
1435func font_run_has(text: *u8, len: i64) -> i64
called by 2: br_draw_fb_atbr_draw_fb_at calls 1: font_has
1442func font_has_ext(ch: i64) -> i64
called by 1: font_run_has_ext calls 1: font_has
1453func font_run_has_ext(text: *u8, len: i64) -> i64
1461func font_trig_init(cs: *i64, sn: *i64) -> i64
1481func font_vec_adv_px(ch: i64, sc: i64) -> i64 { return (font_adv_em(ch) * 15 * sc) / 1000 }
1493func font_vec_adv_fs(ch: i64, fs: i64) -> i64 { return (font_adv_em(ch) * fs) / 1000 }
1494func font_vec_text_w_fs(text: *u8, start: i64, end: i64, fs: i64) -> i64
1509func font_vec_next_break_fs(text: *u8, len: i64, avail_px: i64, start: i64, fs: i64) -> i64
1546func font_vec_text_w(text: *u8, start: i64, end: i64, sc: i64) -> i64
1553func font_vec_next_break(text: *u8, len: i64, avail_px: i64, start: i64, sc: i64) -> i64
1575func font_text(text: *u8, len: i64, xs: *i64, ys: *i64, cstart: *i64, clen: *i64, np: *i64, nc: *i64,