During font matching, systemfonts has to look in three different locations.
The font registry (populated by register_font()
/register_variant()
), the
local fonts (populated with add_fonts()
/scan_local_fonts()
), and the
fonts installed on the system. It does so in that order: registry > local >
installed.
The matching performed at each step also differs. The fonts in the registry
is only matched by family name. The local fonts are matched based on all the
provided parameters (family, weight, italic, etc) in a way that is local to
systemfonts, but try to emulate the system native matching. The installed
fonts are matched using the system native matching functionality on macOS and
Linux. On Windows the installed fonts are read from the system registry and
matched using the same approach as for local fonts. Matching will always find
a font no matter what you throw at it, defaulting to "sans" if nothing else
is found.