diff --git a/src/hb-ot-color-colr-table.hh b/src/hb-ot-color-colr-table.hh index 3dc7c6f6a..cf13dfbbe 100644 --- a/src/hb-ot-color-colr-table.hh +++ b/src/hb-ot-color-colr-table.hh @@ -1631,7 +1631,8 @@ struct COLR { static constexpr hb_tag_t tableTag = HB_OT_TAG_COLR; - bool has_data () const { return numBaseGlyphs; } + bool has_v0_data () const { return numBaseGlyphs; } + bool has_v1_data () const { return (this+baseGlyphList).len; } unsigned int get_glyph_layers (hb_codepoint_t glyph, unsigned int start_offset, diff --git a/src/hb-ot-color.cc b/src/hb-ot-color.cc index 621d36555..734ac1022 100644 --- a/src/hb-ot-color.cc +++ b/src/hb-ot-color.cc @@ -190,15 +190,8 @@ hb_ot_color_palette_get_colors (hb_face_t *face, * hb_ot_color_has_layers: * @face: #hb_face_t to work upon * - * Tests whether a face includes a `COLR` table. - * - * Note that the `COLR` table may contain layers - * or (for v1) more complicated paint graphs, so - * it is not guaranteed that hb_ot_color_get_layers() - * will return information for each color glyph, - * even if this function returns `true`. See - * hb_font_paint_glyph() for an API that will work - * in either case. + * Tests whether a face includes a `COLR` table + * with data according to COLRv0. * * Return value: `true` if data found, `false` otherwise * @@ -207,7 +200,24 @@ hb_ot_color_palette_get_colors (hb_face_t *face, hb_bool_t hb_ot_color_has_layers (hb_face_t *face) { - return face->table.COLR->has_data (); + return face->table.COLR->has_v0_data (); +} + +/** + * hb_ot_color_has_paint: + * @face: #hb_face_t to work upon + * + * Tests where a face includes a `COLR` table + * with data according to COLRv1. + * + * Return value: `true` if data found, `false` otherwise + * + * Since: REPLACEME + */ +hb_bool_t +hb_ot_color_has_paint (hb_face_t *face) +{ + return face->table.COLR->has_v1_data (); } /** diff --git a/src/hb-ot-color.h b/src/hb-ot-color.h index d11e07e23..f29d7cf5f 100644 --- a/src/hb-ot-color.h +++ b/src/hb-ot-color.h @@ -120,6 +120,11 @@ hb_ot_color_glyph_get_layers (hb_face_t *face, unsigned int *layer_count, /* IN/OUT. May be NULL. */ hb_ot_color_layer_t *layers /* OUT. May be NULL. */); +/* COLRv1 */ + +HB_EXTERN hb_bool_t +hb_ot_color_has_paint (hb_face_t *face); + /* * SVG */