module text_fontssource
Font formats and fallback for pkg::alloy::text (REFOCUS.md,
R6d): CFF and CFF2 outlines, variable fonts (fvar, avar, gvar,
HVAR, MVAR, CFF2's blends, GDEF's and the feature variations), color
glyphs (COLR versions 0 and 1, CBDT, sbix, their PNGs), and fallback to
the system's fonts for characters a style's faces lack: fontconfig,
DirectWrite, Core Text, and on the web the files a program fetches. A
program installs them on its fonts before adding any:
var fonts = Fonts::create();
text_fonts::install_into(&var fonts);
fonts.fetch(&"fonts/NotoSansArabic.ttf"); // for fallback on the web, read now elsewhere
Without them a face is read for its TrueType outlines alone (a CFF face has none, a variable one is at its default), color glyphs are drawn as their outlines, and characters the bundled font lacks show as boxes (.notdef), the same on every target.
## How it was built
**R6d as built** (2026-10-22; REFOCUS.md, questions 5A and
7B): moved out of text, whose F10a, F10d and F14c notes tell how it
was built: font/ the formats (cff.alloy as text's Outlines,
variations.alloy, gvar.alloy, color.alloy, bitmaps.alloy,
png.alloy) with instances.alloy giving text's FontFormats, which
each face read after keeps; fallback.alloy and system/ the
fallback, text's FontFallback, which fonts made by
Fonts::bundled() keep from asking the system. Tests: tests.alloy
(PNGs, COLR, CBDT and sbix); check.alloy against fontTools' outlines
and hb-shape --variations, fallback through this machine's
fontconfig, and the color sheets as goldens in
tests/golden/text.
fn install_intosource
exp fn install_into(fonts: &var Fonts)
What the fonts read and fall back to from here on: the formats and the
fallback, the system's fonts too unless they are Fonts::bundled().
fn font_formatssource
exp fn font_formats() -> FontFormats
The formats text reads a face with, for a face read apart from fonts
(text's Face::read).