Struct fonts::font_template::FontTemplate
source · pub struct FontTemplate {
pub identifier: FontIdentifier,
pub descriptor: FontTemplateDescriptor,
pub data: Option<Arc<Vec<u8>>>,
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
§data: Option<Arc<Vec<u8>>>
The data to use for this FontTemplate
. For web fonts, this is always filled, but
for local fonts, this is loaded only lazily in layout.
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.
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_for_local_font(
identifier: LocalFontIdentifier,
descriptor: FontTemplateDescriptor,
) -> FontTemplate
pub fn new_for_local_font( identifier: LocalFontIdentifier, descriptor: FontTemplateDescriptor, ) -> FontTemplate
Create a new FontTemplate
for a system font installed locally.
sourcepub fn new_for_remote_web_font(
url: ServoUrl,
data: Arc<Vec<u8>>,
css_font_template_descriptors: &CSSFontFaceDescriptors,
stylesheet: Option<DocumentStyleSheet>,
) -> Result<FontTemplate, &'static str>
pub fn new_for_remote_web_font( url: ServoUrl, data: Arc<Vec<u8>>, css_font_template_descriptors: &CSSFontFaceDescriptors, stylesheet: Option<DocumentStyleSheet>, ) -> Result<FontTemplate, &'static str>
Create a new FontTemplate
for a @font-family
with a url(...)
src
font.
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 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> 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