load_font_with_fallbacks

Function load_font_with_fallbacks 

Source
pub fn load_font_with_fallbacks(
    primary_name: &str,
    fallback_names: &[String],
    custom_paths: &[PathBuf],
    text: Option<&str>,
) -> Result<FontFamily<FontData>, Error>
Expand description

Loads a font with fallback support for better coverage (legacy function).

This function tries to find the best font for the given text by:

  1. Loading the primary font
  2. Loading all fallback fonts
  3. Checking coverage for each
  4. Selecting the font with the best coverage

Note: This function is kept for backward compatibility. New code should use load_font_with_fallback_chain() which returns actual fallback chains instead of selecting a single best font.

§Arguments

  • primary_name - Name of the primary font to load
  • fallback_names - List of fallback font names to try
  • custom_paths - Custom paths to search for fonts
  • text - Optional text to check coverage for

§Returns

The font with the best coverage for the given text