code wiki / _hdl_build / nx_font_family_gate.nx

nx_font_family_gate.nx

buildroot/runtime/_hdl_build/nx_font_family_gate.nx

16519 B298 linesdepth 4pulls 6 transitivereach 0 importersview sourcekind gate/prooftopic font
docsdependenciesstructsconstsfunctions

about

nx_font_family_gate.nx -- THE FONT GENERATOR proof: ONE glyph program + a knob vector => DIFFERENT fonts (operator: "turn it into something where we can generate different types of fonts... this one font is our pioneer benchmark"). Generates a 4-variant FAMILY from font_spec knobs -- Light(W95) / Regular(pioneer defaults) / Bold(W175) / Soft(2-pass Chaikin + round caps) -- renders the same specimen through the SAME engine, and proves the generator claims MECHANICALLY: T1 all variants render real ink; T2 the weight knob ACTS + ordering holds: ink(Light) < ink(Regular) < ink(Bold), Bold >= Light*115%; T3 ★THE PARAMETRIC INVARIANT: baseline bounce stays professional-flat (<=15 permille) for EVERY variant -- the metric lines are f(W), so alignment survives knob changes BY CONSTRUCTION (this is what makes it a GENERATOR, not one hand-tuned font); T4 style knobs ACT: Soft differs from Regular by real pixels; T5 determinism liar-kill: Regular rendered twice is BYTE-IDENTICAL (so T2's ordering is signal not noise); T6 family specimen sheet written (evidence to eyeball). license_tier: ORIGINAL expect_exit: 0

dependencies 3 imports · 0 importers

nx_font.nx nx_aa_raster.nx nx_png_write.nx nx_font_family_gate.nx

imports: nx_font.nxnx_aa_raster.nxnx_png_write.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main fg_puts font_spec fam_render fg_slen font_trig_init font_text font_sp_shift_disp font_sp_shift_geo font_sp_shift font_ws font_wdth font_emit font_emit_geo font_weight font_mod fe_ring fe_stroke geo_arc fe_stroke ↻ fe_stroke ↻ geo_earc fe_stroke ↻ font_weight ↻ font_mod ↻ font_ws ↻ font_wdth ↻ font_slant fe_stroke ↻ gs_disc fe_ring ↻ font_adv font_adv_em font_adv_em_base font_adv_em_base_geo font_ws ↻ font_wdth ↻ aa_render aa_inside aa_blit

structs

none

consts

23const FG_W: i64 = 1250
24const FG_H: i64 = 220
25const FG_PX: i64 = 150 // specimen em size (letter height ~80px so 1px of the

functions

19func fg_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: fam_render
20func fg_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main
21func fg_num(v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 }
called by 1: main
31func fam_render(text: *u8, rgb: *u8) -> i64
54func fam_lum(rgb: *u8, o: i64) -> i64 { return (2126*(rgb[o] as i64)+7152*(rgb[o+1] as i64)+722*(rgb[o+2] as i64))/10000 }
55func fam_ink(rgb: *u8) -> i64
called by 1: main calls 1: fam_lum
61func fam_isqrt(n: i64) -> i64 { if n<=0 { return 0 } var x: i64=n; var y: i64=(x+1)/2; while y<x { x=y; y=(x+n/x)/2 } return x }
called by 1: fam_bounce
63func fam_bounce(rgb: *u8) -> i64
called by 1: main calls 2: fam_lumfam_isqrt
107func fam_isqrt2(n: i64) -> i64 { if n<=0 { return 0 } var x: i64=n; var y: i64=(x+1)/2; while y<x { x=y; y=(x+n/x)/2 } return x }
called by 1: fam_stroke_cv
108func fam_stroke_cv(rgb: *u8) -> i64
called by 1: main calls 2: fam_lumfam_isqrt2
142func fam_inkw(rgb: *u8) -> i64
called by 1: main calls 1: fam_lum
154func fam_diff(a: *u8, b: *u8) -> i64
called by 1: main
161func main() -> i64