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 text engine. That is this module: it
parses each face exactly once, at registration, into the typefaces text
lays out and draws with. 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
and consumed into typefaces, which are Arc-backed.
Fonts that are not files on disk come in through
FontRegistry::register_face_reader or
FontRegistry::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§
- Font
Registry - Parsed app-supplied faces, on their way to the typefaces text lays out with.
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
FontRegistry::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.