Struct ab_glyph::FontArc [−][src]
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]
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]
fn units_per_em(&self) -> Option<f32>
[src]
fn ascent_unscaled(&self) -> f32
[src]
fn descent_unscaled(&self) -> f32
[src]
fn line_gap_unscaled(&self) -> f32
[src]
fn glyph_id(&self, c: char) -> GlyphId
[src]
fn h_advance_unscaled(&self, id: GlyphId) -> f32
[src]
fn h_side_bearing_unscaled(&self, id: GlyphId) -> f32
[src]
fn v_advance_unscaled(&self, id: GlyphId) -> f32
[src]
fn v_side_bearing_unscaled(&self, id: GlyphId) -> f32
[src]
fn kern_unscaled(&self, first: GlyphId, second: GlyphId) -> f32
[src]
fn outline(&self, glyph: GlyphId) -> Option<Outline>
[src]
fn glyph_count(&self) -> usize
[src]
fn codepoint_ids(&self) -> CodepointIdIter<'_>ⓘNotable traits for CodepointIdIter<'a>
impl<'a> Iterator for CodepointIdIter<'a> type Item = (GlyphId, char);
[src]
Notable traits for CodepointIdIter<'a>
impl<'a> Iterator for CodepointIdIter<'a> type Item = (GlyphId, char);
fn height_unscaled(&self) -> f32
[src]
fn glyph_bounds(&self, glyph: &Glyph) -> Rect where
Self: Sized,
[src]
Self: Sized,
fn outline_glyph(&self, glyph: Glyph) -> Option<OutlinedGlyph> where
Self: Sized,
[src]
Self: Sized,
fn as_scaled<S: Into<PxScale>>(&self, scale: S) -> PxScaleFont<&Self> where
Self: Sized,
[src]
Self: Sized,
fn into_scaled<S: Into<PxScale>>(self, scale: S) -> PxScaleFont<Self> where
Self: Sized,
[src]
Self: Sized,
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
[src]
impl Send for FontArc
[src]
impl Sync for FontArc
[src]
impl Unpin for FontArc
[src]
impl !UnwindSafe for FontArc
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,