pub trait PlatformFontMethods: Sized {
Show 14 methods
// Required methods
fn new_from_local_font_identifier(
font_identifier: LocalFontIdentifier,
pt_size: Option<Au>,
synthetic_bold: bool,
) -> Result<PlatformFont, &'static str>;
fn new_from_data(
font_identifier: FontIdentifier,
data: &FontData,
pt_size: Option<Au>,
synthetic_bold: bool,
) -> Result<PlatformFont, &'static str>;
fn copy_with_variations(
self,
_font_identifer: &FontIdentifier,
_variations: &[FontVariation],
) -> Result<Self, &'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>,
data: &Option<FontData>,
synthetic_bold: bool,
) -> 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>, synthetic_bold: bool, ) -> Result<PlatformFont, &'static str>
fn new_from_data( font_identifier: FontIdentifier, data: &FontData, pt_size: Option<Au>, synthetic_bold: bool, ) -> Result<PlatformFont, &'static str>
Sourcefn copy_with_variations(
self,
_font_identifer: &FontIdentifier,
_variations: &[FontVariation],
) -> Result<Self, &'static str>
fn copy_with_variations( self, _font_identifer: &FontIdentifier, _variations: &[FontVariation], ) -> Result<Self, &'static str>
Create a platform font with the given variations from a existing font.
self is consumed to work around platform differences. On some platforms, changing the
variations requires creating an entirely new font face, whereas on others the returned
font is self.
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>, data: &Option<FontData>, synthetic_bold: bool, ) -> 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.