[−]Struct gfx_glyph::ab_glyph::FontVec
Font data handle stored in a Vec<u8>
+ parsed data.
See Font
for more methods.
Also see FontRef
.
Example
use ab_glyph::{Font, FontVec}; let font = FontVec::try_from_vec_and_index(owned_font_data, 0)?; assert_eq!(font.glyph_id('s'), ab_glyph::GlyphId(56));
Implementations
impl FontVec
pub fn try_from_vec(data: Vec<u8>) -> Result<FontVec, InvalidFont>
Creates an FontVec
from owned data.
For font collections see
FontVec::try_from_vec_and_index
.
Example
let font = FontVec::try_from_vec(owned_font_data)?;
pub fn try_from_vec_and_index(
data: Vec<u8>,
index: u32
) -> Result<FontVec, InvalidFont>
data: Vec<u8>,
index: u32
) -> Result<FontVec, InvalidFont>
Creates an FontVec
from owned data.
You can set index for font collections. For simple fonts use 0
or
FontVec::try_from_vec
.
Example
let font = FontVec::try_from_vec_and_index(owned_font_data, 0)?;
Trait Implementations
impl Debug for FontVec
impl Font for FontVec
fn ascent_unscaled(&self) -> f32
fn descent_unscaled(&self) -> f32
fn line_gap_unscaled(&self) -> f32
fn glyph_id(&self, c: char) -> GlyphId
fn h_advance_unscaled(&self, id: GlyphId) -> f32
fn h_side_bearing_unscaled(&self, id: GlyphId) -> f32
fn kern_unscaled(&self, first: GlyphId, second: GlyphId) -> f32
fn outline(&self, id: GlyphId) -> Option<Outline>
fn glyph_count(&self) -> usize
fn height_unscaled(&self) -> f32
fn outline_glyph(&self, glyph: Glyph) -> Option<OutlinedGlyph>
fn as_scaled<S>(&self, scale: S) -> PxScaleFont<&Self> where
S: Into<PxScale>,
S: Into<PxScale>,
fn into_scaled<S>(self, scale: S) -> PxScaleFont<Self> where
S: Into<PxScale>,
S: Into<PxScale>,
impl From<FontVec> for FontArc
Auto Trait Implementations
impl RefUnwindSafe for FontVec
impl Send for FontVec
impl Sync for FontVec
impl Unpin for FontVec
impl UnwindSafe for FontVec
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,
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, 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.
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.
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>,