pub fn system_face(
family: &str,
weight: u16,
style: FontStyle,
) -> Option<SystemFace>Expand description
The system’s own face for family, weight and style, or None.
The first call in a process loads the system font database
(fontdb::Database::load_system_fonts), which every later call shares;
each call runs select_face over its faces and copies the chosen
face’s file into the returned SystemFace, so call it when a theme
changes, not per frame. A family the system has no face of is None:
nothing is substituted here; substitute_family names the family the
platform draws in its place, to ask this function for next. On macOS a
family that names the system UI
font — is_macos_system_ui_family, or caselessly Core Text’s own
family name for it — is found by its file instead: fontdb files that
font under .SF NS, not under the platform’s name, so Core Text is
asked which file its system font is (upright, or its italic for an
Italic or Oblique style), that file alone is loaded, and
select_face picks among its faces by width, style and weight under
the family the file itself records; a None from Core Text, or a file
that yields no face, is None here too. Every other family, on macOS as
elsewhere, goes through the name lookup.