def ttf.pairs.lookups
gralha-truetype@0.1.0.1 · font.bend:559
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
559
560def ttf.pairs.lookups(+b: Bin.Bytes, n: Nat, +list: U32, +at: U32) -> TTPairs:
561 match n:
562 case 0n: ttf.pairs.empty()
563 case 1n+d:
564 +lookup = (list + ttf.u16(b, at) : U32)
565 +found = ttf.pairs.subtables(b, U32.to_nat(ttf.u16(b, (lookup + 4 : U32))), lookup, (lookup + 6 : U32), ttf.u16(b, lookup), ttf.pairs.empty())
566 U.branch(TTPairs, ttf.pairs.any(found), _ => found, _ => ttf.pairs.lookups(b, d, list, (at + 2 : U32)))