Struct fonts::FontTemplate
source · pub struct FontTemplate {
pub identifier: FontIdentifier,
pub descriptor: FontTemplateDescriptor,
pub stylesheet: Option<DocumentStyleSheet>,
}
Expand description
This describes all the information needed to create font instance handles. It contains a unique FontTemplateData structure that is platform specific.
Fields§
§identifier: FontIdentifier
§descriptor: FontTemplateDescriptor
§stylesheet: Option<DocumentStyleSheet>
If this font is a web font, this is a reference to the stylesheet that created it. This will be used to remove this font from caches, when the stylesheet is removed.
This is not serialized, as it’s only useful in the super::FontContext
that it is created in.
Implementations§
source§impl FontTemplate
impl FontTemplate
Holds all of the template information for a font that is common, regardless of the number of instances of this font handle per thread.
sourcepub fn new(
identifier: FontIdentifier,
descriptor: FontTemplateDescriptor,
stylesheet: Option<DocumentStyleSheet>,
) -> FontTemplate
pub fn new( identifier: FontIdentifier, descriptor: FontTemplateDescriptor, stylesheet: Option<DocumentStyleSheet>, ) -> FontTemplate
Create a new FontTemplate
.
sourcepub fn new_for_local_web_font(
local_template: FontTemplateRef,
css_font_template_descriptors: &CSSFontFaceDescriptors,
stylesheet: DocumentStyleSheet,
) -> Result<FontTemplate, &'static str>
pub fn new_for_local_web_font( local_template: FontTemplateRef, css_font_template_descriptors: &CSSFontFaceDescriptors, stylesheet: DocumentStyleSheet, ) -> Result<FontTemplate, &'static str>
Create a new FontTemplate
for a @font-family
with a local(...)
src
. This takes in
the template of the local font and creates a new one that reflects the properties specified
by @font-family
in the stylesheet.
pub fn identifier(&self) -> &FontIdentifier
Trait Implementations§
source§impl Clone for FontTemplate
impl Clone for FontTemplate
source§fn clone(&self) -> FontTemplate
fn clone(&self) -> FontTemplate
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for FontTemplate
impl Debug for FontTemplate
source§impl<'de> Deserialize<'de> for FontTemplate
impl<'de> Deserialize<'de> for FontTemplate
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl MallocSizeOf for FontTemplate
impl MallocSizeOf for FontTemplate
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Auto Trait Implementations§
impl Freeze for FontTemplate
impl !RefUnwindSafe for FontTemplate
impl Send for FontTemplate
impl Sync for FontTemplate
impl Unpin for FontTemplate
impl !UnwindSafe for FontTemplate
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more