nx_font.nx
buildroot/runtime/nx_font.nx
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
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
| 46 | const FS_FACE_BYTES: i64 = 256 |
| 51 | const FS_FACE_CPS: i64 = 8704 |
| 52 | const FS_FACE_LATIN_END: i64 = 592 // U+0250: end of Latin Extended-B; below it an uncovered codepoint folds to its base letter |
| 59 | const FS_FACE_MAX: i64 = 8 |
| 60 | const FS_FACE_BOLD: i64 = 1 |
| 61 | const FS_FACE_ITALIC: i64 = 2 |
| 62 | const FS_FACE_SERIF: i64 = 4 |
functions
| 28 | func 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 } |
| 29 | func font_spec_mod(m: i64) -> i64 { fs_mod=m; return 0 } |
| 30 | func font_spec_swell(s: i64) -> i64 { fs_swell=s; return 0 } |
| 31 | func font_spec_slant(s: i64) -> i64 { fs_slant=s; return 0 } |
| 32 | func 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 } |
| 33 | func font_mod() -> i64 { if fs_mod > 0 { return fs_mod } return 88 } |
| 34 | func font_swell() -> i64 { if fs_swell > 0 { return fs_swell } return 126 } called by 1: fe_stroke |
| 35 | func font_slant() -> i64 { return fs_slant } |
| 36 | func font_spec_geo(g: i64) -> i64 { fs_geo=g; return 0 } |
| 37 | func font_spec_wdth(w: i64) -> i64 { fs_wdth=w; return 0 } |
| 38 | func font_wdth() -> i64 { if fs_wdth <= 0 { return 100 } return fs_wdth } |
| 66 | func font_face_pick(bold: i64, italic: i64, serif: i64) -> i64 called by 1: nx_layout_face_for_box |
| 73 | func font_face_register(idx: i64, adv: *i64, kern: *i64) -> i64 |
| 85 | func font_face_select(idx: i64) -> i64 |
| 98 | func font_face_cur() -> i64 { return fs_face_cur } |
| 100 | func font_set_face(adv: *i64, kern: *i64) -> i64 |
| 110 | func font_face_on() -> i64 { if fs_face_adv != 0 { return 1 } return 0 } |
| 111 | func fs_face_adv_ptr() -> *i64 { return fs_face_adv as *i64 } // BR39: the render's atlas key needs to see an in-table zero |
| 112 | func font_face_has(ch: i64) -> i64 |
| 129 | func font_next_cp(text: *u8, i: i64, len: i64, cp: *i64) -> i64 called by 7: br_fold_textbr_text_cpbr_fold_textbr_text_cpfont_run_has_facefont_vec_text_w_fs+1 calls 1: utf8_decode_one |
| 140 | func font_cp_scratch() -> *i64 { if fs_cp_out == 0 { fs_cp_out = sys_mmap(8) as i64 } return fs_cp_out as *i64 } |
| 141 | func font_run_has_face(text: *u8, len: i64) -> i64 |
| 150 | func font_run_vec_ok(text: *u8, len: i64) -> i64 |
| 156 | func font_pair_kern_em(prev: i64, ch: i64) -> i64 |
| 169 | func font_weight() -> i64 { if fs_w > 0 { return fs_w } if fs_geo == 1 { return 91 } return 123 } |
| 170 | func font_geo() -> i64 { return fs_geo } |
| 175 | func geo_arc(xs: *i64, ys: *i64, cstart: *i64, clen: *i64, np: *i64, nc: *i64, cs: *i64, sn: *i64, |
| 198 | func geo_earc(xs: *i64, ys: *i64, cstart: *i64, clen: *i64, np: *i64, nc: *i64, cs: *i64, sn: *i64, |
| 224 | func font_ws() -> i64 |
| 234 | func fe_chaikin(sx: *i64, sy: *i64, n: i64, dx: *i64, dy: *i64) -> i64 |
| 252 | func fe_chaikin_cp(sx: *i64, sy: *i64, stag: *i64, n: i64, dx: *i64, dy: *i64, dtag: *i64) -> i64 |
| 298 | func fe_stroke(xs: *i64, ys: *i64, cstart: *i64, clen: *i64, np: *i64, nc: *i64, cs: *i64, sn: *i64, called by 5: geo_arcgeo_earcfont_emit_geofont_emitfe_ring calls 9: fe_chaikin_cpfont_modgs_isqrtfont_wsfont_wdthfont_slant+3 |
| 415 | func font_sp_shift(ch: i64) -> i64 |
| 486 | func font_adv_em_base(ch: i64) -> i64 |
| 571 | func font_sp_shift_geo(ch: i64) -> i64 called by 1: font_sp_shift_disp |
| 646 | func font_adv_em_base_geo(ch: i64) -> i64 called by 1: font_adv_em |
| 723 | func font_adv_em(ch: i64) -> i64 |
| 729 | func font_sp_shift_disp(ch: i64) -> i64 { if fs_geo == 1 { return font_sp_shift_geo(ch) } return font_sp_shift(ch) } |
| 730 | func font_adv(ch: i64, S: i64) -> i64 { return (font_adv_em(ch) * S) / 1000 } |
| 735 | func font_emit_geo(ch: i64, xs: *i64, ys: *i64, cstart: *i64, clen: *i64, np: *i64, nc: *i64, cs: *i64, sn: *i64, |
| 862 | func font_emit(ch: i64, xs: *i64, ys: *i64, cstart: *i64, clen: *i64, np: *i64, nc: *i64, cs: *i64, sn: *i64, called by 5: bpv_cellbpv_cellfont_textmainprobe calls 9: font_emit_geofont_weightfont_modfont_wsfont_wdthfont_slant+3 |
| 1401 | func fe_ring(xs: *i64, ys: *i64, cstart: *i64, clen: *i64, np: *i64, nc: *i64, cs: *i64, sn: *i64, |
| 1418 | func font_has(ch: i64) -> i64 |
| 1435 | func font_run_has(text: *u8, len: i64) -> i64 |
| 1442 | func font_has_ext(ch: i64) -> i64 |
| 1453 | func font_run_has_ext(text: *u8, len: i64) -> i64 |
| 1461 | func font_trig_init(cs: *i64, sn: *i64) -> i64 |
| 1481 | func font_vec_adv_px(ch: i64, sc: i64) -> i64 { return (font_adv_em(ch) * 15 * sc) / 1000 } |
| 1493 | func font_vec_adv_fs(ch: i64, fs: i64) -> i64 { return (font_adv_em(ch) * fs) / 1000 } |
| 1494 | func font_vec_text_w_fs(text: *u8, start: i64, end: i64, fs: i64) -> i64 |
| 1509 | func font_vec_next_break_fs(text: *u8, len: i64, avail_px: i64, start: i64, fs: i64) -> i64 |
| 1546 | func font_vec_text_w(text: *u8, start: i64, end: i64, sc: i64) -> i64 |
| 1553 | func font_vec_next_break(text: *u8, len: i64, avail_px: i64, start: i64, sc: i64) -> i64 |
| 1575 | func font_text(text: *u8, len: i64, xs: *i64, ys: *i64, cstart: *i64, clen: *i64, np: *i64, nc: *i64, |