code wiki / (root) / nx_ttf_subpixel.nx

nx_ttf_subpixel.nx

buildroot/runtime/nx_ttf_subpixel.nx

10712 B199 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tooltopic ttf
docsdependenciesstructsconstsfunctions

about

nx_ttf_subpixel.nx -- SUBPIXEL / ClearType rendering (L1-2 LCD crispness rung). On an RGB-stripe LCD each pixel is 3 side-by-side R,G,B subpixels; rendering at 3x horizontal resolution and driving each subpixel independently TRIPLES effective horizontal sharpness. Parses our .ttf, computes 3x-horizontal coverage with vertical AA, applies the standard [1,2,3,2,1]/9 ClearType filter per subpixel -> a REAL 24-bit BMP (web_assets/nishi_subpixel.bmp) you can open. Dark text on white; slight R/B color fringe at edges = the ClearType look (crisper at native size on an RGB LCD). Works directly with our coverage -- NO outline-merge/model needed. 100% sovereign. expect_exit: 0 license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls_x86_64.nx nx_ttf_subpixel.nx

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

main sw find_table rd16 rd32 rd16s rd16 ↻ rd32 ↻ cmap_lookup rd16 ↻ rd16s ↻ glyph_edges rd16 ↻ rd32 ↻ rd16s ↻ bit inside wl32 wl16 sys_openat_wr sn

structs

none

consts

8const K_MAGIC_32768: i64 = 32768
9const K_MAGIC_65536: i64 = 65536
10const K_MAGIC_16777216: i64 = 16777216
11const K_MAGIC_2048: i64 = 2048
12const K_MAGIC_2835: i64 = 2835

functions

14func sw(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
15func 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
16func rd16(b: *u8, o: i64) -> i64 { return (b[o] as i64)*256 + (b[o+1] as i64) }
17func rd16s(b: *u8, o: i64) -> i64 { let v: i64=rd16(b,o); if v>=K_MAGIC_32768 { return v-K_MAGIC_65536 } return v }
called by 3: cmap_lookupglyph_edgesmain calls 1: rd16
18func 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) }
19func bit(f: i64, m: i64) -> i64 { if (f/m)%2 == 1 { return 1 } return 0 }
called by 1: glyph_edges
20func wl16(b: *u8, o: i64, v: i64) -> i64 { b[o]=(v%256) as u8; b[o+1]=((v/256)%256) as u8; return o+2 }
called by 1: main
21func wl32(b: *u8, o: i64, v: i64) -> i64 { b[o]=(v%256) as u8; b[o+1]=((v/256)%256) as u8; b[o+2]=((v/K_MAGIC_65536)%256) as u8; b[o+3]=((v/K_MAGIC_16777216)%256) as u8; return o+4 }
called by 1: main
22func find_table(b: *u8, t0: i64, t1: i64, t2: i64, t3: i64) -> i64
called by 1: main calls 2: rd16rd32
29func cmap_lookup(b: *u8, sub: i64, c: i64) -> i64
called by 1: main calls 2: rd16rd16s
40func glyph_edges(b: *u8, glyf: i64, loca: i64, locfmt: i64, gid: i64, ex0: *i64, ey0: *i64, ex1: *i64, ey1: *i64) -> i64
called by 1: main calls 4: rd16rd32rd16sbit
80func inside(gx: i64, gy: i64, ex0: *i64, ey0: *i64, ex1: *i64, ey1: *i64, ne: i64) -> i64
called by 1: main
91func main() -> i64