Struct solstice_2d::FontVec [−]
pub struct 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
impl FontVec
pub fn try_from_vec(data: Vec<u8, Global>) -> 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, Global>,
index: u32
) -> Result<FontVec, InvalidFont>
data: Vec<u8, Global>,
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 Font for FontVec
impl Font for FontVec
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, id: GlyphId) -> Option<Outline>
pub fn glyph_count(&self) -> usize
pub fn codepoint_ids(&'a self) -> CodepointIdIter<'a>
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>,
Auto Trait Implementations
impl RefUnwindSafe for FontVec
impl RefUnwindSafe for FontVec
impl UnwindSafe for FontVec
impl UnwindSafe for FontVec
Blanket Implementations
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn is_in_subset(&self) -> bool
pub fn to_subset_unchecked(&self) -> SS
pub fn from_subset(element: &SS) -> SP
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,