Font.ttf.coverage.array: def of gralha-truetype@0.1.0.1 Import: import gralha-truetype@0.1.0.1/font.bend as Font Lines 573-583 of gralha-truetype@0.1.0.1/font.bend: https://jend.leeeet.dev/read.txt?path=gralha-truetype@0.1.0.1/font.bend&start_line=573&end_line=583 import Base import gralha-text-scan@0.1.0.1/scan.bend as U import gralha-bytes@0.1.0.1/bytes.bend as Bin # Coverage index plus one (0 when absent), by binary search over sorted glyphs or ranges. def ttf.coverage.array(+b: Bin.Bytes, fuel: Nat, +base: U32, +lo: U32, +hi: U32, +gid: U32) -> U32: match fuel: case 0n: 0 case 1n+d: +dd = d +mid = U32.div((lo + hi : U32), 2) +g = ttf.u16(b, (base + mid * 2 : U32)) U.branch(U32, U32.is_ge(lo, hi), _ => 0, _ => U.branch(U32, U32.is_eq(g, gid), _ => (mid + 1 : U32), _ => U.branch(U32, U32.is_lt(g, gid), _ => ttf.coverage.array(b, dd, base, (mid + 1 : U32), hi, gid), _ => ttf.coverage.array(b, dd, base, lo, mid, gid)))) Uses (11): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.div https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_eq https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_ge https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_lt https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.mul https://jend.leeeet.dev/definition.txt?path=gralha-bytes@0.1.0.1/bytes.bend&name=Bytes https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=branch https://jend.leeeet.dev/definition.txt?path=gralha-truetype@0.1.0.1/font.bend&name=ttf.u16