Add hb_ot_color_glyph_has_paint

This commit is contained in:
Matthias Clasen 2022-12-26 07:59:01 -05:00 committed by Behdad Esfahbod
parent 79c5bb92ce
commit b8f2281c6c
4 changed files with 37 additions and 0 deletions

View File

@ -544,6 +544,7 @@ hb_ot_color_glyph_reference_png
hb_ot_color_glyph_reference_svg
hb_ot_color_has_layers
hb_ot_color_has_paint
hb_ot_color_glyph_has_paint
hb_ot_color_has_palettes
hb_ot_color_has_png
hb_ot_color_has_svg

View File

@ -2011,6 +2011,19 @@ struct COLR
return true;
}
bool
has_paint_for_glyph (hb_codepoint_t glyph) const
{
if (version == 1)
{
const Paint *paint = get_base_glyph_paint (glyph);
return paint != nullptr;
}
return false;
}
bool
paint_glyph (hb_font_t *font, hb_codepoint_t glyph, hb_paint_funcs_t *funcs, void *data, unsigned int palette, hb_color_t foreground, bool clip = true) const
{

View File

@ -224,6 +224,25 @@ hb_ot_color_has_paint (hb_face_t *face)
return face->table.COLR->has_v1_data ();
}
/**
* hb_ot_color_glyph_has_paint:
* @face: #hb_face_t to work upon
* @glyph: The glyph index to query
*
* Tests where a face includes COLRv1 paint
* data for @glyph.
*
* Return value: `true` if data found, `false` otherwise
*
* Since: REPLACEME
*/
hb_bool_t
hb_ot_color_glyph_has_paint (hb_face_t *face,
hb_codepoint_t glyph)
{
return face->table.COLR->has_paint_for_glyph (glyph);
}
/**
* hb_ot_color_glyph_get_layers:
* @face: #hb_face_t to work upon

View File

@ -125,6 +125,10 @@ hb_ot_color_glyph_get_layers (hb_face_t *face,
HB_EXTERN hb_bool_t
hb_ot_color_has_paint (hb_face_t *face);
HB_EXTERN hb_bool_t
hb_ot_color_glyph_has_paint (hb_face_t *face,
hb_codepoint_t glyph);
/*
* SVG
*/