pub trait PlatformFontMethods: Sized {
Show 13 methods
// Required methods
fn new_from_local_font_identifier(
font_identifier: LocalFontIdentifier,
pt_size: Option<Au>,
variations: &[FontVariation],
) -> Result<PlatformFont, &'static str>;
fn new_from_data(
font_identifier: FontIdentifier,
data: &FontData,
pt_size: Option<Au>,
variations: &[FontVariation],
) -> Result<PlatformFont, &'static str>;
fn descriptor(&self) -> FontTemplateDescriptor;
fn glyph_index(&self, codepoint: char) -> Option<u32>;
fn glyph_h_advance(&self, _: u32) -> Option<f64>;
fn glyph_h_kerning(&self, glyph0: u32, glyph1: u32) -> f64;
fn metrics(&self) -> FontMetrics;
fn table_for_tag(&self, _: Tag) -> Option<FontTable>;
fn typographic_bounds(&self, _: u32) -> Rect<f32>;
fn webrender_font_instance_flags(&self) -> FontInstanceFlags;
fn variations(&self) -> &[FontVariation];
// Provided methods
fn new_from_template(
template: FontTemplateRef,
pt_size: Option<Au>,
variations: &[FontVariation],
data: &Option<FontData>,
) -> Result<PlatformFont, &'static str> { ... }
fn descriptor_from_os2_table(os2: &Os2<'_>) -> FontTemplateDescriptor { ... }
}
Required Methods§
fn new_from_local_font_identifier( font_identifier: LocalFontIdentifier, pt_size: Option<Au>, variations: &[FontVariation], ) -> Result<PlatformFont, &'static str>
fn new_from_data( font_identifier: FontIdentifier, data: &FontData, pt_size: Option<Au>, variations: &[FontVariation], ) -> 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<u32>
fn glyph_h_advance(&self, _: u32) -> Option<f64>
fn glyph_h_kerning(&self, glyph0: u32, glyph1: u32) -> f64
fn metrics(&self) -> FontMetrics
fn table_for_tag(&self, _: Tag) -> Option<FontTable>
fn typographic_bounds(&self, _: u32) -> Rect<f32>
Sourcefn webrender_font_instance_flags(&self) -> FontInstanceFlags
fn webrender_font_instance_flags(&self) -> FontInstanceFlags
Get the necessary FontInstanceFlags
` for this font.
Sourcefn variations(&self) -> &[FontVariation]
fn variations(&self) -> &[FontVariation]
Return all the variation values that the font was instantiated with.
Provided Methods§
fn new_from_template( template: FontTemplateRef, pt_size: Option<Au>, variations: &[FontVariation], data: &Option<FontData>, ) -> Result<PlatformFont, &'static str>
fn descriptor_from_os2_table(os2: &Os2<'_>) -> FontTemplateDescriptor
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.