code wiki / (root) / nx_font_census.nx

nx_font_census.nx source

↩ module page · 85 lines · 6498 B

1// nx_font_census.nx -- R0 of the SOVEREIGN FONT ladder (our own typeface, hardware-rung-up). Honest maturity map, 2// grounded in the Nishi researcher's banked corpus (knowledge/fetched/font_*.raw: Glyph/Bezier/TrueType/OpenType/ 3// WOFF/Font_rasterization/Font_hinting/FreeType/Typeface) + the REAL organs on disk. Same liar-kill idiom as the 4// other censuses. GREEN = the map is honest; the ABSENT cells ARE the rung ladder to a web-embeddable distinctive 5// typeface: R1 outline contours -> R2 TTF/OTF FILE emitter -> R3 data-URI @font-face embed (closes the axis) -> 6// deeper (full glyph set, hinting, WOFF, shaping, variable). KEY placement: we HAVE original sovereign glyphs + 7// an AA rasterizer (nx_nishi_font_core, for OUR renderer/WASM); we NEED the font-FILE path for a browser/OS. 8// license_tier: ORIGINAL expect_exit: 0 9import "nx_syscalls.nx" 10 11const G_ABSENT: i64 = 0 12const G_PRESENT: i64 = 1 13const G_PARITY: i64 = 2 14const G_EXCEEDS: i64 = 3 15 16func sw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 17func 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 } 18 19func grade_name(g: i64) -> i64 { 20 if g==G_ABSENT { sw("ABSENT " as *u8) } 21 if g==G_PRESENT { sw("PRESENT" as *u8) } 22 if g==G_PARITY { sw("PARITY " as *u8) } 23 if g==G_EXCEEDS { sw("EXCEEDS" as *u8) } 24 return 0 25} 26func cap_valid(grade: i64, has_ev: i64) -> i64 { if grade >= G_PARITY { if has_ev == 0 { return 0 } } return 1 } 27func row(pillar: *u8, cap: *u8, grade: i64, base: *u8, ev: *u8, has_ev: i64, tot: *i64) -> i64 { 28 sw(" " as *u8); sw(pillar); sw(" | " as *u8); sw(cap); sw(" -> " as *u8); grade_name(grade) 29 if cap_valid(grade, has_ev) == 0 { sw(" <== INVALID (LIAR-KILL)" as *u8); tot[4]=tot[4]+1 } 30 else { if has_ev == 1 { sw(" [have: " as *u8); sw(ev); sw("]" as *u8) } } 31 sw(" {vs " as *u8); sw(base); sw("}\n" as *u8) 32 tot[grade] = tot[grade] + 1 33 return 0 34} 35 36func main() -> i64 { 37 let tot: *i64 = sys_mmap(64) as *i64 38 tot[0]=0; tot[1]=0; tot[2]=0; tot[3]=0; tot[4]=0 39 40 sw("=== nx_font_census R0 -- SOVEREIGN FONT ladder (our own typeface, hardware-rung-up), honest ===\n" as *u8) 41 sw("ABSENT cells = the RUNG LADDER: R1 outline-contours -> R2 TTF/OTF FILE emit -> R3 data-URI @font-face -> deeper.\n" as *u8) 42 43 sw("-- GL GLYPH DESIGN (sovereign, no license = the moat) --\n" as *u8) 44 row("GL" as *u8, "original sovereign glyph designs (no outline copied)" as *u8, G_PRESENT, "licensed foundry fonts (per-glyph copyright)" as *u8, "nx_nishi_font_core: N/I/S/H/B/R/O/W/E + 0-9 designed in-house" as *u8, 1, tot) 45 row("GL" as *u8, "stroke / centerline glyph model + EM grid" as *u8, G_PRESENT, "metafont-style stroke fonts" as *u8, "nx_nishi_font_core nf_us stroke segments, EM=28" as *u8, 1, tot) 46 row("GL" as *u8, "filled outline contours (glyf-ready)" as *u8, G_PRESENT, "TrueType glyf contours (quadratic curves = enhancement)" as *u8, "nx_font_outline R1 5/5 glyf-ready (endPts+on-curve)" as *u8, 1, tot) 47 row("GL" as *u8, "full Latin coverage (a-z + punctuation + accents)" as *u8, G_ABSENT, "full typeface ~200+ glyphs (we have ~24)" as *u8, "" as *u8, 0, tot) 48 49 sw("-- RS RASTERIZE (a real STRENGTH) --\n" as *u8) 50 row("RS" as *u8, "anti-aliased rasterizer (supersample mask)" as *u8, G_PRESENT, "FreeType AA raster" as *u8, "nx_nishi_font_core 4x SS box-AA + nx_aa_font_demo" as *u8, 1, tot) 51 row("RS" as *u8, "bitmap fonts (multi-size / multi-script)" as *u8, G_PRESENT, "console/embedded bitmap fonts" as *u8, "nx_font_bitmap_5x7 / 8x8 / 1bpp / cyrillic / latin-ext" as *u8, 1, tot) 52 row("RS" as *u8, "hinting / grid-fit at small px" as *u8, G_ABSENT, "TrueType hinting / FreeType autohint" as *u8, "" as *u8, 0, tot) 53 54 sw("-- FF FONT-FILE FORMAT (the web/OS rung -- THE GAP, R2 keystone) --\n" as *u8) 55 row("FF" as *u8, "TrueType FILE emitter (sfnt tables + checksums)" as *u8, G_PRESENT, "a real .ttf a browser/OS loads" as *u8, "nx_font_ttf_emit: nishi.ttf 828B self-validated, file-cksum=0xB1B0AFBA" as *u8, 1, tot) 56 row("FF" as *u8, "cmap (Unicode->glyph) + hmtx (metrics) tables" as *u8, G_PRESENT, "OTF required tables" as *u8, "nx_font_ttf_emit: cmap format-4 + hmtx emitted+validated" as *u8, 1, tot) 57 row("FF" as *u8, "WOFF / WOFF2 web wrap" as *u8, G_ABSENT, "compressed web font (WOFF2)" as *u8, "" as *u8, 0, tot) 58 59 sw("-- WE WEB EMBED (closes the distinctive-typeface axis) --\n" as *u8) 60 row("WE" as *u8, "font as data-URI @font-face (sovereign, 0 external)" as *u8, G_PRESENT, "external Google Fonts load (3rd-party)" as *u8, "nx_font_web_embed: nishi_font_test.html base64 @font-face" as *u8, 1, tot) 61 row("WE" as *u8, "OUR typeface live in the kit / Connect pages" as *u8, G_ABSENT, "the payoff: award-census TY-typeface cell -> PRESENT" as *u8, "" as *u8, 0, tot) 62 63 sw("-- SH/VF SHAPING + ADVANCED --\n" as *u8) 64 row("SH" as *u8, "kerning + text->glyph shaping" as *u8, G_ABSENT, "HarfBuzz shaping / kern table" as *u8, "" as *u8, 0, tot) 65 row("VF" as *u8, "variable font (weight / width axes)" as *u8, G_ABSENT, "OpenType variable fonts (gvar/fvar)" as *u8, "" as *u8, 0, tot) 66 67 sw("--- DISTRIBUTION ---\n" as *u8) 68 sw(" ABSENT=" as *u8); sn(tot[0]); sw(" PRESENT=" as *u8); sn(tot[1]); sw(" PARITY=" as *u8); sn(tot[2]); sw(" EXCEEDS=" as *u8); sn(tot[3]) 69 let total: i64 = tot[0]+tot[1]+tot[2]+tot[3] 70 sw(" TOTAL=" as *u8); sn(total); sw(" invalid=" as *u8); sn(tot[4]); sw("\n" as *u8) 71 72 var neg_ok: i64 = 1 73 if cap_valid(G_EXCEEDS, 0) != 0 { neg_ok = 0 } 74 if cap_valid(G_PRESENT, 0) != 1 { neg_ok = 0 } 75 sw(" NEG-CONTROL liar-kill fires: " as *u8); if neg_ok==1 { sw("YES\n" as *u8) } else { sw("NO\n" as *u8) } 76 sw(" READ: we HAVE original sovereign glyphs + an AA rasterizer (for OUR renderer/WASM); the GAP is the\n" as *u8) 77 sw(" font-FILE path a browser/OS loads. NEXT RUNG = R1 outline contours (stroke->filled), then R2 the TTF emitter.\n" as *u8) 78 79 var green: i64 = 0 80 if tot[4] == 0 { if neg_ok == 1 { green = 1 } } 81 if green == 1 { sw("VERDICT: GREEN (honest font map; sovereign glyphs+AA PRESENT; TTF/web rungs ABSENT = the build ladder)\n" as *u8); sys_exit(0) } 82 sw("VERDICT: RED\n" as *u8) 83 sys_exit(1) 84 return 1 85}