Skip to main content

Module fonts

Module fonts 

Source
Expand description

Font matching, and the platform’s own typeface for a family (feature system-fonts). Font matching, and the platform’s own typeface for a family.

select_face is the one matcher — CSS Fonts Module Level 4 §5.1 “Localized name matching” and §5.2 “Matching font styles” over a list of face descriptions — and needs no font database, so it is compiled unconditionally. Behind the system-fonts feature, system_face runs it over the system font database, loaded once per process, and returns the chosen face’s bytes; on macOS the system UI font is found by its file through Core Text, because no font database files it under the name the platform documents. system_face substitutes no family; substitute_family, behind the same feature, names the family the platform draws in place of one it has no face of — on Linux and the other fontconfig platforms, fontconfig’s best match, which system_face then finds by name.

Structs§

FaceTraits
What select_face knows about one candidate face.
SystemFace
A face system_face chose: its bytes, and what fontdb records for it.

Functions§

is_macos_system_ui_family
Whether family names the macOS system UI font: caselessly equal to “SF Pro”, the name the platform documents for it (docs/platform-facts.md:59-67) and macos-sonoma states. A pure predicate, on every platform, with no font database: system_face’s macOS branch asks it beside its Core Text family comparison, and the gpui connector asks it alone to map the family to gpui’s own alias.
select_face
The index in faces of the face CSS Fonts Module Level 4 selects for family, weight and style, or None where no face records family.
substitute_family
The family the platform draws in place of family, or None where the platform has that family, gives no answer, or its fallback is not implemented here.
system_face
The system’s own face for family, weight and style, or None.