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Β§

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.