def ttf.kern.classes

gralha-truetype@0.1.0.1 · font.bend:757

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

757# The format 2 class grid; leftClass counts from one (0 means uncovered).
758def ttf.kern.classes(+b: Bin.Bytes, +sub: U32, +leftClass: U32, +rightClass: U32) -> F32:
759  +vf1 = ttf.u16(b, (sub + 4 : U32))
760  +vf2 = ttf.u16(b, (sub + 6 : U32))
761  +rows = ttf.u16(b, (sub + 12 : U32))
762  +columns = ttf.u16(b, (sub + 14 : U32))
763  +size = (ttf.value.size(vf1) + ttf.value.size(vf2) : U32)
764  U.branch(F32, U32.is_eq(sub, 0) || U32.is_eq(leftClass, 0) || U32.is_gt(leftClass, rows) || U32.is_ge(rightClass, columns), _ => 0.0,
765    _ => ttf.xadvance(b, (sub + 16 + ((leftClass - 1) * columns + rightClass) * size : U32), vf1))

Uses (14)

Used by (1)