code wiki / _hdl_build / nx_font_baseline_census.nx

nx_font_baseline_census.nx

buildroot/runtime/_hdl_build/nx_font_baseline_census.nx

8651 B160 linesdepth 10pulls 45 transitivereach 0 importersview sourcekind tooltopic font
docsdependenciesstructsconstsfunctions

about

nx_font_baseline_census.nx -- the PROFESSIONAL-CONSISTENCY benchmark for the pioneer font: how much do the letters BOUNCE off the baseline? Amateur type has a wandering baseline; professional type is dead-flat (round letters overshoot by a small CONSTANT). Renders an all-x-height word ("consensus" -- no ascenders/descenders, so every glyph's bottom IS the baseline) in OUR font and Chrome's Arial; segments letters by white-column gaps; measures each letter's bottom row; reports the STANDARD DEVIATION of the bottoms, normalized by letter height (permille) -> the bounce. Lower = more professional. LIAR-KILL: a synthetic ALIGNED row of bars must read ~0 bounce and a deliberately BOUNCY row must read high -- else the metric is broken. license_tier: ORIGINAL expect_exit: 0

dependencies 1 imports · 0 importers

nx_img_bytes_to_rgb.nx nx_font_baseline_census.nx

imports: nx_img_bytes_to_rgb.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main fb_puts fb_make_bars fb_measure fb_lum fb_isqrt fb_num fb_load sys_read_file sys_openat_rd sys_lseek sys_mmap sys_read sys_close nx_img_bytes_to_rgb sys_mmap ↻ nx_jpeg_decode_rgb sys_mmap ↻ nx_jpeg_dec_ctx_init sys_mmap ↻ _jpeg_ascii_probe_sof sys_mmap ↻ nx_jpeg_seg_init nx_jpeg_seg_next nx_jpeg_classify_marker nx_jpeg_marker_is_lengthle nx_jpeg_sof_parse nx_jpeg_is_progressive prog_be16 nx_jpeg_prog_decode sys_mmap ↻ prog_be16 ↻ nx_jpeg_dqt_parse nx_jpeg_dht_parse nx_jpeg_dht_build_decode_t nx_jpeg_sos_parse prog_next_marker prog_scan sys_mmap ↻ nx_jpeg_huff_decode_symbol

structs

none

consts

10const K_MAGIC_2126: i64 = 2126
11const K_MAGIC_7152: i64 = 7152
12const K_MAGIC_10000: i64 = 10000

functions

14func fb_puts(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 fb_num(v: i64) -> i64 { let b: *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{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 }
called by 1: main
16func fb_lum(rgb: *u8, o: i64) -> i64 { return (K_MAGIC_2126*(rgb[o] as i64)+K_MAGIC_7152*(rgb[o+1] as i64)+722*(rgb[o+2] as i64))/K_MAGIC_10000 }
called by 1: fb_measure
17func fb_isqrt(n: i64) -> i64 { if n<=0 { return 0 } var x: i64=n; var y: i64=(x+1)/2; while y<x { x=y; y=(x+n/x)/2 } return x }
called by 1: fb_measure
21func fb_measure(rgb: *u8, w: i64, h: i64, out: *i64) -> i64
called by 1: main calls 2: fb_lumfb_isqrt
79func fb_load(path: *u8, wh: *i64) -> *u8
86func fb_make_bars(rgb: *u8, w: i64, h: i64, n: i64, jitter: i64) -> i64
called by 1: main
105func main() -> i64