code wiki / _hdl_build / nx_font_advdiff.nx
nx_font_advdiff.nx
buildroot/runtime/_hdl_build/nx_font_advdiff.nx
about
nx_font_advdiff.nx -- FONT-METRICS DRIFT instrument (operator 2026-07-28: "use free fonts as
another benchmark -- make sure the browser isn't held back by something dumb like that").
Reads a real TTF's cmap(format 4) + hmtx and prints, for ASCII 32..126, the font's advance in
1000/em units next to OUR font_adv_em(ch), plus the drift. Wrap points come from summed advances,
so per-char drift vs Arial (Chrome's default sans; metrics == Liberation Sans, SIL-OFL) IS the
structural-exactness gap of every line break. usage: nx_font_advdiff <path.ttf>
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_font.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
| 9 | const K_MAGIC_65536: i64 = 65536 |
functions
| 11 | func w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 12 | func n2(v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; if m<0{w("-" as *u8);m=0-m} 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 } |
| 13 | func u16(p: *u8, o: i64) -> i64 { return ((p[o]&0xff)*256) + (p[o+1]&0xff) } |
| 14 | func u32(p: *u8, o: i64) -> i64 { return (u16(p,o)*K_MAGIC_65536) + u16(p,o+2) } |
| 15 | func tag_is(p: *u8, o: i64, a: i64, b: i64, c: i64, d: i64) -> i64 called by 1: main |
| 20 | func main(argc: i64, argv: *i64) -> i64 |