Expand description
Turning app-declared font families into parsed faces.
FontFamily::FileBacked and FontFamily::LoadedTypeface name faces by
file rather than by a name inside the font, so something has to read those
files and hand the bytes to the rasterizer. That is this module: it parses
each face exactly once, at registration, and produces an immutable
SoftwareTextFontSet that measurement and rasterization then share.
The process keeps one copy of each font file’s contents, shared by every
face instanced from it and by later reads that find the file unchanged.
Nothing here runs per frame or per string. A registry is built at startup,
consumed into a font set, and the font set is cloned (it is Arc-backed)
into every measurer and rasterizer that needs it.
Fonts that are not files on disk come in through
SoftwareTextFontRegistry::register_face_reader or
SoftwareTextFontRegistry::register_face_bytes: an APK asset opened with
AndroidApp::asset_manager(), or anything cranpose-assets resolved out of
a desktop bundle. cranpose-assets is a filesystem path resolver, so it
covers bundles but not APK entries, which are not filesystem paths.
Structs§
- Software
Text Font Registry - Parsed app-supplied faces, on their way to a
SoftwareTextFontSet.
Enums§
- Font
Load Error - Why an app-supplied face could not be registered.
Constants§
- ANDROID_
SYSTEM_ FONT_ DIR - Directory Android keeps its system font files in.
- DEFAULT_
SYSTEM_ FAMILY_ WEIGHTS - The weights
SoftwareTextFontRegistry::register_system_familyregisters when an app does not name its own: Compose’s Regular/Medium/Bold set.
Functions§
- system_
declared_ weight - The weight a platform’s own matcher resolves
weightto for a generic family alias — never a value that family’s font config does not declare. - system_
font_ file - The file a platform backs
familywith atweight, if one is present.