pub struct FontContext { /* private fields */ }Expand description
The FontContext represents the per-thread/thread state necessary for working with fonts. It is the public API used by the layout and paint code. It talks directly to the system font service where required.
Implementations§
Source§impl FontContext
impl FontContext
pub fn new( system_font_service_proxy: Arc<SystemFontServiceProxy>, paint_api: CrossProcessPaintApi, resource_threads: ResourceThreads, ) -> Self
pub fn web_fonts_still_loading(&self) -> usize
Sourcepub fn font_group(&self, style: ServoArc<FontStyleStruct>) -> Arc<FontGroup>
pub fn font_group(&self, style: ServoArc<FontStyleStruct>) -> Arc<FontGroup>
Returns a FontGroup representing fonts which can be used for layout, given the style.
Font groups are cached, so subsequent calls with the same style will return a reference
to an existing FontGroup.
Sourcepub fn font_group_with_size(
&self,
style: ServoArc<FontStyleStruct>,
size: Au,
) -> Arc<FontGroup>
pub fn font_group_with_size( &self, style: ServoArc<FontStyleStruct>, size: Au, ) -> Arc<FontGroup>
Like Self::font_group, but overriding the size found in the FontStyleStruct with the given size
in pixels.
Sourcepub fn font(
&self,
font_template: FontTemplateRef,
font_descriptor: &FontDescriptor,
) -> Option<FontRef>
pub fn font( &self, font_template: FontTemplateRef, font_descriptor: &FontDescriptor, ) -> Option<FontRef>
Returns a font matching the parameters. Fonts are cached, so repeated calls will return a
reference to the same underlying Font.
Sourcepub fn matching_templates(
&self,
descriptor_to_match: &FontDescriptor,
family_descriptor: &FontFamilyDescriptor,
) -> Vec<FontTemplateRef>
pub fn matching_templates( &self, descriptor_to_match: &FontDescriptor, family_descriptor: &FontFamilyDescriptor, ) -> Vec<FontTemplateRef>
Try to find matching templates in this FontContext, first looking in the list of web fonts and
falling back to asking the super::SystemFontService for a matching system font.
pub fn is_supported_web_font_source(source: &&Source) -> bool
Source§impl FontContext
impl FontContext
pub fn construct_web_font_from_data( &self, data: &[u8], descriptors: CSSFontFaceDescriptors, ) -> Option<(LowercaseFontFamilyName, FontTemplate)>
Trait Implementations§
Source§impl MallocSizeOf for FontContext
impl MallocSizeOf for FontContext
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Auto Trait Implementations§
impl !Freeze for FontContext
impl !RefUnwindSafe for FontContext
impl Send for FontContext
impl Sync for FontContext
impl Unpin for FontContext
impl UnsafeUnpin for FontContext
impl !UnwindSafe for FontContext
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