Trait fonts::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§
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>
sourcefn descriptor(&self) -> FontTemplateDescriptor
fn descriptor(&self) -> FontTemplateDescriptor
Get a FontTemplateDescriptor
from a PlatformFont
. This is used to get
descriptors for web fonts.
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>
sourcefn webrender_font_instance_flags(&self) -> FontInstanceFlags
fn webrender_font_instance_flags(&self) -> FontInstanceFlags
Get the necessary FontInstanceFlags
` for this font.
Provided Methods§
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.