Expand description
Drawing color glyphs.
§Examples
§Retrieve the clip box of a COLRv1 glyph if it has one:
match font.color_glyphs()
.get_with_format(glyph_id, ColorGlyphFormat::ColrV1)
.expect("Glyph not found.")
.bounding_box(&Location::default(), size)
{
Some(bounding_box) => {
println!("Bounding box is {:?}", bounding_box);
}
None => {
println!("Glyph has no clip box.");
}
}
§Paint a COLRv1 glyph given a font, and a glyph id and a ColorPainter
implementation:
let color_glyph = font.color_glyphs()
.get_with_format(glyph_id, ColorGlyphFormat::ColrV1)
.expect("Glyph not found");
color_glyph.paint(&Location::default(), color_painter_impl)
Modules§
- instance 🔒
- COLR table instance.
- transform 🔒
- Contains a
Transform
object holding values of an affine transformation matrix. - traversal 🔒
Structs§
- Color
Glyph - A representation of a color glyph that can be painted through a sequence of
ColorPainter
callbacks. - Color
Glyph Collection - Collection of color glyphs.
- Color
Stop - A color stop of a gradient.
- Transform
- A transformation matrix to be applied to the drawing canvas.
Enums§
- Brush
- A fill type of a COLRv1 glyph (solid fill or various gradient types).
- Color
Glyph Format - Distinguishes available color glyph formats.
- Color
Glyph 🔒Root - Composite
Mode - CompositeMode enumeration
- Extend
- Extend enumeration
- Paint
Cached Color Glyph - Signals success of request to draw a COLRv1 sub glyph from cache.
- Paint
Error - An error during drawing a COLR glyph.
Traits§
- Color
Painter - A group of required painting callbacks to be provided by the client.