pub struct ColorGlyph<'a> { /* private fields */ }Expand description
A representation of a color glyph that can be painted through a sequence of ColorPainter callbacks.
Implementations§
Source§impl<'a> ColorGlyph<'a>
impl<'a> ColorGlyph<'a>
Sourcepub fn format(&self) -> ColorGlyphFormat
pub fn format(&self) -> ColorGlyphFormat
Returns the version of the color table from which this outline was selected.
Sourcepub fn bounding_box(
&self,
location: impl Into<LocationRef<'a>>,
size: Size,
) -> Option<BoundingBox<f32>>
pub fn bounding_box( &self, location: impl Into<LocationRef<'a>>, size: Size, ) -> Option<BoundingBox<f32>>
Returns the bounding box.
For COLRv1 glyphs, this is the clip box of the specified COLRv1 glyph,
or None if clip boxes are not present or if there is none for the
particular glyph.
Always returns None for COLRv0 glyphs because precomputed clip boxes
are never available.
The size argument can optionally be used to scale the bounding box
to a particular font size and location allows specifying a variation
instance.
Sourcepub fn paint(
&self,
location: impl Into<LocationRef<'a>>,
painter: &mut impl ColorPainter,
) -> Result<(), PaintError>
pub fn paint( &self, location: impl Into<LocationRef<'a>>, painter: &mut impl ColorPainter, ) -> Result<(), PaintError>
Evaluates the paint graph at the specified location in variation space and emits the results to the given painter.
For a COLRv1 glyph, traverses the COLRv1 paint graph and invokes drawing callbacks on a
specified ColorPainter trait object. The traversal operates in font
units and will call ColorPainter methods with font unit values. This
means, if you want to draw a COLRv1 glyph at a particular font size, the
canvas needs to have a transformation matrix applied so that it scales down
the drawing operations to font_size / upem.
§Arguments
glyph_idtheGlyphIdto be drawn.locationcoordinates for specifying a variation instance. This can be empty.paintera client-providedColorPainterimplementation receiving drawing callbacks.
Trait Implementations§
Source§impl<'a> Clone for ColorGlyph<'a>
impl<'a> Clone for ColorGlyph<'a>
Source§fn clone(&self) -> ColorGlyph<'a>
fn clone(&self) -> ColorGlyph<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more