nx_font_device_ladder.nx
buildroot/runtime/nx_font_device_ladder.nx
about
nx_font_device_ladder.nx -- the "works on ANYTHING, beautifully" KEYSTONE: a data-driven DEGRADATION SELECTOR
that routes ONE vector font to the right rendering technique per device, from a GameBoy ROM (8x8 tiles, 2bpp /
4 shades, no FPU) up to an NPU+OLED. Proves BOTH ends: (1) the selector routes 7 device profiles GameBoy->NPU;
(2) the GameBoy EXTREME is rendered CONCRETELY -- our .ttf 'N' box-downsampled to an 8x8, 4-shade tile (looks
good via 4-shade dither, vs blocky 1-bit) and packed into REAL 16-byte GameBoy 2bpp VRAM. High end (SDF/neural)
already built (nx_ttf_sdf, nx_ttf_raster AA). 100% sovereign. expect_exit: 0 license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_syscalls_x86_64.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
| 8 | const K_MAGIC_32768: i64 = 32768 |
| 9 | const K_MAGIC_65536: i64 = 65536 |
| 10 | const K_MAGIC_16777216: i64 = 16777216 |
| 11 | const K_MAGIC_2048: i64 = 2048 |
| 12 | const K_MAGIC_8192: i64 = 8192 |
functions
| 14 | func sw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 15 | func sn(v: i64) -> i64 { let bb: *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{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 } called by 1: main |
| 16 | func hex2(v: i64) -> i64 { let H: *u8="0123456789ABCDEF" as *u8; let o: *u8=sys_mmap(2); o[0]=H[(v/16)%16]; o[1]=H[v%16]; sys_write(1,o,2); return 0 } called by 1: main |
| 17 | func ipow2(n: i64) -> i64 { var r: i64=1; var i: i64=0; while i<n { r=r*2; i=i+1 } return r } called by 1: main |
| 18 | func rd16(b: *u8, o: i64) -> i64 { return (b[o] as i64)*256 + (b[o+1] as i64) } |
| 19 | func rd16s(b: *u8, o: i64) -> i64 { let v: i64=rd16(b,o); if v>=K_MAGIC_32768 { return v-K_MAGIC_65536 } return v } |
| 20 | func rd32(b: *u8, o: i64) -> i64 { return (b[o] as i64)*K_MAGIC_16777216 + (b[o+1] as i64)*K_MAGIC_65536 + (b[o+2] as i64)*256 + (b[o+3] as i64) } |
| 21 | func bit(f: i64, m: i64) -> i64 { if (f/m)%2 == 1 { return 1 } return 0 } called by 1: glyph_edges |
| 22 | func find_table(b: *u8, t0: i64, t1: i64, t2: i64, t3: i64) -> i64 |
| 29 | func cmap_lookup(b: *u8, sub: i64, c: i64) -> i64 |
| 40 | func glyph_edges(b: *u8, glyf: i64, loca: i64, locfmt: i64, gid: i64, ex0: *i64, ey0: *i64, ex1: *i64, ey1: *i64) -> i64 |
| 80 | func inside(gx: i64, gy: i64, ex0: *i64, ey0: *i64, ex1: *i64, ey1: *i64, ne: i64) -> i64 called by 1: main |
| 92 | func route(bpp: i64, fpu: i64, gpu: i64, npu: i64, tile: i64, ppi: i64) -> i64 called by 1: main |
| 99 | func tech_name(t: i64) -> i64 |
| 109 | func main() -> i64 |