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

FontSource locates fonts that are not already registered.

A source may consult installed fonts, downloaded assets, or another host-owned repository. FontCollection consults sources in registration order.

Required Methods§

Source

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

family returns every available face matching a family name.

Source

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

face_for_codepoint returns a covering face nearest to attrs.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl FontSource for SystemFonts

Source§

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

Source§

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

Implementors§