code wiki / (root) / nx_font_cjk.nx

nx_font_cjk.nx

buildroot/runtime/nx_font_cjk.nx

18704 B303 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tooltopic font
docsdependenciesstructsconstsfunctions

about

nx_font_cjk.nx -- FIRST CJK / ASIAN rung: prove the stroke generator extends to Han (Chinese/Japanese/Korean). Han characters ARE stroke-based (horizontal/vertical/etc.), so our stroke->rectangle generator suits them naturally. Generates 8 REAL, common Han characters composed of horizontal+vertical strokes and maps them to their TRUE Unicode codepoints via a GENERIC cmap-format-4 (scattered BMP codepoints) -> web_assets/nishi_cjk.ttf, self-validated. Chars: 一(U+4E00 one) 三(4E09 three) 二(4E8C two) 十(5341 ten) 口(53E3 mouth) 日(65E5 sun/day) 田(7530 field) 王(738B king). HONEST: 8 chars is a PROOF the generator handles CJK -- NOT coverage (full CJK = 101,000+ Han, the scale rung). license_tier: ORIGINAL expect_exit: 0

dependencies 1 imports · 0 importers

nx_syscalls_x86_64.nx nx_font_cjk.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 gen_han add_rect append_glyph w16 si16 w8 align4 w16 ↻ si16 ↻ w8 ↻ w32 csum r32 sys_openat_wr sw sn b64_encode b64c he_puts

structs

none

consts

9const MAGIC_MAGIC_65536: i64 = 65536
10const MAGIC_MAGIC_16777216: i64 = 16777216
11const MAGIC_MAGIC_4294967296: i64 = 4294967296
12const MAGIC_MAGIC_20096: i64 = 20096
13const MAGIC_MAGIC_20105: i64 = 20105
14const MAGIC_MAGIC_20108: i64 = 20108
15const MAGIC_MAGIC_21313: i64 = 21313
16const MAGIC_MAGIC_5341: i64 = 5341
17const MAGIC_MAGIC_21475: i64 = 21475
18const MAGIC_MAGIC_26085: i64 = 26085
19const MAGIC_MAGIC_30000: i64 = 30000
20const MAGIC_MAGIC_7530: i64 = 7530
21const MAGIC_MAGIC_29579: i64 = 29579
22const MAGIC_MAGIC_8192: i64 = 8192
23const MAGIC_MAGIC_16384: i64 = 16384
24const MAGIC_MAGIC_65535: i64 = 65535
25const MAGIC_MAGIC_1594834165: i64 = 1594834165
26const MAGIC_MAGIC_1033: i64 = 1033
27const MAGIC_MAGIC_196608: i64 = 196608
28const MAGIC_MAGIC_131072: i64 = 131072
30const MAGIC_ADJ: i64 = 2981146554

functions

32func 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
33func 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
35func si16(v: i64) -> i64 { if v<0 { return v+MAGIC_MAGIC_65536 } return v }
called by 2: append_glyphmain
36func w8(b: *u8, o: i64, v: i64) -> i64 { b[o]=(v%256) as u8; return o+1 }
called by 2: append_glyphmain
37func w16(b: *u8, o: i64, v: i64) -> i64 { b[o]=((v/256)%256) as u8; b[o+1]=(v%256) as u8; return o+2 }
called by 2: append_glyphmain
38func w32(b: *u8, o: i64, v: i64) -> i64 { b[o]=((v/MAGIC_MAGIC_16777216)%256) as u8; b[o+1]=((v/MAGIC_MAGIC_65536)%256) as u8; b[o+2]=((v/256)%256) as u8; b[o+3]=(v%256) as u8; return o+4 }
called by 1: main
39func r32(b: *u8, o: i64) -> i64 { return (b[o] as i64)*MAGIC_MAGIC_16777216 + (b[o+1] as i64)*MAGIC_MAGIC_65536 + (b[o+2] as i64)*256 + (b[o+3] as i64) }
called by 1: csum
40func align4(o: i64) -> i64 { while o%4 != 0 { o=o+1 } return o }
called by 1: main
41func csum(b: *u8, off: i64, len: i64) -> i64 { var s: i64=0; var i: i64=off; while i < off+len { s = (s + r32(b,i)) % MAGIC_MAGIC_4294967296; i=i+4 } return s }
called by 1: main calls 1: r32
42func he_puts(buf: *u8, off: i64, s: *u8) -> i64 { var o: i64=off; var i: i64=0; while s[i]!=0 { buf[o]=s[i]; o=o+1; i=i+1 } return o }
called by 1: main
43func b64c(v: i64) -> i64 { if v<26 { return 65+v } if v<52 { return 97+(v-26) } if v<62 { return 48+(v-52) } if v==62 { return 43 } return 47 }
called by 1: b64_encode
44func b64_encode(inb: *u8, n: i64, out: *u8) -> i64
called by 1: main calls 1: b64c
53func add_rect(px: *i64, py: *i64, ep: *i64, pc: i64, cc: i64, x0: i64, y0: i64, x1: i64, y1: i64) -> i64
called by 1: gen_han
60func gen_han(gid: i64, wr: i64, ep: *i64, px: *i64, py: *i64, meta: *i64) -> i64
called by 1: main calls 1: add_rect
117func append_glyph(g: *u8, go: i64, ep: *i64, px: *i64, py: *i64, meta: *i64) -> i64
called by 1: main calls 3: w16si16w8
134func main() -> i64