def ttf.cmap12.find
gralha-truetype@0.1.0.1 · font.bend:695
import gralha-truetype@0.1.0.1/font.bend as Font
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
695def ttf.cmap12.find(+b: Bin.Bytes, fuel: Nat, +at: U32, +lo: U32, +hi: U32, +cp: U32) -> U32:
696 match fuel:
697 case 0n: lo
698 case 1n+d:
699 +dd = d
700 +mid = U32.div((lo + hi : U32), 2)
701 U.branch(U32, U32.is_ge(lo, hi), _ => lo,
702 _ => U.branch(U32, U32.is_lt(ttf.u32(b, (at + mid * 12 + 4 : U32)), cp), _ => ttf.cmap12.find(b, dd, at, (mid + 1 : U32), hi, cp), _ => ttf.cmap12.find(b, dd, at, lo, mid, cp)))