Skip to main content

FontManager

Struct FontManager 

Source
pub struct FontManager<Font> { /* private fields */ }
Expand description

Shared, thread-safe handle to a font storage implementation.

Implementations§

Source§

impl<Font> FontManager<Font>

Source

pub fn new<Holder: FontsHolder<Font> + 'static>(font_data: Holder) -> Self

Creates a new manager from a concrete font holder.

Source

pub fn leak(self) -> &'static Self

Leaks the manager and returns a 'static reference to it.

This is an advanced escape hatch for global callback-driven integrations. Most applications should prefer regular owned values.

Source

pub fn get_fonts(&self) -> FontsGuard<'_, Font>

Returns read-only access to the underlying holder.

§Panics

Panics if the internal RwLock is poisoned.

Source

pub fn push_font(&self, font: Font) -> usize

Inserts a font and returns its slot index.

§Panics

Panics if the internal RwLock is poisoned.

Source

pub fn delete_font(&self, index: usize)

Marks a font slot as free.

§Panics

Panics if the internal RwLock is poisoned.

Auto Trait Implementations§

§

impl<Font> !Send for FontManager<Font>

§

impl<Font> !Sync for FontManager<Font>

§

impl<Font> Freeze for FontManager<Font>

§

impl<Font> RefUnwindSafe for FontManager<Font>

§

impl<Font> Unpin for FontManager<Font>

§

impl<Font> UnsafeUnpin for FontManager<Font>

§

impl<Font> UnwindSafe for FontManager<Font>

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, 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.