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:?}");
}ModulesΒ§
- bounds π
- Color glyph extents computed from what the glyph paints.
- decycler π
- Cycle detection for depth first traversals of a graph.
- instance π
- Resolution of
COLRpaints at a location in variation space. - traversal π
- Traversal of a
COLRpaint graph into aPaintSink.
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.
- Root π
TraitsΒ§
- Paint
Sink - Receives the operations that paint a color glyph.