| instance.rs |
COLR table instance. |
22981 |
- |
| mod.rs |
Drawing color glyphs.
# Examples
## Retrieve the clip box of a COLRv1 glyph if it has one:
```
# use core::result::Result;
# use skrifa::{instance::{Size, Location}, color::{ColorGlyphFormat, ColorPainter, PaintError}, GlyphId, MetadataProvider};
# fn get_colr_bb(font: read_fonts::FontRef, color_painter_impl : &mut impl ColorPainter, glyph_id : GlyphId, size: Size) -> Result<(), PaintError> {
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.");
}
}
# Ok(())
# }
```
## Paint a COLRv1 glyph given a font, and a glyph id and a [`ColorPainter`] implementation:
```
# use core::result::Result;
# use skrifa::{instance::{Size, Location}, color::{ColorGlyphFormat, ColorPainter, PaintError}, GlyphId, MetadataProvider};
# fn paint_colr(font: read_fonts::FontRef, color_painter_impl : &mut impl ColorPainter, glyph_id : GlyphId) -> Result<(), PaintError> {
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)
# }
```
|
26144 |
- |
| transform.rs |
Contains a [`Transform`] object holding values of an affine transformation matrix. |
3458 |
- |
| traversal.rs |
|
29284 |
- |
| traversal_tests |
|
|
- |