Trait fonts::PlatformFontMethods

source ·
pub trait PlatformFontMethods: Sized {
    // Required methods
    fn new_from_data(
        font_identifier: FontIdentifier,
        data: Arc<Vec<u8>>,
        face_index: u32,
        pt_size: Option<Au>,
    ) -> Result<PlatformFont, &'static str>;
    fn descriptor(&self) -> FontTemplateDescriptor;
    fn glyph_index(&self, codepoint: char) -> Option<GlyphId>;
    fn glyph_h_advance(&self, _: GlyphId) -> Option<FractionalPixel>;
    fn glyph_h_kerning(
        &self,
        glyph0: GlyphId,
        glyph1: GlyphId,
    ) -> FractionalPixel;
    fn can_do_fast_shaping(&self) -> bool;
    fn metrics(&self) -> FontMetrics;
    fn table_for_tag(&self, _: FontTableTag) -> Option<FontTable>;
    fn typographic_bounds(&self, _: GlyphId) -> Rect<f32>;
    fn webrender_font_instance_flags(&self) -> FontInstanceFlags;

    // Provided method
    fn new_from_template(
        template: FontTemplateRef,
        pt_size: Option<Au>,
    ) -> Result<PlatformFont, &'static str> { ... }
}

Required Methods§

source

fn new_from_data( font_identifier: FontIdentifier, data: Arc<Vec<u8>>, face_index: u32, pt_size: Option<Au>, ) -> Result<PlatformFont, &'static str>

source

fn descriptor(&self) -> FontTemplateDescriptor

Get a FontTemplateDescriptor from a PlatformFont. This is used to get descriptors for web fonts.

source

fn glyph_index(&self, codepoint: char) -> Option<GlyphId>

source

fn glyph_h_advance(&self, _: GlyphId) -> Option<FractionalPixel>

source

fn glyph_h_kerning(&self, glyph0: GlyphId, glyph1: GlyphId) -> FractionalPixel

source

fn can_do_fast_shaping(&self) -> bool

Can this font do basic horizontal LTR shaping without Harfbuzz?

source

fn metrics(&self) -> FontMetrics

source

fn table_for_tag(&self, _: FontTableTag) -> Option<FontTable>

source

fn typographic_bounds(&self, _: GlyphId) -> Rect<f32>

source

fn webrender_font_instance_flags(&self) -> FontInstanceFlags

Get the necessary FontInstanceFlags` for this font.

Provided Methods§

source

fn new_from_template( template: FontTemplateRef, pt_size: Option<Au>, ) -> Result<PlatformFont, &'static str>

Object Safety§

This trait is not object safe.

Implementors§