[name] Rename hb_name_id_t to hb_ot_name_id_t

https://github.com/harfbuzz/harfbuzz/pull/1254
This commit is contained in:
Behdad Esfahbod 2018-10-30 14:04:09 -07:00
parent 881e1054bc
commit a7aba99baa
11 changed files with 138 additions and 137 deletions

View File

@ -481,7 +481,8 @@ hb_ot_font_set_funcs
<SECTION>
<FILE>hb-ot-name</FILE>
hb_name_id_t
hb_ot_name_id_t
HB_OT_NAME_ID_INVALID
hb_ot_name_entry_t
hb_ot_name_list_names
hb_ot_name_get_utf16

View File

@ -58,21 +58,21 @@ struct CPALV1Tail
hb_array (base+paletteFlagsZ, palette_count)[palette_index];
}
inline hb_name_id_t
inline hb_ot_name_id_t
get_palette_name_id (const void *base,
unsigned int palette_index,
unsigned int palette_count) const
{
if (!paletteLabelsZ) return HB_NAME_ID_INVALID;
if (!paletteLabelsZ) return HB_OT_NAME_ID_INVALID;
return hb_array (base+paletteLabelsZ, palette_count)[palette_index];
}
inline hb_name_id_t
inline hb_ot_name_id_t
get_color_name_id (const void *base,
unsigned int color_index,
unsigned int color_count) const
{
if (!colorLabelsZ) return HB_NAME_ID_INVALID;
if (!colorLabelsZ) return HB_OT_NAME_ID_INVALID;
return hb_array (base+colorLabelsZ, color_count)[color_index];
}
@ -123,10 +123,10 @@ struct CPAL
inline hb_ot_color_palette_flags_t get_palette_flags (unsigned int palette_index) const
{ return v1 ().get_palette_flags (this, palette_index, numPalettes); }
inline hb_name_id_t get_palette_name_id (unsigned int palette_index) const
inline hb_ot_name_id_t get_palette_name_id (unsigned int palette_index) const
{ return v1 ().get_palette_name_id (this, palette_index, numPalettes); }
inline hb_name_id_t get_color_name_id (unsigned int color_index) const
inline hb_ot_name_id_t get_color_name_id (unsigned int color_index) const
{ return v1 ().get_color_name_id (this, color_index, numColors); }
inline unsigned int get_palette_colors (unsigned int palette_index,

View File

@ -129,11 +129,11 @@ hb_ot_color_palette_get_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 the result is #HB_NAME_ID_INVALID.
* If the requested palette has no name the result is #HB_OT_NAME_ID_INVALID.
*
* Since: 2.1.0
*/
hb_name_id_t
hb_ot_name_id_t
hb_ot_color_palette_get_name_id (hb_face_t *face,
unsigned int palette_index)
{
@ -149,7 +149,7 @@ hb_ot_color_palette_get_name_id (hb_face_t *face,
*
* Since: 2.1.0
*/
hb_name_id_t
hb_ot_name_id_t
hb_ot_color_palette_color_get_name_id (hb_face_t *face,
unsigned int color_index)
{

View File

@ -49,11 +49,11 @@ hb_ot_color_has_palettes (hb_face_t *face);
HB_EXTERN unsigned int
hb_ot_color_palette_get_count (hb_face_t *face);
HB_EXTERN hb_name_id_t
HB_EXTERN hb_ot_name_id_t
hb_ot_color_palette_get_name_id (hb_face_t *face,
unsigned int palette_index);
HB_EXTERN hb_name_id_t
HB_EXTERN hb_ot_name_id_t
hb_ot_color_palette_color_get_name_id (hb_face_t *face,
unsigned int color_index);

View File

@ -1056,7 +1056,7 @@ hb_bool_t
hb_ot_layout_get_size_params (hb_face_t *face,
unsigned int *design_size, /* OUT. May be NULL */
unsigned int *subfamily_id, /* OUT. May be NULL */
hb_name_id_t *subfamily_name_id, /* OUT. May be NULL */
hb_ot_name_id_t *subfamily_name_id, /* OUT. May be NULL */
unsigned int *range_start, /* OUT. May be NULL */
unsigned int *range_end /* OUT. May be NULL */)
{
@ -1086,7 +1086,7 @@ hb_ot_layout_get_size_params (hb_face_t *face,
if (design_size) *design_size = 0;
if (subfamily_id) *subfamily_id = 0;
if (subfamily_name_id) *subfamily_name_id = HB_NAME_ID_INVALID;
if (subfamily_name_id) *subfamily_name_id = HB_OT_NAME_ID_INVALID;
if (range_start) *range_start = 0;
if (range_end) *range_end = 0;
@ -1121,11 +1121,11 @@ hb_bool_t
hb_ot_layout_feature_get_name_ids (hb_face_t *face,
hb_tag_t table_tag,
unsigned int feature_index,
hb_name_id_t *label_id, /* OUT. May be NULL */
hb_name_id_t *tooltip_id, /* OUT. May be NULL */
hb_name_id_t *sample_id, /* OUT. May be NULL */
hb_ot_name_id_t *label_id, /* OUT. May be NULL */
hb_ot_name_id_t *tooltip_id, /* OUT. May be NULL */
hb_ot_name_id_t *sample_id, /* OUT. May be NULL */
unsigned int *num_named_parameters, /* OUT. May be NULL */
hb_name_id_t *first_param_id /* OUT. May be NULL */)
hb_ot_name_id_t *first_param_id /* OUT. May be NULL */)
{
const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
@ -1141,10 +1141,10 @@ hb_ot_layout_feature_get_name_ids (hb_face_t *face,
{
if (label_id) *label_id = ss_params.uiNameID;
// ssXX features don't have the rest
if (tooltip_id) *tooltip_id = HB_NAME_ID_INVALID;
if (sample_id) *sample_id = HB_NAME_ID_INVALID;
if (tooltip_id) *tooltip_id = HB_OT_NAME_ID_INVALID;
if (sample_id) *sample_id = HB_OT_NAME_ID_INVALID;
if (num_named_parameters) *num_named_parameters = 0;
if (first_param_id) *first_param_id = HB_NAME_ID_INVALID;
if (first_param_id) *first_param_id = HB_OT_NAME_ID_INVALID;
return true;
}
const OT::FeatureParamsCharacterVariants& cv_params =
@ -1160,11 +1160,11 @@ hb_ot_layout_feature_get_name_ids (hb_face_t *face,
}
}
if (label_id) *label_id = HB_NAME_ID_INVALID;
if (tooltip_id) *tooltip_id = HB_NAME_ID_INVALID;
if (sample_id) *sample_id = HB_NAME_ID_INVALID;
if (label_id) *label_id = HB_OT_NAME_ID_INVALID;
if (tooltip_id) *tooltip_id = HB_OT_NAME_ID_INVALID;
if (sample_id) *sample_id = HB_OT_NAME_ID_INVALID;
if (num_named_parameters) *num_named_parameters = 0;
if (first_param_id) *first_param_id = HB_NAME_ID_INVALID;
if (first_param_id) *first_param_id = HB_OT_NAME_ID_INVALID;
return false;
}

View File

@ -367,7 +367,7 @@ HB_EXTERN hb_bool_t
hb_ot_layout_get_size_params (hb_face_t *face,
unsigned int *design_size, /* OUT. May be NULL */
unsigned int *subfamily_id, /* OUT. May be NULL */
hb_name_id_t *subfamily_name_id, /* OUT. May be NULL */
hb_ot_name_id_t *subfamily_name_id, /* OUT. May be NULL */
unsigned int *range_start, /* OUT. May be NULL */
unsigned int *range_end /* OUT. May be NULL */);
@ -376,11 +376,11 @@ HB_EXTERN hb_bool_t
hb_ot_layout_feature_get_name_ids (hb_face_t *face,
hb_tag_t table_tag,
unsigned int feature_index,
hb_name_id_t *label_id /* OUT. May be NULL */,
hb_name_id_t *tooltip_id /* OUT. May be NULL */,
hb_name_id_t *sample_id /* OUT. May be NULL */,
hb_ot_name_id_t *label_id /* OUT. May be NULL */,
hb_ot_name_id_t *tooltip_id /* OUT. May be NULL */,
hb_ot_name_id_t *sample_id /* OUT. May be NULL */,
unsigned int *num_named_parameters /* OUT. May be NULL */,
hb_name_id_t *first_param_id /* OUT. May be NULL */);
hb_ot_name_id_t *first_param_id /* OUT. May be NULL */);
HB_EXTERN unsigned int

View File

@ -224,7 +224,7 @@ struct name
hb_blob_destroy (this->blob);
}
inline int get_index (hb_name_id_t name_id,
inline int get_index (hb_ot_name_id_t name_id,
hb_language_t language,
unsigned int *width=nullptr) const
{

View File

@ -119,7 +119,7 @@ hb_ot_name_convert_utf (const hb_bytes_t *bytes,
template <typename utf_t>
static inline unsigned int
hb_ot_name_get_utf (hb_face_t *face,
hb_name_id_t name_id,
hb_ot_name_id_t name_id,
hb_language_t language,
unsigned int *text_size /* IN/OUT */,
typename utf_t::codepoint_t *text /* OUT */)
@ -169,7 +169,7 @@ hb_ot_name_get_utf (hb_face_t *face,
**/
unsigned int
hb_ot_name_get_utf8 (hb_face_t *face,
hb_name_id_t name_id,
hb_ot_name_id_t name_id,
hb_language_t language,
unsigned int *text_size /* IN/OUT */,
char *text /* OUT */)
@ -196,7 +196,7 @@ hb_ot_name_get_utf8 (hb_face_t *face,
**/
unsigned int
hb_ot_name_get_utf16 (hb_face_t *face,
hb_name_id_t name_id,
hb_ot_name_id_t name_id,
hb_language_t language,
unsigned int *text_size /* IN/OUT */,
uint16_t *text /* OUT */)
@ -222,7 +222,7 @@ hb_ot_name_get_utf16 (hb_face_t *face,
**/
unsigned int
hb_ot_name_get_utf32 (hb_face_t *face,
hb_name_id_t name_id,
hb_ot_name_id_t name_id,
hb_language_t language,
unsigned int *text_size /* IN/OUT */,
uint32_t *text /* OUT */)

View File

@ -35,8 +35,8 @@ HB_BEGIN_DECLS
/**
* hb_name_id_t:
* @HB_NAME_ID_INVALID: Value to represent a nonexistent name ID.
* hb_ot_name_id_t:
* @HB_OT_NAME_ID_INVALID: Value to represent a nonexistent name ID.
*
* An integral type representing an OpenType 'name' table name identifier.
* There are predefined name IDs, as well as name IDs return from other
@ -46,37 +46,37 @@ HB_BEGIN_DECLS
**/
enum
{
HB_NAME_ID_COPYRIGHT = 0,
HB_NAME_ID_FONT_FAMILY = 1,
HB_NAME_ID_FONT_SUBFAMILY = 2,
HB_NAME_ID_UNIQUE_ID = 3,
HB_NAME_ID_FULL_NAME = 4,
HB_NAME_ID_VERSION_STRING = 5,
HB_NAME_ID_POSTSCRIPT_NAME = 6,
HB_NAME_ID_TRADEMARK = 7,
HB_NAME_ID_MANUFACTURER = 8,
HB_NAME_ID_DESIGNER = 9,
HB_NAME_ID_DESCRIPTION = 10,
HB_NAME_ID_VENDOR_URL = 11,
HB_NAME_ID_DESIGNER_URL = 12,
HB_NAME_ID_LICENSE = 13,
HB_NAME_ID_LICENSE_URL = 14,
/*HB_NAME_ID_RESERVED = 15,*/
HB_NAME_ID_TYPOGRAPHIC_FAMILY = 16,
HB_NAME_ID_TYPOGRAPHIC_SUBFAMILY = 17,
HB_NAME_ID_MAC_FULL_NAME = 18,
HB_NAME_ID_SAMPLE_TEXT = 19,
HB_NAME_ID_CID_FINDFONT_NAME = 20,
HB_NAME_ID_WWS_FAMILY = 21,
HB_NAME_ID_WWS_SUBFAMILY = 22,
HB_NAME_ID_LIGHT_BACKGROUND = 23,
HB_NAME_ID_DARK_BACKGROUND = 24,
HB_NAME_ID_VARIATIONS_PS_PREFIX = 25,
HB_OT_NAME_ID_COPYRIGHT = 0,
HB_OT_NAME_ID_FONT_FAMILY = 1,
HB_OT_NAME_ID_FONT_SUBFAMILY = 2,
HB_OT_NAME_ID_UNIQUE_ID = 3,
HB_OT_NAME_ID_FULL_NAME = 4,
HB_OT_NAME_ID_VERSION_STRING = 5,
HB_OT_NAME_ID_POSTSCRIPT_NAME = 6,
HB_OT_NAME_ID_TRADEMARK = 7,
HB_OT_NAME_ID_MANUFACTURER = 8,
HB_OT_NAME_ID_DESIGNER = 9,
HB_OT_NAME_ID_DESCRIPTION = 10,
HB_OT_NAME_ID_VENDOR_URL = 11,
HB_OT_NAME_ID_DESIGNER_URL = 12,
HB_OT_NAME_ID_LICENSE = 13,
HB_OT_NAME_ID_LICENSE_URL = 14,
/*HB_OT_NAME_ID_RESERVED = 15,*/
HB_OT_NAME_ID_TYPOGRAPHIC_FAMILY = 16,
HB_OT_NAME_ID_TYPOGRAPHIC_SUBFAMILY = 17,
HB_OT_NAME_ID_MAC_FULL_NAME = 18,
HB_OT_NAME_ID_SAMPLE_TEXT = 19,
HB_OT_NAME_ID_CID_FINDFONT_NAME = 20,
HB_OT_NAME_ID_WWS_FAMILY = 21,
HB_OT_NAME_ID_WWS_SUBFAMILY = 22,
HB_OT_NAME_ID_LIGHT_BACKGROUND = 23,
HB_OT_NAME_ID_DARK_BACKGROUND = 24,
HB_OT_NAME_ID_VARIATIONS_PS_PREFIX = 25,
HB_NAME_ID_INVALID = 0xFFFF,
HB_OT_NAME_ID_INVALID = 0xFFFF,
};
typedef unsigned int hb_name_id_t;
typedef unsigned int hb_ot_name_id_t;
/**
@ -90,7 +90,7 @@ typedef unsigned int hb_name_id_t;
**/
typedef struct hb_ot_name_entry_t
{
hb_name_id_t name_id;
hb_ot_name_id_t name_id;
/*< private >*/
hb_var_int_t var;
/*< public >*/
@ -104,21 +104,21 @@ hb_ot_name_list_names (hb_face_t *face,
HB_EXTERN unsigned int
hb_ot_name_get_utf8 (hb_face_t *face,
hb_name_id_t name_id,
hb_ot_name_id_t name_id,
hb_language_t language,
unsigned int *text_size /* IN/OUT */,
char *text /* OUT */);
HB_EXTERN unsigned int
hb_ot_name_get_utf16 (hb_face_t *face,
hb_name_id_t name_id,
hb_ot_name_id_t name_id,
hb_language_t language,
unsigned int *text_size /* IN/OUT */,
uint16_t *text /* OUT */);
HB_EXTERN unsigned int
hb_ot_name_get_utf32 (hb_face_t *face,
hb_name_id_t name_id,
hb_ot_name_id_t name_id,
hb_language_t language,
unsigned int *text_size /* IN/OUT */,
uint32_t *text /* OUT */);

View File

@ -141,19 +141,19 @@ static 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_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);
g_assert_cmpint (hb_ot_color_palette_get_name_id (hb_face_get_empty(), 0), ==, HB_OT_NAME_ID_INVALID);
g_assert_cmpint (hb_ot_color_palette_get_name_id (hb_face_get_empty(), 1), ==, HB_OT_NAME_ID_INVALID);
}
static void
test_hb_ot_color_palette_get_name_id_v0 (void)
{
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);
g_assert_cmpint (hb_ot_color_palette_get_name_id (cpal_v0, 0), ==, HB_OT_NAME_ID_INVALID);
g_assert_cmpint (hb_ot_color_palette_get_name_id (cpal_v0, 1), ==, HB_OT_NAME_ID_INVALID);
/* numPalettes=2, so palette #2 is out of bounds */
g_assert_cmpint (hb_ot_color_palette_get_name_id (cpal_v0, 2), ==, HB_NAME_ID_INVALID);
g_assert_cmpint (hb_ot_color_palette_get_name_id (cpal_v0, 2), ==, HB_OT_NAME_ID_INVALID);
}
@ -161,11 +161,11 @@ static void
test_hb_ot_color_palette_get_name_id_v1 (void)
{
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, 1), ==, HB_OT_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_palette_get_name_id (cpal_v1, 3), ==, HB_NAME_ID_INVALID);
g_assert_cmpint (hb_ot_color_palette_get_name_id (cpal_v1, 3), ==, HB_OT_NAME_ID_INVALID);
}
@ -302,15 +302,15 @@ test_hb_ot_color_palette_get_colors_v1 (void)
static void
test_hb_ot_color_palette_color_get_name_id (void)
{
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 (empty, 0), ==, HB_OT_NAME_ID_INVALID);
g_assert_cmpuint (hb_ot_color_palette_color_get_name_id (empty, 1), ==, HB_OT_NAME_ID_INVALID);
g_assert_cmpuint (hb_ot_color_palette_color_get_name_id (empty, 2), ==, HB_OT_NAME_ID_INVALID);
g_assert_cmpuint (hb_ot_color_palette_color_get_name_id (cpal_v0, 0), ==, HB_OT_NAME_ID_INVALID);
g_assert_cmpuint (hb_ot_color_palette_color_get_name_id (cpal_v0, 1), ==, HB_OT_NAME_ID_INVALID);
g_assert_cmpuint (hb_ot_color_palette_color_get_name_id (cpal_v0, 2), ==, HB_OT_NAME_ID_INVALID);
g_assert_cmpuint (hb_ot_color_palette_color_get_name_id (cpal_v1, 0), ==, HB_OT_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);
g_assert_cmpuint (hb_ot_color_palette_color_get_name_id (cpal_v1, 2), ==, HB_OT_NAME_ID_INVALID);
}

View File

@ -41,11 +41,11 @@ test_ot_layout_feature_get_name_ids_and_characters (void)
&feature_index))
g_error ("Failed to find feature index");
hb_name_id_t label_id;
hb_name_id_t tooltip_id;
hb_name_id_t sample_id;
hb_ot_name_id_t label_id;
hb_ot_name_id_t tooltip_id;
hb_ot_name_id_t sample_id;
unsigned int num_named_parameters;
hb_name_id_t first_param_id;
hb_ot_name_id_t first_param_id;
if (!hb_ot_layout_feature_get_name_ids (face, HB_OT_TAG_GSUB, feature_index,
&label_id, &tooltip_id, &sample_id,
&num_named_parameters, &first_param_id))