pub struct FontFallbackChain {
pub css_fallbacks: Vec<CssFallbackGroup>,
pub unicode_fallbacks: Vec<FontMatch>,
pub original_stack: Vec<String>,
}Expand description
Resolved font fallback chain for a CSS font-family stack This represents the complete chain of fonts to use for rendering text
Fields§
§css_fallbacks: Vec<CssFallbackGroup>CSS-based fallbacks: Each CSS font expanded to its system fallbacks Example: [“NotoSansJP” -> [Hiragino Sans, PingFang SC], “sans-serif” -> [Helvetica]]
unicode_fallbacks: Vec<FontMatch>Unicode-based fallbacks: Fonts added to cover missing Unicode ranges Only populated if css_fallbacks don’t cover all requested characters
original_stack: Vec<String>The original CSS font-family stack that was requested
Implementations§
Source§impl FontFallbackChain
impl FontFallbackChain
Sourcepub fn resolve_char(
&self,
cache: &FcFontCache,
ch: char,
) -> Option<(FontId, String)>
pub fn resolve_char( &self, cache: &FcFontCache, ch: char, ) -> Option<(FontId, String)>
Resolve which font should be used for a specific character Returns (FontId, css_source_name) where css_source_name indicates which CSS font matched Returns None if no font in the chain can render this character
Sourcepub fn resolve_text(
&self,
cache: &FcFontCache,
text: &str,
) -> Vec<(char, Option<(FontId, String)>)>
pub fn resolve_text( &self, cache: &FcFontCache, text: &str, ) -> Vec<(char, Option<(FontId, String)>)>
Resolve all characters in a text string to their fonts Returns a vector of (character, FontId, css_source) tuples
Sourcepub fn query_for_text(
&self,
cache: &FcFontCache,
text: &str,
) -> Vec<ResolvedFontRun>
pub fn query_for_text( &self, cache: &FcFontCache, text: &str, ) -> Vec<ResolvedFontRun>
Query which fonts should be used for a text string, grouped by font Returns runs of consecutive characters that use the same font This is the main API for text shaping - call this to get font runs, then shape each run
Trait Implementations§
Source§impl Clone for FontFallbackChain
impl Clone for FontFallbackChain
Source§fn clone(&self) -> FontFallbackChain
fn clone(&self) -> FontFallbackChain
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more