pub struct ColorGlyphs<'a> {
font: &'a Font,
tables: Option<&'a ColrTables<'a>>,
}Expand description
Provides access to the color glyphs in a font.
Glyphs are painted at the location of the font. This type is cheap to create and copy because it borrows tables that the font has already parsed.
Fields§
§font: &'a Font§tables: Option<&'a ColrTables<'a>>Implementations§
Source§impl<'a> ColorGlyphs<'a>
impl<'a> ColorGlyphs<'a>
pub(crate) fn new(font: &'a Font) -> Self
Sourcepub fn version(&self) -> Option<u16>
pub fn version(&self) -> Option<u16>
Returns the version of the COLR table, or None if the font has no
COLR table.
Sourcepub fn get_with_version(
&self,
glyph: GlyphId,
version: ColorGlyphVersion,
) -> Option<ColorGlyph<'a>>
pub fn get_with_version( &self, glyph: GlyphId, version: ColorGlyphVersion, ) -> Option<ColorGlyph<'a>>
Returns the color glyph for glyph painted with the given version
of COLR, if the table has one.
Sourcepub fn get(&self, glyph: GlyphId) -> Option<ColorGlyph<'a>>
pub fn get(&self, glyph: GlyphId) -> Option<ColorGlyph<'a>>
Returns the color glyph for glyph.
Uses version 1 of the table if it has the glyph, and version 0 otherwise.
Sourcepub(crate) fn extents(
&self,
glyph: GlyphId,
outlines: OutlineGlyphs<'a>,
) -> Option<GlyphExtents<f32>>
pub(crate) fn extents( &self, glyph: GlyphId, outlines: OutlineGlyphs<'a>, ) -> Option<GlyphExtents<f32>>
Returns the ink bounds of glyph in font units, measured as HarfBuzz
measures a color glyph.
Uses the clip box of a version 1 glyph if it has one. Otherwise the
glyph is painted, from either version, and its fills are measured.
Returns None if the table has no color glyph for glyph or
painting it fails. A fill clipped to an outline measures the outline
in outlines.
fn instance(&self) -> Option<ColrInstance<'a>>
Trait Implementations§
Source§impl<'a> Clone for ColorGlyphs<'a>
impl<'a> Clone for ColorGlyphs<'a>
Source§fn clone(&self) -> ColorGlyphs<'a>
fn clone(&self) -> ColorGlyphs<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more