pub fn load_font_with_config(
name: &str,
config: Option<&FontConfig>,
text: Option<&str>,
) -> Result<FontFamily<FontData>, Error>Expand description
Loads a font family using the provided FontConfig, with intelligent fallback. This is the main entry point for loading fonts with custom configuration.
§Arguments
name- The font family name to loadconfig- Optional font configuration with custom pathstext- Optional text content for font subsetting
§Returns
Ok(FontFamily<FontData>)if the font is foundErr(Error)if the font cannot be loaded from any source
§Loading strategy
- If custom_paths are provided in config, search there first
- Check if it’s a built-in font (helvetica, times, courier)
- Search system fonts
- Apply font subsetting if enabled and text is provided
- Return error if nothing found