def ttf.simple

gralha-truetype@0.1.0.1 · font.bend:229

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

229# A simple glyph at absolute offset g with the given contour count.
230def ttf.simple(+b: Bin.Bytes, +g: U32, +contours: U32) -> TTGlyph:
231  +ends = ttf.ends(b, U32.to_nat(contours), (g + 10 : U32))
232  +count = U.choose(U32, U32.is_gt(contours, 0), (ttf.last(ends, 0) + 1 : U32), 0)
233  +instructions = ttf.u16(b, (g + 10 + contours * 2 : U32))
234  ttf.simple.flags(b, ends, count, ttf.flags(b, U32.to_nat(count), (g + 12 + contours * 2 + instructions : U32), 0, 0))

Uses (13)

Used by (2)