Expand description
Color glyphs.
A COLR glyph is painted through a sequence of PaintSink callbacks
for transforms, clips, fills and layers. Version 0 glyphs are layers of
solid-filled outlines. Version 1 adds gradients, transforms and
compositing. ColorGlyph::paint paints both versions in font units at
the font’s location.
§Examples
Paint a glyph:
let glyph = font.color_glyphs().get(glyph).expect("a color glyph");
glyph.paint(sink)Measure a glyph. This uses the clip box if the glyph has one, and the bounds of what it paints otherwise:
if let Some(glyph) = font.color_glyphs().get(glyph) {
let extents = glyph.extents().expect("a well formed paint graph");
println!("{extents:?}");
}Structs§
- Color
- CPAL (Color Record) record
- Color
Glyph - A color glyph, ready to paint through a
PaintSink. - Color
Glyphs - Provides access to the color glyphs in a font.
- Color
Stop - A color stop of a gradient.
- Palette
- A single color palette.
- Palette
Type - The PaletteType flags.
- Palettes
- Provides access to the color palettes in a font.
Enums§
- Brush
- A solid color or gradient used to fill a region.
- Color
Glyph Version - The version of
COLRthat defines a glyph. - Composite
Mode - CompositeMode enumeration
- Extend
- Extend enumeration
- Paint
Cached Color Glyph - Whether a sink painted a nested color glyph from its own cache.
Traits§
- Paint
Sink - Receives the operations that paint a color glyph.