diff --git a/docs/harfbuzz-docs.xml b/docs/harfbuzz-docs.xml index 3488ccb7f..859cc7098 100644 --- a/docs/harfbuzz-docs.xml +++ b/docs/harfbuzz-docs.xml @@ -76,11 +76,13 @@ + - - + + + diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index dcca4f6c9..7f2ff2d2f 100644 --- a/docs/harfbuzz-sections.txt +++ b/docs/harfbuzz-sections.txt @@ -360,6 +360,7 @@ HB_GOBJECT_TYPE_FONT_FUNCS HB_GOBJECT_TYPE_GLYPH_FLAGS HB_GOBJECT_TYPE_MAP HB_GOBJECT_TYPE_MEMORY_MODE +HB_GOBJECT_TYPE_NAME_ID HB_GOBJECT_TYPE_OT_COLOR_PALETTE_FLAGS HB_GOBJECT_TYPE_OT_LAYOUT_GLYPH_CLASS HB_GOBJECT_TYPE_OT_MATH_CONSTANT @@ -393,6 +394,7 @@ hb_gobject_font_get_type hb_gobject_glyph_flags_get_type hb_gobject_map_get_type hb_gobject_memory_mode_get_type +hb_gobject_name_id_get_type hb_gobject_ot_color_palette_flags_get_type hb_gobject_ot_layout_glyph_class_get_type hb_gobject_ot_math_constant_get_type @@ -489,7 +491,7 @@ hb_ot_font_set_funcs
hb-ot-name hb_name_id_t -HB_NAME_ID_INVALID +hb_ot_name_entry_t hb_ot_name_list_names hb_ot_name_get_utf16 hb_ot_name_get_utf32 diff --git a/src/hb-ot-color-cpal-table.hh b/src/hb-ot-color-cpal-table.hh index 7d3733d3f..0e13bece2 100644 --- a/src/hb-ot-color-cpal-table.hh +++ b/src/hb-ot-color-cpal-table.hh @@ -58,22 +58,22 @@ struct CPALV1Tail hb_array (base+paletteFlagsZ, palette_count)[palette_index]; } - inline unsigned int + inline hb_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; - return hb_array (base+paletteLabelsZ, palette_count)[palette_index]; + return (hb_name_id_t) (unsigned) hb_array (base+paletteLabelsZ, palette_count)[palette_index]; } - inline unsigned int + inline hb_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; - return hb_array (base+colorLabelsZ, color_count)[color_index]; + return (hb_name_id_t) (unsigned) hb_array (base+colorLabelsZ, color_count)[color_index]; } public: @@ -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 unsigned int get_palette_name_id (unsigned int palette_index) const + inline hb_name_id_t get_palette_name_id (unsigned int palette_index) const { return v1 ().get_palette_name_id (this, palette_index, numPalettes); } - inline unsigned int get_color_name_id (unsigned int color_index) const + inline hb_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, diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 27c49df7d..47230b63e 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -1050,7 +1050,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 */ - unsigned int *subfamily_name_id, /* OUT. May be NULL */ + hb_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 */) { @@ -1069,7 +1069,7 @@ hb_ot_layout_get_size_params (hb_face_t *face, { if (design_size) *design_size = params.designSize; if (subfamily_id) *subfamily_id = params.subfamilyID; - if (subfamily_name_id) *subfamily_name_id = params.subfamilyNameID; + if (subfamily_name_id) *subfamily_name_id = (hb_name_id_t) (unsigned) params.subfamilyNameID; if (range_start) *range_start = params.rangeStart; if (range_end) *range_end = params.rangeEnd; @@ -1080,7 +1080,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 = 0; + if (subfamily_name_id) *subfamily_name_id = HB_NAME_ID_INVALID; if (range_start) *range_start = 0; if (range_end) *range_end = 0; @@ -1133,7 +1133,7 @@ hb_ot_layout_feature_get_name_ids (hb_face_t *face, feature_params.get_stylistic_set_params (feature_tag); if (&ss_params != &Null (OT::FeatureParamsStylisticSet)) /* ssXX */ { - if (label_id) *label_id = ss_params.uiNameID; + if (label_id) *label_id = (hb_name_id_t) (unsigned) 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; @@ -1145,11 +1145,11 @@ hb_ot_layout_feature_get_name_ids (hb_face_t *face, feature_params.get_character_variants_params (feature_tag); if (&cv_params != &Null (OT::FeatureParamsCharacterVariants)) /* cvXX */ { - if (label_id) *label_id = cv_params.featUILableNameID; - if (tooltip_id) *tooltip_id = cv_params.featUITooltipTextNameID; - if (sample_id) *sample_id = cv_params.sampleTextNameID; + if (label_id) *label_id = (hb_name_id_t) (unsigned) cv_params.featUILableNameID; + if (tooltip_id) *tooltip_id = (hb_name_id_t) (unsigned) cv_params.featUITooltipTextNameID; + if (sample_id) *sample_id = (hb_name_id_t) (unsigned) cv_params.sampleTextNameID; if (num_named_parameters) *num_named_parameters = cv_params.numNamedParameters; - if (first_param_id) *first_param_id = cv_params.firstParamUILabelNameID; + if (first_param_id) *first_param_id = (hb_name_id_t) (unsigned) cv_params.firstParamUILabelNameID; return true; } } diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh index b84edd185..daf78c89c 100644 --- a/src/hb-ot-name-table.hh +++ b/src/hb-ot-name-table.hh @@ -194,7 +194,7 @@ struct name { hb_ot_name_entry_t *entry = this->names.push (); - entry->name_id = all_names[i].nameID; + entry->name_id = (hb_name_id_t) (unsigned) all_names[i].nameID; entry->language = all_names[i].language (face); entry->entry_score = all_names[i].score (); entry->entry_index = i; diff --git a/src/hb-ot-name.h b/src/hb-ot-name.h index d39b70382..002270a55 100644 --- a/src/hb-ot-name.h +++ b/src/hb-ot-name.h @@ -36,23 +36,16 @@ HB_BEGIN_DECLS /** * hb_name_id_t: + * @HB_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 * API. These can be used to fetch name strings from a font face. * * Since: 2.0.0 - */ -typedef unsigned int hb_name_id_t; - -/** - * HB_NAME_ID_INVALID - * - * Value to represent a nonexistent name ID. - * - * Since: 2.0.0 **/ -enum { +typedef enum +{ HB_NAME_ID_COPYRIGHT = 0, HB_NAME_ID_FONT_FAMILY = 1, HB_NAME_ID_FONT_SUBFAMILY = 2, @@ -81,7 +74,7 @@ enum { HB_NAME_ID_VARIATIONS_PS_PREFIX = 25, HB_NAME_ID_INVALID = 0xFFFF -}; +} hb_name_id_t ; /** diff --git a/src/test-size-params.cc b/src/test-size-params.cc index e53a47d8d..b0905d5ad 100644 --- a/src/test-size-params.cc +++ b/src/test-size-params.cc @@ -46,7 +46,7 @@ main (int argc, char **argv) blob = nullptr; unsigned int p[5]; - bool ret = hb_ot_layout_get_size_params (face, p, p+1, p+2, p+3, p+4); + bool ret = hb_ot_layout_get_size_params (face, p, p+1, (hb_name_id_t *) (p+2), p+3, p+4); printf ("%g %u %u %g %g\n", p[0]/10., p[1], p[2], p[3]/10., p[4]/10.);