Struct FontSystem
pub struct FontSystem { /* private fields */ }Expand description
Access to the system fonts.
Implementations§
§impl FontSystem
impl FontSystem
pub fn new() -> FontSystem
pub fn new() -> FontSystem
Create a new FontSystem, that allows access to any installed system fonts
§Timing
This function takes some time to run. On the release build, it can take up to a second,
while debug builds can take up to ten times longer. For this reason, it should only be
called once, and the resulting FontSystem should be shared.
pub fn new_with_fonts(fonts: impl IntoIterator<Item = Source>) -> FontSystem
pub fn new_with_fonts(fonts: impl IntoIterator<Item = Source>) -> FontSystem
Create a new FontSystem with a pre-specified set of fonts.
pub fn new_with_locale_and_db_and_fallback(
locale: String,
db: Database,
impl_fallback: impl Fallback + 'static,
) -> FontSystem
pub fn new_with_locale_and_db_and_fallback( locale: String, db: Database, impl_fallback: impl Fallback + 'static, ) -> FontSystem
Create a new FontSystem with a pre-specified locale, font database and font fallback list.
pub fn new_with_locale_and_db(locale: String, db: Database) -> FontSystem
pub fn new_with_locale_and_db(locale: String, db: Database) -> FontSystem
Create a new FontSystem with a pre-specified locale and font database.
pub fn into_locale_and_db(self) -> (String, Database)
pub fn into_locale_and_db(self) -> (String, Database)
Consume this FontSystem and return the locale and database.
pub fn get_font(&mut self, id: ID, weight: Weight) -> Option<Arc<Font>>
pub fn get_font(&mut self, id: ID, weight: Weight) -> Option<Arc<Font>>
Get a font by its ID and weight.
pub fn get_font_stretched(
&mut self,
id: ID,
weight: Weight,
stretch: Width,
) -> Option<Arc<Font>>
pub fn get_font_stretched( &mut self, id: ID, weight: Weight, stretch: Width, ) -> Option<Arc<Font>>
Get a font by its ID, weight and width (Font::new_stretched).
pub fn is_monospace(&self, id: ID) -> bool
pub fn get_monospace_ids_for_scripts( &self, scripts: impl Iterator<Item = [u8; 4]>, ) -> Vec<ID>
pub fn get_font_supported_codepoints_in_word( &mut self, id: ID, weight: Weight, word: &str, ) -> Option<usize>
pub fn get_font_matches(&mut self, attrs: &Attrs<'_>) -> Arc<Vec<FontMatchKey>> ⓘ
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for FontSystem
impl !RefUnwindSafe for FontSystem
impl Send for FontSystem
impl Sync for FontSystem
impl Unpin for FontSystem
impl UnsafeUnpin for FontSystem
impl !UnwindSafe for FontSystem
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
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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