[color] Revamp palette API

This commit is contained in:
Behdad Esfahbod 2018-10-22 13:02:04 -07:00
parent 3bf91bd269
commit 7997144b5f
3 changed files with 117 additions and 120 deletions

View File

@ -22,7 +22,7 @@
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Google Author(s): Sascha Brawer
* Google Author(s): Sascha Brawer, Behdad Esfahbod
*/
#include "hb-open-type.hh"
@ -97,7 +97,7 @@ hb_ot_color_has_palettes (hb_face_t *face)
}
/**
* hb_ot_color_get_palette_count:
* hb_ot_color_palette_get_count:
* @face: a font face.
*
* Returns: the number of color palettes in @face, or zero if @face has
@ -106,13 +106,13 @@ hb_ot_color_has_palettes (hb_face_t *face)
* Since: REPLACEME
*/
unsigned int
hb_ot_color_get_palette_count (hb_face_t *face)
hb_ot_color_palette_get_count (hb_face_t *face)
{
return _get_cpal (face).get_palette_count ();
}
/**
* hb_ot_color_get_palette_name_id:
* hb_ot_color_palette_get_name_id:
* @face: a font face.
* @palette: the index of the color palette whose name is being requested.
*
@ -120,38 +120,54 @@ hb_ot_color_get_palette_count (hb_face_t *face)
* have themed palettes like "Spring", "Summer", "Fall", and "Winter".
*
* Returns: an identifier within @face's `name` table.
* If the requested palette has no name, or if @face has no colors,
* or if @palette is not between 0 and hb_ot_color_get_palette_count(),
* the result is 0xFFFF. The implementation does not check whether
* the returned palette name id is actually in @face's `name` table.
* If the requested palette has no name the result is #HB_NAME_ID_INVALID.
*
* Since: REPLACEME
*/
hb_name_id_t
hb_ot_color_get_palette_name_id (hb_face_t *face, unsigned int palette)
hb_ot_color_palette_get_name_id (hb_face_t *face,
unsigned int palette_index)
{
return _get_cpal (face).get_palette_name_id (palette);
return _get_cpal (face).get_palette_name_id (palette_index);
}
/**
* hb_ot_color_get_palette_entry_name_id:
* hb_ot_color_palette_color_get_name_id:
* @face: a font face.
* @palette_entry:
* @color_index:
*
* Returns: Name ID associated with a palette entry, e.g. eye color
*
* Since: REPLACEME
*/
hb_name_id_t
hb_ot_color_get_palette_entry_name_id (hb_face_t *face, unsigned int palette_entry)
hb_ot_color_palette_color_get_name_id (hb_face_t *face,
unsigned int color_index)
{
return _get_cpal (face).get_palette_entry_name_id (palette_entry);
return _get_cpal (face).get_palette_entry_name_id (color_index);
}
/**
* hb_ot_color_get_palette_colors:
* hb_ot_color_palette_get_flags:
* @face: a font face
* @palette_index: the index of the color palette whose flags are being requested
*
* Returns: the flags for the requested color palette.
*
* Since: REPLACEME
*/
hb_ot_color_palette_flags_t
hb_ot_color_palette_get_flags (hb_face_t *face,
unsigned int palette_index)
{
const OT::CPAL& cpal = _get_cpal(face);
return cpal.get_palette_flags (palette_index);
}
/**
* hb_ot_color_palette_get_colors:
* @face: a font face.
* @palette: the index of the color palette whose colors
* @palette_index:the index of the color palette whose colors
* are being requested.
* @start_offset: the index of the first color being requested.
* @color_count: (inout) (optional): on input, how many colors
@ -164,26 +180,23 @@ hb_ot_color_get_palette_entry_name_id (hb_face_t *face, unsigned int palette_ent
* will just return the number of total colors
* without storing any actual colors; this can be used
* for allocating a buffer of suitable size before calling
* hb_ot_color_get_palette_colors() a second time.
* hb_ot_color_palette_get_colors() a second time.
*
* Retrieves the colors in a color palette.
*
* Returns: the total number of colors in the palette. All palettes in
* a font have the same number of colors. If @face has no colors, or if
* @palette is not between 0 and hb_ot_color_get_palette_count(),
* the result is zero.
* Returns: the total number of colors in the palette.
*
* Since: REPLACEME
*/
unsigned int
hb_ot_color_get_palette_colors (hb_face_t *face,
unsigned int palette, /* default=0 */
hb_ot_color_palette_get_colors (hb_face_t *face,
unsigned int palette_index, /* default=0 */
unsigned int start_offset,
unsigned int *colors_count /* IN/OUT. May be NULL. */,
hb_color_t *colors /* OUT. May be NULL. */)
{
const OT::CPAL& cpal = _get_cpal(face);
if (unlikely (palette >= cpal.get_palette_count ()))
if (unlikely (palette_index >= cpal.get_palette_count ()))
{
if (colors_count) *colors_count = 0;
return 0;
@ -197,7 +210,7 @@ hb_ot_color_get_palette_colors (hb_face_t *face,
cpal.get_palette_entries_count () - start_offset);
for (unsigned int i = 0; i < platte_count; i++)
{
if (cpal.get_color_record_argb(start_offset + i, palette, &colors[num_results]))
if (cpal.get_color_record_argb(start_offset + i, palette_index, &colors[num_results]))
++num_results;
}
}
@ -206,24 +219,6 @@ hb_ot_color_get_palette_colors (hb_face_t *face,
return cpal.get_palette_entries_count ();
}
/**
* hb_ot_color_get_palette_flags:
* @face: a font face
* @palette: the index of the color palette whose flags are being requested
*
* Returns: the flags for the requested color palette. If @face has no colors,
* or if @palette is not between 0 and hb_ot_color_get_palette_count(),
* the result is #HB_OT_COLOR_PALETTE_FLAG_DEFAULT.
*
* Since: REPLACEME
*/
hb_ot_color_palette_flags_t
hb_ot_color_get_palette_flags (hb_face_t *face, unsigned int palette)
{
const OT::CPAL& cpal = _get_cpal(face);
return cpal.get_palette_flags (palette);
}
/*
* COLR

View File

@ -23,7 +23,7 @@
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Google Author(s): Sascha Brawer
* Google Author(s): Sascha Brawer, Behdad Esfahbod
*/
#ifndef HB_OT_H_IN
@ -47,20 +47,15 @@ HB_EXTERN hb_bool_t
hb_ot_color_has_palettes (hb_face_t *face);
HB_EXTERN unsigned int
hb_ot_color_get_palette_count (hb_face_t *face);
hb_ot_color_palette_get_count (hb_face_t *face);
HB_EXTERN hb_name_id_t
hb_ot_color_get_palette_name_id (hb_face_t *face, unsigned int palette);
hb_ot_color_palette_get_name_id (hb_face_t *face,
unsigned int palette_index);
HB_EXTERN hb_name_id_t
hb_ot_color_get_palette_entry_name_id (hb_face_t *face, unsigned int palette_entry);
HB_EXTERN unsigned int
hb_ot_color_get_palette_colors (hb_face_t *face,
unsigned int palette, /* default=0 */
unsigned int start_offset,
unsigned int *color_count, /* IN/OUT. May be NULL. */
hb_color_t *colors /* OUT. May be NULL. */);
hb_ot_color_palette_color_get_name_id (hb_face_t *face,
unsigned int color_index);
/**
* hb_ot_color_palette_flags_t:
@ -80,8 +75,15 @@ typedef enum { /*< flags >*/
} hb_ot_color_palette_flags_t;
HB_EXTERN hb_ot_color_palette_flags_t
hb_ot_color_get_palette_flags (hb_face_t *face, unsigned int palette);
hb_ot_color_palette_get_flags (hb_face_t *face,
unsigned int palette_index);
HB_EXTERN unsigned int
hb_ot_color_palette_get_colors (hb_face_t *face,
unsigned int palette_index,
unsigned int start_offset,
unsigned int *color_count, /* IN/OUT. May be NULL. */
hb_color_t *colors /* OUT. May be NULL. */);
/*

View File

@ -128,113 +128,113 @@ static hb_face_t *svg = NULL;
static void
test_hb_ot_color_get_palette_count (void)
test_hb_ot_color_palette_get_count (void)
{
g_assert_cmpint (hb_ot_color_get_palette_count (hb_face_get_empty()), ==, 0);
g_assert_cmpint (hb_ot_color_get_palette_count (cpal_v0), ==, 2);
g_assert_cmpint (hb_ot_color_get_palette_count (cpal_v1), ==, 3);
g_assert_cmpint (hb_ot_color_palette_get_count (hb_face_get_empty()), ==, 0);
g_assert_cmpint (hb_ot_color_palette_get_count (cpal_v0), ==, 2);
g_assert_cmpint (hb_ot_color_palette_get_count (cpal_v1), ==, 3);
}
static void
test_hb_ot_color_get_palette_name_id_empty (void)
test_hb_ot_color_palette_get_name_id_empty (void)
{
/* numPalettes=0, so all calls are for out-of-bounds palette indices */
g_assert_cmpint (hb_ot_color_get_palette_name_id (hb_face_get_empty(), 0), ==, HB_NAME_ID_INVALID);
g_assert_cmpint (hb_ot_color_get_palette_name_id (hb_face_get_empty(), 1), ==, HB_NAME_ID_INVALID);
g_assert_cmpint (hb_ot_color_palette_get_name_id (hb_face_get_empty(), 0), ==, HB_NAME_ID_INVALID);
g_assert_cmpint (hb_ot_color_palette_get_name_id (hb_face_get_empty(), 1), ==, HB_NAME_ID_INVALID);
}
static void
test_hb_ot_color_get_palette_name_id_v0 (void)
test_hb_ot_color_palette_get_name_id_v0 (void)
{
g_assert_cmpint (hb_ot_color_get_palette_name_id (cpal_v0, 0), ==, HB_NAME_ID_INVALID);
g_assert_cmpint (hb_ot_color_get_palette_name_id (cpal_v0, 1), ==, HB_NAME_ID_INVALID);
g_assert_cmpint (hb_ot_color_palette_get_name_id (cpal_v0, 0), ==, HB_NAME_ID_INVALID);
g_assert_cmpint (hb_ot_color_palette_get_name_id (cpal_v0, 1), ==, HB_NAME_ID_INVALID);
/* numPalettes=2, so palette #2 is out of bounds */
g_assert_cmpint (hb_ot_color_get_palette_name_id (cpal_v0, 2), ==, HB_NAME_ID_INVALID);
g_assert_cmpint (hb_ot_color_palette_get_name_id (cpal_v0, 2), ==, HB_NAME_ID_INVALID);
}
static void
test_hb_ot_color_get_palette_name_id_v1 (void)
test_hb_ot_color_palette_get_name_id_v1 (void)
{
g_assert_cmpint (hb_ot_color_get_palette_name_id (cpal_v1, 0), ==, 257);
g_assert_cmpint (hb_ot_color_get_palette_name_id (cpal_v1, 1), ==, HB_NAME_ID_INVALID);
g_assert_cmpint (hb_ot_color_get_palette_name_id (cpal_v1, 2), ==, 258);
g_assert_cmpint (hb_ot_color_palette_get_name_id (cpal_v1, 0), ==, 257);
g_assert_cmpint (hb_ot_color_palette_get_name_id (cpal_v1, 1), ==, HB_NAME_ID_INVALID);
g_assert_cmpint (hb_ot_color_palette_get_name_id (cpal_v1, 2), ==, 258);
/* numPalettes=3, so palette #3 is out of bounds */
g_assert_cmpint (hb_ot_color_get_palette_name_id (cpal_v1, 3), ==, HB_NAME_ID_INVALID);
g_assert_cmpint (hb_ot_color_palette_get_name_id (cpal_v1, 3), ==, HB_NAME_ID_INVALID);
}
static void
test_hb_ot_color_get_palette_flags_empty (void)
test_hb_ot_color_palette_get_flags_empty (void)
{
/* numPalettes=0, so all calls are for out-of-bounds palette indices */
g_assert_cmpint (hb_ot_color_get_palette_flags (hb_face_get_empty(), 0), ==, HB_OT_COLOR_PALETTE_FLAG_DEFAULT);
g_assert_cmpint (hb_ot_color_get_palette_flags (hb_face_get_empty(), 1), ==, HB_OT_COLOR_PALETTE_FLAG_DEFAULT);
g_assert_cmpint (hb_ot_color_palette_get_flags (hb_face_get_empty(), 0), ==, HB_OT_COLOR_PALETTE_FLAG_DEFAULT);
g_assert_cmpint (hb_ot_color_palette_get_flags (hb_face_get_empty(), 1), ==, HB_OT_COLOR_PALETTE_FLAG_DEFAULT);
}
static void
test_hb_ot_color_get_palette_flags_v0 (void)
test_hb_ot_color_palette_get_flags_v0 (void)
{
g_assert_cmpint (hb_ot_color_get_palette_flags (cpal_v0, 0), ==, HB_OT_COLOR_PALETTE_FLAG_DEFAULT);
g_assert_cmpint (hb_ot_color_get_palette_flags (cpal_v0, 1), ==, HB_OT_COLOR_PALETTE_FLAG_DEFAULT);
g_assert_cmpint (hb_ot_color_palette_get_flags (cpal_v0, 0), ==, HB_OT_COLOR_PALETTE_FLAG_DEFAULT);
g_assert_cmpint (hb_ot_color_palette_get_flags (cpal_v0, 1), ==, HB_OT_COLOR_PALETTE_FLAG_DEFAULT);
/* numPalettes=2, so palette #2 is out of bounds */
g_assert_cmpint (hb_ot_color_get_palette_flags (cpal_v0, 2), ==, HB_OT_COLOR_PALETTE_FLAG_DEFAULT);
g_assert_cmpint (hb_ot_color_palette_get_flags (cpal_v0, 2), ==, HB_OT_COLOR_PALETTE_FLAG_DEFAULT);
}
static void
test_hb_ot_color_get_palette_flags_v1 (void)
test_hb_ot_color_palette_get_flags_v1 (void)
{
g_assert_cmpint (hb_ot_color_get_palette_flags (cpal_v1, 0), ==, HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_DARK_BACKGROUND);
g_assert_cmpint (hb_ot_color_get_palette_flags (cpal_v1, 1), ==, HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_LIGHT_BACKGROUND);
g_assert_cmpint (hb_ot_color_get_palette_flags (cpal_v0, 2), ==, HB_OT_COLOR_PALETTE_FLAG_DEFAULT);
g_assert_cmpint (hb_ot_color_palette_get_flags (cpal_v1, 0), ==, HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_DARK_BACKGROUND);
g_assert_cmpint (hb_ot_color_palette_get_flags (cpal_v1, 1), ==, HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_LIGHT_BACKGROUND);
g_assert_cmpint (hb_ot_color_palette_get_flags (cpal_v0, 2), ==, HB_OT_COLOR_PALETTE_FLAG_DEFAULT);
/* numPalettes=3, so palette #3 is out of bounds */
g_assert_cmpint (hb_ot_color_get_palette_flags (cpal_v0, 3), ==, HB_OT_COLOR_PALETTE_FLAG_DEFAULT);
g_assert_cmpint (hb_ot_color_palette_get_flags (cpal_v0, 3), ==, HB_OT_COLOR_PALETTE_FLAG_DEFAULT);
}
static void
test_hb_ot_color_get_palette_colors_empty (void)
test_hb_ot_color_palette_get_colors_empty (void)
{
hb_face_t *empty = hb_face_get_empty ();
g_assert_cmpint (hb_ot_color_get_palette_colors (empty, 0, 0, NULL, NULL), ==, 0);
g_assert_cmpint (hb_ot_color_palette_get_colors (empty, 0, 0, NULL, NULL), ==, 0);
}
static void
test_hb_ot_color_get_palette_colors_v0 (void)
test_hb_ot_color_palette_get_colors_v0 (void)
{
unsigned int num_colors = hb_ot_color_get_palette_colors (cpal_v0, 0, 0, NULL, NULL);
unsigned int num_colors = hb_ot_color_palette_get_colors (cpal_v0, 0, 0, NULL, NULL);
hb_color_t *colors = (hb_color_t*) alloca (num_colors * sizeof (hb_color_t));
size_t colors_size = num_colors * sizeof(*colors);
g_assert_cmpint (num_colors, ==, 2);
/* Palette #0, start_index=0 */
g_assert_cmpint (hb_ot_color_get_palette_colors (cpal_v0, 0, 0, &num_colors, colors), ==, 2);
g_assert_cmpint (hb_ot_color_palette_get_colors (cpal_v0, 0, 0, &num_colors, colors), ==, 2);
g_assert_cmpint (num_colors, ==, 2);
assert_color_rgba (colors, 0, 0x00, 0x00, 0x00, 0xff);
assert_color_rgba (colors, 1, 0x66, 0xcc, 0xff, 0xff);
/* Palette #1, start_index=0 */
g_assert_cmpint (hb_ot_color_get_palette_colors (cpal_v0, 1, 0, &num_colors, colors), ==, 2);
g_assert_cmpint (hb_ot_color_palette_get_colors (cpal_v0, 1, 0, &num_colors, colors), ==, 2);
g_assert_cmpint (num_colors, ==, 2);
assert_color_rgba (colors, 0, 0x00, 0x00, 0x00, 0xff);
assert_color_rgba (colors, 1, 0x80, 0x00, 0x00, 0xff);
/* Palette #2 (there are only #0 and #1 in the font, so this is out of bounds) */
g_assert_cmpint (hb_ot_color_get_palette_colors (cpal_v0, 2, 0, &num_colors, colors), ==, 0);
g_assert_cmpint (hb_ot_color_palette_get_colors (cpal_v0, 2, 0, &num_colors, colors), ==, 0);
/* Palette #0, start_index=1 */
memset(colors, 0x33, colors_size);
num_colors = 2;
g_assert_cmpint (hb_ot_color_get_palette_colors (cpal_v0, 0, 1, &num_colors, colors), ==, 2);
g_assert_cmpint (hb_ot_color_palette_get_colors (cpal_v0, 0, 1, &num_colors, colors), ==, 2);
g_assert_cmpint (num_colors, ==, 1);
assert_color_rgba (colors, 0, 0x66, 0xcc, 0xff, 0xff);
assert_color_rgba (colors, 1, 0x33, 0x33, 0x33, 0x33); /* untouched */
@ -242,7 +242,7 @@ test_hb_ot_color_get_palette_colors_v0 (void)
/* Palette #0, start_index=0, pretend that we have only allocated space for 1 color */
memset(colors, 0x44, colors_size);
num_colors = 1;
g_assert_cmpint (hb_ot_color_get_palette_colors (cpal_v0, 0, 0, &num_colors, colors), ==, 2);
g_assert_cmpint (hb_ot_color_palette_get_colors (cpal_v0, 0, 0, &num_colors, colors), ==, 2);
g_assert_cmpint (num_colors, ==, 1);
assert_color_rgba (colors, 0, 0x00, 0x00, 0x00, 0xff);
assert_color_rgba (colors, 1, 0x44, 0x44, 0x44, 0x44); /* untouched */
@ -250,7 +250,7 @@ test_hb_ot_color_get_palette_colors_v0 (void)
/* start_index > numPaletteEntries */
memset (colors, 0x44, colors_size);
num_colors = 2;
g_assert_cmpint (hb_ot_color_get_palette_colors (cpal_v0, 0, 9876, &num_colors, colors), ==, 2);
g_assert_cmpint (hb_ot_color_palette_get_colors (cpal_v0, 0, 9876, &num_colors, colors), ==, 2);
g_assert_cmpint (num_colors, ==, 0);
assert_color_rgba (colors, 0, 0x44, 0x44, 0x44, 0x44); /* untouched */
assert_color_rgba (colors, 1, 0x44, 0x44, 0x44, 0x44); /* untouched */
@ -258,16 +258,16 @@ test_hb_ot_color_get_palette_colors_v0 (void)
static void
test_hb_ot_color_get_palette_colors_v1 (void)
test_hb_ot_color_palette_get_colors_v1 (void)
{
hb_color_t colors[3];
unsigned int num_colors = hb_ot_color_get_palette_colors (cpal_v1, 0, 0, NULL, NULL);
unsigned int num_colors = hb_ot_color_palette_get_colors (cpal_v1, 0, 0, NULL, NULL);
size_t colors_size = 3 * sizeof (hb_color_t);
g_assert_cmpint (num_colors, ==, 2);
/* Palette #0, start_index=0 */
memset (colors, 0x77, colors_size);
g_assert_cmpint (hb_ot_color_get_palette_colors (cpal_v1, 0, 0, &num_colors, colors), ==, 2);
g_assert_cmpint (hb_ot_color_palette_get_colors (cpal_v1, 0, 0, &num_colors, colors), ==, 2);
g_assert_cmpint (num_colors, ==, 2);
assert_color_rgba (colors, 0, 0x00, 0x00, 0x00, 0xff);
assert_color_rgba (colors, 1, 0x66, 0xcc, 0xff, 0xff);
@ -275,7 +275,7 @@ test_hb_ot_color_get_palette_colors_v1 (void)
/* Palette #1, start_index=0 */
memset (colors, 0x77, colors_size);
g_assert_cmpint (hb_ot_color_get_palette_colors (cpal_v1, 1, 0, &num_colors, colors), ==, 2);
g_assert_cmpint (hb_ot_color_palette_get_colors (cpal_v1, 1, 0, &num_colors, colors), ==, 2);
g_assert_cmpint (num_colors, ==, 2);
assert_color_rgba (colors, 0, 0x00, 0x00, 0x00, 0xff);
assert_color_rgba (colors, 1, 0xff, 0xcc, 0x66, 0xff);
@ -283,7 +283,7 @@ test_hb_ot_color_get_palette_colors_v1 (void)
/* Palette #2, start_index=0 */
memset (colors, 0x77, colors_size);
g_assert_cmpint (hb_ot_color_get_palette_colors (cpal_v1, 2, 0, &num_colors, colors), ==, 2);
g_assert_cmpint (hb_ot_color_palette_get_colors (cpal_v1, 2, 0, &num_colors, colors), ==, 2);
g_assert_cmpint (num_colors, ==, 2);
assert_color_rgba (colors, 0, 0x00, 0x00, 0x00, 0xff);
assert_color_rgba (colors, 1, 0x80, 0x00, 0x00, 0xff);
@ -291,7 +291,7 @@ test_hb_ot_color_get_palette_colors_v1 (void)
/* Palette #3 (out of bounds), start_index=0 */
memset (colors, 0x77, colors_size);
g_assert_cmpint (hb_ot_color_get_palette_colors (cpal_v1, 3, 0, &num_colors, colors), ==, 0);
g_assert_cmpint (hb_ot_color_palette_get_colors (cpal_v1, 3, 0, &num_colors, colors), ==, 0);
g_assert_cmpint (num_colors, ==, 0);
assert_color_rgba (colors, 0, 0x77, 0x77, 0x77, 0x77); /* untouched */
assert_color_rgba (colors, 1, 0x77, 0x77, 0x77, 0x77); /* untouched */
@ -300,19 +300,19 @@ test_hb_ot_color_get_palette_colors_v1 (void)
static void
test_hb_ot_color_get_palette_entry_name_id (void)
test_hb_ot_color_palette_color_get_name_id (void)
{
hb_face_t *empty = hb_face_get_empty ();
g_assert_cmpuint (hb_ot_color_get_palette_entry_name_id (empty, 0), ==, HB_NAME_ID_INVALID);
g_assert_cmpuint (hb_ot_color_get_palette_entry_name_id (empty, 1), ==, HB_NAME_ID_INVALID);
g_assert_cmpuint (hb_ot_color_get_palette_entry_name_id (empty, 2), ==, HB_NAME_ID_INVALID);
g_assert_cmpuint (hb_ot_color_get_palette_entry_name_id (cpal_v0, 0), ==, HB_NAME_ID_INVALID);
g_assert_cmpuint (hb_ot_color_get_palette_entry_name_id (cpal_v0, 1), ==, HB_NAME_ID_INVALID);
g_assert_cmpuint (hb_ot_color_get_palette_entry_name_id (cpal_v0, 2), ==, HB_NAME_ID_INVALID);
g_assert_cmpuint (hb_ot_color_get_palette_entry_name_id (cpal_v1, 0), ==, HB_NAME_ID_INVALID);
g_assert_cmpuint (hb_ot_color_get_palette_entry_name_id (cpal_v1, 1), ==, 256);
g_assert_cmpuint (hb_ot_color_get_palette_entry_name_id (cpal_v1, 2), ==, HB_NAME_ID_INVALID);
g_assert_cmpuint (hb_ot_color_palette_color_get_name_id (empty, 0), ==, HB_NAME_ID_INVALID);
g_assert_cmpuint (hb_ot_color_palette_color_get_name_id (empty, 1), ==, HB_NAME_ID_INVALID);
g_assert_cmpuint (hb_ot_color_palette_color_get_name_id (empty, 2), ==, HB_NAME_ID_INVALID);
g_assert_cmpuint (hb_ot_color_palette_color_get_name_id (cpal_v0, 0), ==, HB_NAME_ID_INVALID);
g_assert_cmpuint (hb_ot_color_palette_color_get_name_id (cpal_v0, 1), ==, HB_NAME_ID_INVALID);
g_assert_cmpuint (hb_ot_color_palette_color_get_name_id (cpal_v0, 2), ==, HB_NAME_ID_INVALID);
g_assert_cmpuint (hb_ot_color_palette_color_get_name_id (cpal_v1, 0), ==, HB_NAME_ID_INVALID);
g_assert_cmpuint (hb_ot_color_palette_color_get_name_id (cpal_v1, 1), ==, 256);
g_assert_cmpuint (hb_ot_color_palette_color_get_name_id (cpal_v1, 2), ==, HB_NAME_ID_INVALID);
}
@ -380,17 +380,17 @@ main (int argc, char **argv)
cbdt = hb_test_open_font_file ("fonts/chromacheck-cbdt.ttf");
sbix = hb_test_open_font_file ("fonts/chromacheck-sbix.ttf");
svg = hb_test_open_font_file ("fonts/chromacheck-svg.ttf");
hb_test_add (test_hb_ot_color_get_palette_count);
hb_test_add (test_hb_ot_color_get_palette_name_id_empty);
hb_test_add (test_hb_ot_color_get_palette_name_id_v0);
hb_test_add (test_hb_ot_color_get_palette_name_id_v1);
hb_test_add (test_hb_ot_color_get_palette_flags_empty);
hb_test_add (test_hb_ot_color_get_palette_flags_v0);
hb_test_add (test_hb_ot_color_get_palette_flags_v1);
hb_test_add (test_hb_ot_color_get_palette_colors_empty);
hb_test_add (test_hb_ot_color_get_palette_colors_v0);
hb_test_add (test_hb_ot_color_get_palette_colors_v1);
hb_test_add (test_hb_ot_color_get_palette_entry_name_id);
hb_test_add (test_hb_ot_color_palette_get_count);
hb_test_add (test_hb_ot_color_palette_get_name_id_empty);
hb_test_add (test_hb_ot_color_palette_get_name_id_v0);
hb_test_add (test_hb_ot_color_palette_get_name_id_v1);
hb_test_add (test_hb_ot_color_palette_get_flags_empty);
hb_test_add (test_hb_ot_color_palette_get_flags_v0);
hb_test_add (test_hb_ot_color_palette_get_flags_v1);
hb_test_add (test_hb_ot_color_palette_get_colors_empty);
hb_test_add (test_hb_ot_color_palette_get_colors_v0);
hb_test_add (test_hb_ot_color_palette_get_colors_v1);
hb_test_add (test_hb_ot_color_palette_color_get_name_id);
hb_test_add (test_hb_ot_color_glyph_get_layers);
hb_test_add (test_hb_ot_color_has_data);
status = hb_test_run();