cosmic_text

Struct FontSystem

source
pub struct FontSystem { /* private fields */ }
Expand description

Access to the system fonts.

Implementations§

source§

impl FontSystem

source

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.

source

pub fn new_with_fonts(fonts: impl IntoIterator<Item = Source>) -> Self

Create a new FontSystem with a pre-specified set of fonts.

source

pub fn new_with_locale_and_db(locale: String, db: Database) -> Self

Create a new FontSystem with a pre-specified locale and font database.

source

pub fn locale(&self) -> &str

Get the locale.

source

pub fn db(&self) -> &Database

Get the database.

source

pub fn db_mut(&mut self) -> &mut Database

Get a mutable reference to the database.

source

pub fn into_locale_and_db(self) -> (String, Database)

Consume this FontSystem and return the locale and database.

source

pub fn cache_fonts(&mut self, ids: Vec<ID>)

Concurrently cache fonts by id list

source

pub fn get_font(&mut self, id: ID) -> Option<Arc<Font>>

Get a font by its ID.

source

pub fn is_monospace(&self, id: ID) -> bool

source

pub fn get_monospace_ids_for_scripts( &self, scripts: impl Iterator<Item = [u8; 4]>, ) -> Vec<ID>

source

pub fn get_font_supported_codepoints_in_word( &mut self, id: ID, word: &str, ) -> Option<usize>

source

pub fn get_font_matches(&mut self, attrs: Attrs<'_>) -> Arc<Vec<FontMatchKey>>

Trait Implementations§

source§

impl Debug for FontSystem

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
source§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.