[colr] Add hb_ot_color_has_paint
This is a counterpart to hb_ot_color_has_layers for COLRv1 data.
This commit is contained in:
parent
63fcb26c9b
commit
021618e91a
|
@ -1631,7 +1631,8 @@ struct COLR
|
||||||
{
|
{
|
||||||
static constexpr hb_tag_t tableTag = HB_OT_TAG_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 get_glyph_layers (hb_codepoint_t glyph,
|
||||||
unsigned int start_offset,
|
unsigned int start_offset,
|
||||||
|
|
|
@ -190,15 +190,8 @@ hb_ot_color_palette_get_colors (hb_face_t *face,
|
||||||
* hb_ot_color_has_layers:
|
* hb_ot_color_has_layers:
|
||||||
* @face: #hb_face_t to work upon
|
* @face: #hb_face_t to work upon
|
||||||
*
|
*
|
||||||
* Tests whether a face includes a `COLR` table.
|
* Tests whether a face includes a `COLR` table
|
||||||
*
|
* with data according to COLRv0.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
* Return value: `true` if data found, `false` otherwise
|
* 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_bool_t
|
||||||
hb_ot_color_has_layers (hb_face_t *face)
|
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 ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -120,6 +120,11 @@ hb_ot_color_glyph_get_layers (hb_face_t *face,
|
||||||
unsigned int *layer_count, /* IN/OUT. May be NULL. */
|
unsigned int *layer_count, /* IN/OUT. May be NULL. */
|
||||||
hb_ot_color_layer_t *layers /* 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
|
* SVG
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue