Struct ab_glyph::FontArc [−][src]
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
impl FontArc
[src]
impl FontArc
[src]pub fn new<F: Font + Send + Sync + 'static>(font: F) -> Self
[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_vec(data: Vec<u8>) -> Result<Self, InvalidFont>
[src]pub fn try_from_slice(data: &'static [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 Font for FontArc
[src]
impl Font for FontArc
[src]fn units_per_em(&self) -> Option<f32>
[src]
fn units_per_em(&self) -> Option<f32>
[src]Get the size of the font unit Read more
fn ascent_unscaled(&self) -> f32
[src]
fn ascent_unscaled(&self) -> f32
[src]Unscaled glyph ascent. Read more
fn descent_unscaled(&self) -> f32
[src]
fn descent_unscaled(&self) -> f32
[src]Unscaled glyph descent. Read more
fn line_gap_unscaled(&self) -> f32
[src]
fn line_gap_unscaled(&self) -> f32
[src]Unscaled line gap. Read more
fn h_advance_unscaled(&self, id: GlyphId) -> f32
[src]
fn h_advance_unscaled(&self, id: GlyphId) -> f32
[src]Unscaled horizontal advance for a given glyph id. Read more
fn h_side_bearing_unscaled(&self, id: GlyphId) -> f32
[src]
fn h_side_bearing_unscaled(&self, id: GlyphId) -> f32
[src]Unscaled horizontal side bearing for a given glyph id. Read more
fn v_advance_unscaled(&self, id: GlyphId) -> f32
[src]
fn v_advance_unscaled(&self, id: GlyphId) -> f32
[src]Unscaled vertical advance for a given glyph id. Read more
fn v_side_bearing_unscaled(&self, id: GlyphId) -> f32
[src]
fn v_side_bearing_unscaled(&self, id: GlyphId) -> f32
[src]Unscaled vertical side bearing for a given glyph id. Read more
fn kern_unscaled(&self, first: GlyphId, second: GlyphId) -> f32
[src]
fn kern_unscaled(&self, first: GlyphId, second: GlyphId) -> f32
[src]Returns additional unscaled kerning to apply for a particular pair of glyph ids. Read more
fn outline(&self, glyph: GlyphId) -> Option<Outline>
[src]
fn outline(&self, glyph: GlyphId) -> Option<Outline>
[src]Compute unscaled glyph outline curves & bounding box.
fn glyph_count(&self) -> usize
[src]
fn glyph_count(&self) -> usize
[src]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
fn codepoint_ids(&self) -> CodepointIdIter<'_>ⓘNotable traits for CodepointIdIter<'a>
impl<'a> Iterator for CodepointIdIter<'a> type Item = (GlyphId, char);
[src]
fn codepoint_ids(&self) -> CodepointIdIter<'_>ⓘNotable traits for CodepointIdIter<'a>
impl<'a> Iterator for CodepointIdIter<'a> type Item = (GlyphId, char);
[src]Returns an iterator of all distinct (GlyphId, char)
pairs. Not ordered. Read more
fn glyph_raster_image(&self, id: GlyphId, size: u16) -> Option<GlyphImage<'_>>
[src]
fn glyph_raster_image(&self, id: GlyphId, size: u16) -> Option<GlyphImage<'_>>
[src]Returns a pre-rendered image of the glyph. Read more
fn height_unscaled(&self) -> f32
[src]
fn height_unscaled(&self) -> f32
[src]Unscaled height ascent - descent
. Read more
fn glyph_bounds(&self, glyph: &Glyph) -> Rect where
Self: Sized,
[src]
fn glyph_bounds(&self, glyph: &Glyph) -> Rect where
Self: Sized,
[src]Returns the layout bounds of this glyph. These are different to the outline px_bounds()
. Read more
fn outline_glyph(&self, glyph: Glyph) -> Option<OutlinedGlyph> where
Self: Sized,
[src]
fn outline_glyph(&self, glyph: Glyph) -> Option<OutlinedGlyph> where
Self: Sized,
[src]Compute glyph outline ready for drawing.
fn as_scaled<S: Into<PxScale>>(&self, scale: S) -> PxScaleFont<&Self> where
Self: Sized,
[src]
fn as_scaled<S: Into<PxScale>>(&self, scale: S) -> PxScaleFont<&Self> where
Self: Sized,
[src]Construct a PxScaleFontRef
by associating with the
given pixel scale
. Read more
fn into_scaled<S: Into<PxScale>>(self, scale: S) -> PxScaleFont<Self> where
Self: Sized,
[src]
fn into_scaled<S: Into<PxScale>>(self, scale: S) -> PxScaleFont<Self> where
Self: Sized,
[src]Move into a PxScaleFont
associated with the
given pixel scale
. Read more
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> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more