Function genpdf::fonts::from_files[][src]

pub fn from_files(
    dir: impl AsRef<Path>,
    name: &str,
    builtin: Option<Builtin>
) -> Result<FontFamily<FontData>, Error>
Expand description

Loads the font family at the given path with the given name.

This method assumes that at the given path, these files exist and are valid font files:

  • {name}-Regular.ttf
  • {name}-Bold.ttf
  • {name}-Italic.ttf
  • {name}-BoldItalic.ttf

If builtin is set, built-in PDF fonts are used instead of embedding the fonts in the PDF file (see the module documentation for more information). In this case, the given fonts must be metrically identical to the built-in fonts.