Module fonts

Module fonts 

Source

StructsΒ§

FontConfig
Configuration for custom font loading. Allows users to specify custom font paths and override default font selections.

EnumsΒ§

BuiltinVariants πŸ”’
Internal helper that knows how to translate a FontStyle into the concrete printpdf::BuiltinFont for the three supported base families.
FontStyle πŸ”’
Internal helper – font style information that influences the built-in enum.
FontVariant πŸ”’
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.