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§
- Face
Traits - What
select_faceknows about one candidate face. - System
Face - A face
system_facechose: its bytes, and what fontdb records for it.
Functions§
- is_
macos_ system_ ui_ family - Whether
familynames the macOS system UI font: caselessly equal to “SF Pro”, the name the platform documents for it (docs/platform-facts.md:59-67) andmacos-sonomastates. 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
facesof the face CSS Fonts Module Level 4 selects forfamily,weightandstyle, orNonewhere no face recordsfamily. - substitute_
family - The family the platform draws in place of
family, orNonewhere the platform has that family, gives no answer, or its fallback is not implemented here. - system_
face - The system’s own face for
family,weightandstyle, orNone.