Skip to main content

FontSource

Trait FontSource 

Source
pub trait FontSource {
    // Required methods
    fn family(&mut self, name: &str) -> Vec<Font>;
    fn face_for_codepoint(
        &mut self,
        codepoint: char,
        attrs: FontAttrs,
    ) -> Option<Font>;
}
Expand description

Somewhere fonts can come FROM when the collection lacks them — the pluggable half of the demand loop. Implementations only locate and parse (an installed-fonts scan today; a platform-native CoreText/DirectWrite lookup can replace it without touching policy); the growth policy itself lives in FaceSet::grown_by.

Required Methods§

Source

fn family(&mut self, name: &str) -> Vec<Font>

Every face answering to name (all weights and styles — the collection’s nearest-variant matching picks per span).

Source

fn face_for_codepoint( &mut self, codepoint: char, attrs: FontAttrs, ) -> Option<Font>

One face covering codepoint, nearest to attrs.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§