StructsΒ§
- Font
Config - Configuration for custom font loading. Allows users to specify custom font paths and override default font selections.
EnumsΒ§
- Builtin
Variants π - Internal helper that knows how to translate a
FontStyleinto the concreteprintpdf::BuiltinFontfor the three supported base families. - Font
Style π - Internal helper β font style information that influences the built-in enum.
- Font
Variant π - Font style variant types
StaticsΒ§
- MONO_
SANS_ BOLD - MONO_
SANS_ BOLD_ ITALIC - MONO_
SANS_ ITALIC - MONO_
SANS_ REGULAR - MONO_
SERIF_ BOLD - MONO_
SERIF_ BOLD_ ITALIC - MONO_
SERIF_ ITALIC - MONO_
SERIF_ REGULAR - SANS_
BOLD - SANS_
BOLD_ ITALIC - SANS_
ITALIC - SANS_
REGULAR - SERIF_
BOLD - SERIF_
BOLD_ ITALIC - SERIF_
ITALIC - SERIF_
REGULAR
FunctionsΒ§
- apply_
subsetting_ πif_ enabled - Applies font subsetting if enabled and text is provided.
- apply_
subsetting_ to_ chain - Applies font subsetting to a fallback chain to reduce PDF file size.
- extract_
primary_ fonts - Extracts primary fonts from a fallback chain family.
- find_
embedded_ πfamily_ and_ name - Find an embedded family and return it along with the canonical family name
- find_
font_ πvariant_ in_ paths - Searches for a specific font variant file in custom paths.
- format_
size π - Formats a byte size in a human-readable format.
- get_
default_ fallback_ fonts - Returns a list of sensible default fallback fonts for the given primary font.
- get_
font_ πaliases - Returns common aliases for a font name.
- load_
builtin_ font_ family - Attempts to load a built-in PDF font family using only the PDF built-in fonts without any system font dependencies. This ensures consistent character spacing across all platforms and avoids kerning issues.
- load_
custom_ font_ family - Attempts to load a font family from custom paths first, then falls back to system fonts. This function searches user-specified directories or files before looking in system fonts.
- load_
font_ family_ with_ variants - Loads a font family with proper variant files (Bold, Italic, BoldItalic).
- load_
font_ with_ config - Loads a font family using the provided FontConfig, with intelligent fallback. This is the main entry point for loading fonts with custom configuration.
- load_
font_ with_ fallback_ chain - Loads fonts and creates a fallback chain for handling mixed-script documents.
- load_
font_ with_ fallbacks - Loads a font with fallback support for better coverage (legacy function).
- load_
system_ πfont_ bytes_ fallback - Attempts to find a suitable system font for built-in font metrics. Falls back to any available system font if specific candidates arenβt found.
- load_
system_ font_ family_ simple - Attempts to load an arbitrary system font family and embed it into the PDF.
- load_
unicode_ system_ font - Loads a Unicode-capable system font with good international character support.
- missing_
glyphs_ for_ family - Returns a list of missing characters for a given
FontFamily<FontData>and text - report_
missing_ glyphs - Best-effort report: for a set of fonts (from config or defaults) returns a vector of (font_name, missing_chars)
- subset_
chain π - Subsets a single fallback chain by subsetting each font based on what it renders.
- subset_
single_ πfont - Subsets a single FontData based on the provided text.