def ttf.cmap12.gid
gralha-truetype@0.1.0.1 · font.bend:704
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
704def ttf.cmap12.gid(+b: Bin.Bytes, +sub: U32, +cp: U32) -> U32:
705 +at = (sub + 16 : U32)
706 +count = ttf.u32(b, (sub + 12 : U32))
707 +i = ttf.cmap12.find(b, 40n, at, 0, count, cp)
708 +start = ttf.u32(b, (at + i * 12 : U32))
709 U.branch(U32, U32.is_ge(i, count) || U32.is_lt(cp, start), _ => 0, _ => (ttf.u32(b, (at + i * 12 + 8 : U32)) + cp - start : U32))