Struct agui_primitives::FontArc[]

pub struct FontArc(_);
Expand description

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

Example
let font_arc = FontArc::new(font_vec);

Creates an FontArc from owned data.

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

Creates an FontArc from a byte-slice.

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

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Get the size of the font unit Read more

Unscaled glyph ascent. Read more

Unscaled glyph descent. Read more

Unscaled line gap. Read more

Lookup a GlyphId matching a given char. Read more

Unscaled horizontal advance for a given glyph id. Read more

Unscaled horizontal side bearing for a given glyph id. Read more

Unscaled vertical advance for a given glyph id. Read more

Unscaled vertical side bearing for a given glyph id. Read more

Returns additional unscaled kerning to apply for a particular pair of glyph ids. Read more

Compute unscaled glyph outline curves & bounding box.

The number of glyphs present in this font. Glyph identifiers for this font will always be in the range 0..self.glyph_count() Read more

Returns an iterator of all distinct (GlyphId, char) pairs. Not ordered. Read more

Returns a pre-rendered image of the glyph. Read more

Unscaled height ascent - descent. Read more

Returns the layout bounds of this glyph. These are different to the outline px_bounds(). Read more

Compute glyph outline ready for drawing.

Construct a PxScaleFontRef by associating with the given pixel scale. Read more

Move into a PxScaleFont associated with the given pixel scale. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

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. Read more

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.