code wiki / _hdl_build / nx_font_family_gate.nx
nx_font_family_gate.nx
buildroot/runtime/_hdl_build/nx_font_family_gate.nx
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
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
structs
| none |
consts
| 23 | const FG_W: i64 = 1250 |
| 24 | const FG_H: i64 = 220 |
| 25 | const FG_PX: i64 = 150 // specimen em size (letter height ~80px so 1px of the |
functions
| 19 | func 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 |
| 20 | func 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 |
| 21 | func 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 |
| 31 | func fam_render(text: *u8, rgb: *u8) -> i64 |
| 54 | func 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 } |
| 55 | func fam_ink(rgb: *u8) -> i64 |
| 61 | func 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 |
| 63 | func fam_bounce(rgb: *u8) -> i64 |
| 107 | func 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 |
| 108 | func fam_stroke_cv(rgb: *u8) -> i64 |
| 142 | func fam_inkw(rgb: *u8) -> i64 |
| 154 | func fam_diff(a: *u8, b: *u8) -> i64 called by 1: main |
| 161 | func main() -> i64 |