[][src]Struct ab_glyph::FontArc

pub struct FontArc(_);

Font implementor that wraps another concrete Font + 'static type storing in an Arc.

Provides convenient type erasure & cheap clones (particularly for FontVec).

Example

use ab_glyph::{Font, FontArc};

let font = FontArc::try_from_slice(include_bytes!("../../dev/fonts/Exo2-Light.otf"))?;

assert_eq!(font.glyph_id('s'), ab_glyph::GlyphId(56));

Implementations

impl FontArc[src]

pub fn new<F: Font + Send + Sync + 'static>(font: F) -> Self[src]

Example

let font_arc = FontArc::new(font_vec);

pub fn try_from_vec(data: Vec<u8>) -> Result<Self, InvalidFont>[src]

Creates an FontArc from owned data.

Example

let font = FontArc::try_from_vec(owned_font_data)?;

pub fn try_from_slice(data: &'static [u8]) -> Result<Self, InvalidFont>[src]

Creates an FontArc from a byte-slice.

Example

let font = FontArc::try_from_slice(include_bytes!("../../dev/fonts/Exo2-Light.otf"))?;

Trait Implementations

impl Clone for FontArc[src]

impl Debug for FontArc[src]

impl Font for FontArc[src]

impl From<Arc<dyn Font + 'static + Send + Sync>> for FontArc[src]

impl From<FontRef<'static>> for FontArc[src]

impl From<FontVec> for FontArc[src]

Auto Trait Implementations

impl !RefUnwindSafe for FontArc

impl Send for FontArc

impl Sync for FontArc

impl Unpin for FontArc

impl !UnwindSafe for FontArc

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.