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Β§
- COURIER_
PRIME_ πBOLD - COURIER_
PRIME_ πBOLD_ ITALIC - COURIER_
PRIME_ πITALIC - COURIER_
PRIME_ πREGULAR - NOTO_
SANS_ πBOLD - NOTO_
SANS_ πBOLD_ ITALIC - NOTO_
SANS_ πITALIC - NOTO_
SANS_ πREGULAR - SPACE_
MONO_ πBOLD - SPACE_
MONO_ πBOLD_ ITALIC - SPACE_
MONO_ πITALIC - SPACE_
MONO_ π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_
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.
- 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.
- try_
embedded_ πfont_ family - Attempt to build a
FontFamily<FontData>from the embedded fonts.