skrifa

Module color

source
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)

Structs§

Enums§

Traits§

  • A group of required painting callbacks to be provided by the client.