Trait fonts::font::PlatformFontMethods

source ·
pub trait PlatformFontMethods: Sized {
    // Required methods
    fn new_from_local_font_identifier(
        font_identifier: LocalFontIdentifier,
        pt_size: Option<Au>,
    ) -> Result<PlatformFont, &'static str>;
    fn new_from_data(
        font_identifier: FontIdentifier,
        data: &FontData,
        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 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>,
        data: &Option<FontData>,
    ) -> Result<PlatformFont, &'static str> { ... }
}

Required Methods§

source

fn new_from_local_font_identifier( font_identifier: LocalFontIdentifier, pt_size: Option<Au>, ) -> Result<PlatformFont, &'static str>

source

fn new_from_data( font_identifier: FontIdentifier, data: &FontData, 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 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>, data: &Option<FontData>, ) -> Result<PlatformFont, &'static str>

Object Safety§

This trait is not object safe.

Implementors§