pub struct FontSystem { /* private fields */ }
Expand description
Access to the system fonts.
Implementations§
source§impl FontSystem
impl FontSystem
sourcepub fn new() -> Self
pub fn new() -> Self
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.
sourcepub fn new_with_fonts(fonts: impl IntoIterator<Item = Source>) -> Self
pub fn new_with_fonts(fonts: impl IntoIterator<Item = Source>) -> Self
Create a new FontSystem
with a pre-specified set of fonts.
sourcepub fn new_with_locale_and_db(locale: String, db: Database) -> Self
pub fn new_with_locale_and_db(locale: String, db: Database) -> Self
Create a new FontSystem
with a pre-specified locale and font database.
sourcepub 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.
sourcepub fn cache_fonts(&mut self, ids: Vec<ID>)
pub fn cache_fonts(&mut self, ids: Vec<ID>)
Concurrently cache fonts by id list
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, 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 !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
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