load_system_font_family_simple

Function load_system_font_family_simple 

Source
pub fn load_system_font_family_simple(
    name: &str,
) -> Result<FontFamily<FontData>, Error>
Expand description

Attempts to load an arbitrary system font family and embed it into the PDF.

The same underlying TrueType font file is re-used for all four style variants. While this means that bold / italic rendering falls back to faux effects provided by the PDF viewer, it keeps the implementation simple and – most importantly – guarantees that we use real glyph metrics (including kerning) instead of relying on the limited built-in font set. This is usually enough to get visually pleasing output for the vast majority of documents.

If the requested family cannot be found, an InvalidFont error is returned so that the caller can decide how to proceed (e.g. fall back to a built-in font).