[−]Struct glyph_brush::ab_glyph::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
pub fn new<F>(font: F) -> FontArc where
F: 'static + Font + Send + Sync,
F: 'static + Font + Send + Sync,
Example
let font_arc = FontArc::new(font_vec);
pub fn try_from_vec(data: Vec<u8, Global>) -> Result<FontArc, InvalidFont>
pub fn try_from_slice(data: &'static [u8]) -> Result<FontArc, InvalidFont>
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
pub fn clone(&self) -> FontArc
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for FontArc
impl Font for FontArc
pub fn units_per_em(&self) -> Option<f32>
pub fn ascent_unscaled(&self) -> f32
pub fn descent_unscaled(&self) -> f32
pub fn line_gap_unscaled(&self) -> f32
pub fn glyph_id(&self, c: char) -> GlyphId
pub fn h_advance_unscaled(&self, id: GlyphId) -> f32
pub fn h_side_bearing_unscaled(&self, id: GlyphId) -> f32
pub fn v_advance_unscaled(&self, id: GlyphId) -> f32
pub fn v_side_bearing_unscaled(&self, id: GlyphId) -> f32
pub fn kern_unscaled(&self, first: GlyphId, second: GlyphId) -> f32
pub fn outline(&self, glyph: GlyphId) -> Option<Outline>
pub fn glyph_count(&self) -> usize
pub fn codepoint_ids(&self) -> CodepointIdIter<'_>ⓘNotable traits for CodepointIdIter<'a>
impl<'a> Iterator for CodepointIdIter<'a> type Item = (GlyphId, char);
Notable traits for CodepointIdIter<'a>
impl<'a> Iterator for CodepointIdIter<'a> type Item = (GlyphId, char);
pub fn height_unscaled(&self) -> f32
pub fn glyph_bounds(&self, glyph: &Glyph) -> Rect
pub fn outline_glyph(&self, glyph: Glyph) -> Option<OutlinedGlyph>
pub fn as_scaled<S>(&self, scale: S) -> PxScaleFont<&Self> where
S: Into<PxScale>,
S: Into<PxScale>,
pub fn into_scaled<S>(self, scale: S) -> PxScaleFont<Self> where
S: Into<PxScale>,
S: Into<PxScale>,
impl From<Arc<dyn Font + 'static + Send + Sync>> for FontArc
impl From<FontRef<'static>> for FontArc
impl From<FontVec> for FontArc
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]
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> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,