Struct glow_glyph::ab_glyph::FontRef [−]
pub struct FontRef<'font>(_);
Expand description
Implementations
impl<'font> FontRef<'font>
impl<'font> FontRef<'font>
pub fn try_from_slice(data: &'font [u8]) -> Result<FontRef<'font>, InvalidFont>
pub fn try_from_slice(data: &'font [u8]) -> Result<FontRef<'font>, InvalidFont>
Creates an FontRef
from a byte-slice.
For font collections see
FontRef::try_from_slice_and_index
.
Example
let font = FontRef::try_from_slice(include_bytes!("../../dev/fonts/Exo2-Light.otf"))?;
pub fn try_from_slice_and_index(
data: &'font [u8],
index: u32
) -> Result<FontRef<'font>, InvalidFont>
pub fn try_from_slice_and_index(
data: &'font [u8],
index: u32
) -> Result<FontRef<'font>, InvalidFont>
Creates an FontRef
from byte-slice.
You can set index for font collections. For simple fonts use 0
or
FontRef::try_from_slice
.
Example
let font =
FontRef::try_from_slice_and_index(include_bytes!("../../dev/fonts/Exo2-Light.otf"), 0)?;
Trait Implementations
pub fn units_per_em(&self) -> Option<f32>
pub fn units_per_em(&self) -> Option<f32>
Get the size of the font unit Read more
pub fn ascent_unscaled(&self) -> f32
pub fn ascent_unscaled(&self) -> f32
Unscaled glyph ascent. Read more
pub fn descent_unscaled(&self) -> f32
pub fn descent_unscaled(&self) -> f32
Unscaled glyph descent. Read more
pub fn line_gap_unscaled(&self) -> f32
pub fn line_gap_unscaled(&self) -> f32
Unscaled line gap. Read more
pub fn h_advance_unscaled(&self, id: GlyphId) -> f32
pub fn h_advance_unscaled(&self, id: GlyphId) -> f32
Unscaled horizontal advance for a given glyph id. Read more
pub fn h_side_bearing_unscaled(&self, id: GlyphId) -> f32
pub fn h_side_bearing_unscaled(&self, id: GlyphId) -> f32
Unscaled horizontal side bearing for a given glyph id. Read more
pub fn v_advance_unscaled(&self, id: GlyphId) -> f32
pub fn v_advance_unscaled(&self, id: GlyphId) -> f32
Unscaled vertical advance for a given glyph id. Read more
pub fn v_side_bearing_unscaled(&self, id: GlyphId) -> f32
pub fn v_side_bearing_unscaled(&self, id: GlyphId) -> f32
Unscaled vertical side bearing for a given glyph id. Read more
pub fn kern_unscaled(&self, first: GlyphId, second: GlyphId) -> f32
pub fn kern_unscaled(&self, first: GlyphId, second: GlyphId) -> f32
Returns additional unscaled kerning to apply for a particular pair of glyph ids. Read more
Compute unscaled glyph outline curves & bounding box.
pub fn glyph_count(&self) -> usize
pub fn glyph_count(&self) -> usize
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
pub fn codepoint_ids(&'a self) -> CodepointIdIter<'a>ⓘNotable traits for CodepointIdIter<'a>impl<'a> Iterator for CodepointIdIter<'a> type Item = (GlyphId, char);
pub fn codepoint_ids(&'a self) -> CodepointIdIter<'a>ⓘNotable traits for CodepointIdIter<'a>impl<'a> Iterator for CodepointIdIter<'a> type Item = (GlyphId, char);
impl<'a> Iterator for CodepointIdIter<'a> type Item = (GlyphId, char);
Returns an iterator of all distinct (GlyphId, char)
pairs. Not ordered. Read more
pub fn glyph_raster_image(
&self,
id: GlyphId,
size: u16
) -> Option<GlyphImage<'_>>
pub fn glyph_raster_image(
&self,
id: GlyphId,
size: u16
) -> Option<GlyphImage<'_>>
Returns a pre-rendered image of the glyph. Read more
fn height_unscaled(&self) -> f32
fn height_unscaled(&self) -> f32
Unscaled height ascent - descent
. Read more
fn glyph_bounds(&self, glyph: &Glyph) -> Rect
fn glyph_bounds(&self, glyph: &Glyph) -> Rect
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>
fn outline_glyph(&self, glyph: Glyph) -> Option<OutlinedGlyph>
Compute glyph outline ready for drawing.
fn as_scaled<S>(&self, scale: S) -> PxScaleFont<&Self> where
S: Into<PxScale>,
fn as_scaled<S>(&self, scale: S) -> PxScaleFont<&Self> where
S: Into<PxScale>,
Construct a PxScaleFontRef
by associating with the
given pixel scale
. Read more
fn into_scaled<S>(self, scale: S) -> PxScaleFont<Self> where
S: Into<PxScale>,
fn into_scaled<S>(self, scale: S) -> PxScaleFont<Self> where
S: Into<PxScale>,
Move into a PxScaleFont
associated with the
given pixel scale
. Read more
Auto Trait Implementations
impl<'font> RefUnwindSafe for FontRef<'font>
impl<'font> UnwindSafe for FontRef<'font>
Blanket Implementations
Mutably borrows from an owned value. Read more