def font.ttf
gralha-truetype@0.1.0.1 · font.bend:788
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
788
789
790def font.ttf(+face: U32, +b: Bin.Bytes, +book: FontBook) -> FontBook:
791 FontBook{glyphs, kerning, metrics, faces} = book
792 +f = ttf.font(b)
793 U.branch(FontBook, ttf.valid(f),
794 _ => ttf.metrics(b, face, ttf.table(b, 1330851634), ttf.units(f), FontBook{glyphs, kerning, metrics, Map.set(&2, TTFace, faces, U32.show(face), TTFace{b, f, ttf.pairs(b), ttf.cmap.subtable(b)})}),
795 _ => FontBook{glyphs, kerning, metrics, faces})