docs/harfbuzz-docs.xml | 7 ++-- docs/harfbuzz-sections.txt | 6 ++- src/hb-common.h | 30 ++++++++++++++++- src/hb-ot-color-cpal-table.hh | 12 +++---- src/hb-ot-color-sbix-table.hh | 1 src/hb-ot-color.cc | 16 ++++----- src/hb-ot-layout.cc | 18 +++++----- src/hb-ot-name-table.hh | 2 - src/hb-ot-name.cc | 72 +++++++++++++++++++++++++++++++++++++----- src/hb-ot-name.h | 60 +++++++++++++++++++---------------- src/test-name-table.cc | 6 +-- src/test-size-params.cc | 2 - 12 files changed, 166 insertions(+), 66 deletions(-)
New commits: commit 4ee3c8272c31736980218cba95f97fed53d24e14 Author: Behdad Esfahbod <beh...@behdad.org> Date: Sat Oct 27 03:18:45 2018 -0700 [docs] Fix hb_name_id_t Yep, was not recognized without this patch! diff --git a/src/hb-ot-name.h b/src/hb-ot-name.h index 002270a5..35146ac0 100644 --- a/src/hb-ot-name.h +++ b/src/hb-ot-name.h @@ -74,7 +74,7 @@ typedef enum HB_NAME_ID_VARIATIONS_PS_PREFIX = 25, HB_NAME_ID_INVALID = 0xFFFF -} hb_name_id_t ; +} hb_name_id_t; /** commit 9457cfd7bcc9c2fff38194f2bb82ab7be881bfeb Author: Behdad Esfahbod <beh...@behdad.org> Date: Sat Oct 27 03:15:34 2018 -0700 [docs] Hook up hb-map diff --git a/docs/harfbuzz-docs.xml b/docs/harfbuzz-docs.xml index 859cc709..0057a2a9 100644 --- a/docs/harfbuzz-docs.xml +++ b/docs/harfbuzz-docs.xml @@ -74,6 +74,7 @@ <xi:include href="xml/hb-deprecated.xml"/> <xi:include href="xml/hb-set.xml"/> + <xi:include href="xml/hb-map.xml"/> <xi:include href="xml/hb-ot.xml"/> <xi:include href="xml/hb-ot-font.xml"/> commit d941f66c75fe26f909b1ba248535cc372bbde851 Author: Behdad Esfahbod <beh...@behdad.org> Date: Sat Oct 27 02:55:52 2018 -0700 [name] Make hb_name_id_t be the enum This is like hb_script_t. We had this exposed as unsigned int since 2.0.0 release in two APIs, as well as hb_ot_layout_get_size_params() from earlier. But since no one uses those (right?!), let's just fix this now. diff --git a/docs/harfbuzz-docs.xml b/docs/harfbuzz-docs.xml index 3488ccb7..859cc709 100644 --- a/docs/harfbuzz-docs.xml +++ b/docs/harfbuzz-docs.xml @@ -76,11 +76,13 @@ <xi:include href="xml/hb-set.xml"/> <xi:include href="xml/hb-ot.xml"/> + <xi:include href="xml/hb-ot-font.xml"/> <xi:include href="xml/hb-ot-layout.xml"/> <xi:include href="xml/hb-ot-tag.xml"/> - <xi:include href="xml/hb-ot-font.xml"/> - <xi:include href="xml/hb-ot-shape.xml"/> + <xi:include href="xml/hb-ot-color.xml"/> + <xi:include href="xml/hb-ot-name.xml"/> <xi:include href="xml/hb-ot-math.xml"/> + <xi:include href="xml/hb-ot-shape.xml"/> <xi:include href="xml/hb-shape-plan.xml"/> diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index dcca4f6c..7f2ff2d2 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 <SECTION> <FILE>hb-ot-name</FILE> 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 7d3733d3..0e13bece 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 27c49df7..47230b63 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 b84edd18..daf78c89 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 d39b7038..002270a5 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 e53a47d8..b0905d5a 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.); commit 40496a54a03864c5e6a1224c18b4b93a1f578eed Author: Behdad Esfahbod <beh...@behdad.org> Date: Sat Oct 27 02:49:32 2018 -0700 [name] Move HB_NAME_ID_INVALID into the enum Don't know how to document anonymous enum members. diff --git a/src/hb-ot-name.h b/src/hb-ot-name.h index 9cb6f5a1..d39b7038 100644 --- a/src/hb-ot-name.h +++ b/src/hb-ot-name.h @@ -52,8 +52,6 @@ typedef unsigned int hb_name_id_t; * * Since: 2.0.0 **/ -#define HB_NAME_ID_INVALID 0xFFFF - enum { HB_NAME_ID_COPYRIGHT = 0, HB_NAME_ID_FONT_FAMILY = 1, @@ -80,7 +78,9 @@ enum { 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_NAME_ID_VARIATIONS_PS_PREFIX = 25, + + HB_NAME_ID_INVALID = 0xFFFF }; commit a8a55b9f892a5e4f086b20bbe337dc29182210af Author: Behdad Esfahbod <beh...@behdad.org> Date: Sat Oct 27 02:45:57 2018 -0700 [name] Move around diff --git a/src/hb-ot-name.h b/src/hb-ot-name.h index 07677394..9cb6f5a1 100644 --- a/src/hb-ot-name.h +++ b/src/hb-ot-name.h @@ -34,6 +34,26 @@ HB_BEGIN_DECLS +/** + * hb_name_id_t: + * + * 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 + **/ +#define HB_NAME_ID_INVALID 0xFFFF + enum { HB_NAME_ID_COPYRIGHT = 0, HB_NAME_ID_FONT_FAMILY = 1, @@ -63,25 +83,28 @@ enum { HB_NAME_ID_VARIATIONS_PS_PREFIX = 25 }; -/** - * hb_name_id_t: - * - * 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 + * hb_ot_name_entry_t: + * @name_id: name ID + * @language: language * - * Value to represent a nonexistent name ID. + * Structure representing a name ID in a particular language. * - * Since: 2.0.0 + * Since: 2.1.0 **/ -#define HB_NAME_ID_INVALID 0xFFFF +typedef struct hb_ot_name_entry_t +{ + hb_name_id_t name_id; + /*< private >*/ + hb_var_int_t var; + /*< public >*/ + hb_language_t language; +} hb_ot_name_entry_t; + +HB_EXTERN const hb_ot_name_entry_t * +hb_ot_name_list_names (hb_face_t *face, + unsigned int *num_entries /* OUT */); HB_EXTERN unsigned int @@ -106,29 +129,6 @@ hb_ot_name_get_utf32 (hb_face_t *face, uint32_t *text /* OUT */); -/** - * hb_ot_name_entry_t: - * @name_id: name ID - * @language: language - * - * Structure representing a name ID in a particular language. - * - * Since: 2.1.0 - **/ -typedef struct hb_ot_name_entry_t -{ - hb_name_id_t name_id; - /*< private >*/ - hb_var_int_t var; - /*< public >*/ - hb_language_t language; -} hb_ot_name_entry_t; - -HB_EXTERN const hb_ot_name_entry_t * -hb_ot_name_list_names (hb_face_t *face, - unsigned int *num_entries /* OUT */); - - HB_END_DECLS #endif /* HB_OT_NAME_H */ commit 3b7e5f131383956e19642d28c938f1bc0d16295f Author: Behdad Esfahbod <beh...@behdad.org> Date: Sat Oct 27 02:39:20 2018 -0700 [name] Rename hb_ot_name_get_names() to hb_ot_name_list_names() And swap return value positions, so can be annotated for gobject-introspectin. diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index 8229d466..dcca4f6c 100644 --- a/docs/harfbuzz-sections.txt +++ b/docs/harfbuzz-sections.txt @@ -490,7 +490,7 @@ hb_ot_font_set_funcs <FILE>hb-ot-name</FILE> hb_name_id_t HB_NAME_ID_INVALID -hb_ot_name_get_names +hb_ot_name_list_names hb_ot_name_get_utf16 hb_ot_name_get_utf32 hb_ot_name_get_utf8 diff --git a/src/hb-ot-name.cc b/src/hb-ot-name.cc index 650d99ab..28a45f01 100644 --- a/src/hb-ot-name.cc +++ b/src/hb-ot-name.cc @@ -40,25 +40,24 @@ _get_name (hb_face_t *face) } /** - * hb_ot_name_get_names: + * hb_ot_name_list_names: * @face: font face. - * @entries: (out) (transfer none) (array): + * @num_entries: (out) number of returned entries. * * Enumerates all available name IDs and language combinations. Returned * array is owned by the @face and should not be modified. It can be * used as long as @face is alive. * - * Returns: Number of entries returned. + * Returns: (out) (transfer none) (array length=num_entries) Array of available name entries. * Since: 2.1.0 **/ -unsigned int -hb_ot_name_get_names (hb_face_t *face, - const hb_ot_name_entry_t **entries /* OUT */) +const hb_ot_name_entry_t * +hb_ot_name_list_names (hb_face_t *face, + unsigned int *num_entries /* OUT */) { const OT::name_accelerator_t &name = _get_name (face); - if (entries) - *entries = name.names.arrayZ(); - return name.names.len; + *num_entries = name.names.len; + return name.names.arrayZ(); } diff --git a/src/hb-ot-name.h b/src/hb-ot-name.h index 18476553..07677394 100644 --- a/src/hb-ot-name.h +++ b/src/hb-ot-name.h @@ -124,9 +124,9 @@ typedef struct hb_ot_name_entry_t hb_language_t language; } hb_ot_name_entry_t; -HB_EXTERN unsigned int -hb_ot_name_get_names (hb_face_t *face, - const hb_ot_name_entry_t **entries /* OUT */); +HB_EXTERN const hb_ot_name_entry_t * +hb_ot_name_list_names (hb_face_t *face, + unsigned int *num_entries /* OUT */); HB_END_DECLS diff --git a/src/test-name-table.cc b/src/test-name-table.cc index ad6d493d..33305272 100644 --- a/src/test-name-table.cc +++ b/src/test-name-table.cc @@ -43,8 +43,8 @@ main (int argc, char **argv) hb_blob_destroy (blob); blob = NULL; - const hb_ot_name_entry_t *entries; - unsigned int count = hb_ot_name_get_names (face, &entries); + unsigned int count; + const hb_ot_name_entry_t *entries = hb_ot_name_list_names (face, &count); for (unsigned int i = 0; i < count; i++) { commit 4025ad804383dc8d5ace9654ae21d4d726d0dbc4 Author: Behdad Esfahbod <beh...@behdad.org> Date: Sat Oct 27 02:35:06 2018 -0700 Document new API diff --git a/src/hb-common.h b/src/hb-common.h index 0858c0e2..2532d69f 100644 --- a/src/hb-common.h +++ b/src/hb-common.h @@ -449,15 +449,43 @@ hb_variation_to_string (hb_variation_t *variation, * * Data type for holding color values. * - * Since: REPLACEME + * Since: 2.1.0 */ typedef uint32_t hb_color_t; #define HB_COLOR(b,g,r,a) ((hb_color_t) HB_TAG ((b),(g),(r),(a))) +/** + * hb_color_get_alpha: + * + * + * + * Since: 2.1.0 + */ #define hb_color_get_alpha(color) ((color) & 0xFF) +/** + * hb_color_get_red: + * + * + * + * Since: 2.1.0 + */ #define hb_color_get_red(color) (((color) >> 8) & 0xFF) +/** + * hb_color_get_green: + * + * + * + * Since: 2.1.0 + */ #define hb_color_get_green(color) (((color) >> 16) & 0xFF) +/** + * hb_color_get_blue: + * + * + * + * Since: 2.1.0 + */ #define hb_color_get_blue(color) (((color) >> 24) & 0xFF) diff --git a/src/hb-ot-color.cc b/src/hb-ot-color.cc index 3f492cc1..58f5a070 100644 --- a/src/hb-ot-color.cc +++ b/src/hb-ot-color.cc @@ -89,7 +89,7 @@ _get_svg (hb_face_t *face) * * Returns: whether CPAL table is available. * - * Since: REPLACEME + * Since: 2.1.0 */ hb_bool_t hb_ot_color_has_palettes (hb_face_t *face) @@ -104,7 +104,7 @@ hb_ot_color_has_palettes (hb_face_t *face) * Returns: the number of color palettes in @face, or zero if @face has * no colors. * - * Since: REPLACEME + * Since: 2.1.0 */ unsigned int hb_ot_color_palette_get_count (hb_face_t *face) @@ -123,7 +123,7 @@ hb_ot_color_palette_get_count (hb_face_t *face) * Returns: an identifier within @face's `name` table. * If the requested palette has no name the result is #HB_NAME_ID_INVALID. * - * Since: REPLACEME + * Since: 2.1.0 */ hb_name_id_t hb_ot_color_palette_get_name_id (hb_face_t *face, @@ -139,7 +139,7 @@ hb_ot_color_palette_get_name_id (hb_face_t *face, * * Returns: Name ID associated with a palette entry, e.g. eye color * - * Since: REPLACEME + * Since: 2.1.0 */ hb_name_id_t hb_ot_color_palette_color_get_name_id (hb_face_t *face, @@ -155,7 +155,7 @@ hb_ot_color_palette_color_get_name_id (hb_face_t *face, * * Returns: the flags for the requested color palette. * - * Since: REPLACEME + * Since: 2.1.0 */ hb_ot_color_palette_flags_t hb_ot_color_palette_get_flags (hb_face_t *face, @@ -186,7 +186,7 @@ hb_ot_color_palette_get_flags (hb_face_t *face, * * Returns: the total number of colors in the palette. * - * Since: REPLACEME + * Since: 2.1.0 */ unsigned int hb_ot_color_palette_get_colors (hb_face_t *face, @@ -209,7 +209,7 @@ hb_ot_color_palette_get_colors (hb_face_t *face, * * Returns: whether COLR table is available. * - * Since: REPLACEME + * Since: 2.1.0 */ hb_bool_t hb_ot_color_has_layers (hb_face_t *face) @@ -227,7 +227,7 @@ hb_ot_color_has_layers (hb_face_t *face) * * Returns: * - * Since: REPLACEME + * Since: 2.1.0 */ unsigned int hb_ot_color_glyph_get_layers (hb_face_t *face, diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 096fda20..27c49df7 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -1174,7 +1174,7 @@ hb_ot_layout_feature_get_name_ids (hb_face_t *face, * one shot copying). * @char_count: (inout) (allow-none): The count of characters for which this feature * provides glyph variants. (May be zero.) - * @characters: (out) (allow-none): A buffer pointer. The Unicode Scalar Value + * @characters: (out caller-allocates) (array length=char_count): A buffer pointer. The Unicode codepoints * of the characters for which this feature provides glyph variants. * * Fetches characters listed by designer under feature parameters for "Character diff --git a/src/hb-ot-name.cc b/src/hb-ot-name.cc index f1c1f76e..650d99ab 100644 --- a/src/hb-ot-name.cc +++ b/src/hb-ot-name.cc @@ -39,7 +39,18 @@ _get_name (hb_face_t *face) return *(hb_ot_face_data (face)->name.get ()); } - +/** + * hb_ot_name_get_names: + * @face: font face. + * @entries: (out) (transfer none) (array): + * + * Enumerates all available name IDs and language combinations. Returned + * array is owned by the @face and should not be modified. It can be + * used as long as @face is alive. + * + * Returns: Number of entries returned. + * Since: 2.1.0 + **/ unsigned int hb_ot_name_get_names (hb_face_t *face, const hb_ot_name_entry_t **entries /* OUT */) @@ -131,6 +142,22 @@ hb_ot_name_get_utf (hb_face_t *face, return 0; } +/** + * hb_ot_name_get_utf8: + * @face: font face. + * @name_id: OpenType name identifier to fetch. + * @language: language to fetch the name for. + * @text_size: (inout) (allow-none): input size of @text buffer, and output size of + * text written to buffer. + * @text: (out caller-allocates) (array length=text_size): buffer to write fetched name into. + * + * Fetches a font name from the OpenType 'name' table. + * If @language is #HB_LANGUAGE_INVALID, English ("en") is assumed. + * Returns string in UTF-8 encoding. + * + * Returns: full length of the requested string, or 0 if not found. + * Since: 2.1.0 + **/ unsigned int hb_ot_name_get_utf8 (hb_face_t *face, hb_name_id_t name_id, @@ -142,6 +169,22 @@ hb_ot_name_get_utf8 (hb_face_t *face, (hb_utf8_t::codepoint_t *) text); } +/** + * hb_ot_name_get_utf16: + * @face: font face. + * @name_id: OpenType name identifier to fetch. + * @language: language to fetch the name for. + * @text_size: (inout) (allow-none): input size of @text buffer, and output size of + * text written to buffer. + * @text: (out caller-allocates) (array length=text_size): buffer to write fetched name into. + * + * Fetches a font name from the OpenType 'name' table. + * If @language is #HB_LANGUAGE_INVALID, English ("en") is assumed. + * Returns string in UTF-16 encoding. + * + * Returns: full length of the requested string, or 0 if not found. + * Since: 2.1.0 + **/ unsigned int hb_ot_name_get_utf16 (hb_face_t *face, hb_name_id_t name_id, @@ -152,6 +195,22 @@ hb_ot_name_get_utf16 (hb_face_t *face, return hb_ot_name_get_utf<hb_utf16_t> (face, name_id, language, text_size, text); } +/** + * hb_ot_name_get_utf32: + * @face: font face. + * @name_id: OpenType name identifier to fetch. + * @language: language to fetch the name for. + * @text_size: (inout) (allow-none): input size of @text buffer, and output size of + * text written to buffer. + * @text: (out caller-allocates) (array length=text_size): buffer to write fetched name into. + * + * Fetches a font name from the OpenType 'name' table. + * If @language is #HB_LANGUAGE_INVALID, English ("en") is assumed. + * Returns string in UTF-32 encoding. + * + * Returns: full length of the requested string, or 0 if not found. + * Since: 2.1.0 + **/ unsigned int hb_ot_name_get_utf32 (hb_face_t *face, hb_name_id_t name_id, diff --git a/src/hb-ot-name.h b/src/hb-ot-name.h index 66af5b64..18476553 100644 --- a/src/hb-ot-name.h +++ b/src/hb-ot-name.h @@ -66,6 +66,10 @@ enum { /** * hb_name_id_t: * + * 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; @@ -73,6 +77,8 @@ typedef unsigned int hb_name_id_t; /** * HB_NAME_ID_INVALID * + * Value to represent a nonexistent name ID. + * * Since: 2.0.0 **/ #define HB_NAME_ID_INVALID 0xFFFF @@ -100,6 +106,15 @@ hb_ot_name_get_utf32 (hb_face_t *face, uint32_t *text /* OUT */); +/** + * hb_ot_name_entry_t: + * @name_id: name ID + * @language: language + * + * Structure representing a name ID in a particular language. + * + * Since: 2.1.0 + **/ typedef struct hb_ot_name_entry_t { hb_name_id_t name_id; commit 0353ac6cde47df8f5386733f5c12cc60732a5bf4 Author: Ebrahim Byagowi <ebra...@gnu.org> Date: Sat Oct 27 12:24:53 2018 +0330 Fix test-name-table on older bots diff --git a/src/test-name-table.cc b/src/test-name-table.cc index 66596fe4..ad6d493d 100644 --- a/src/test-name-table.cc +++ b/src/test-name-table.cc @@ -41,7 +41,7 @@ main (int argc, char **argv) hb_blob_t *blob = hb_blob_create_from_file (argv[1]); hb_face_t *face = hb_face_create (blob, 0 /* first face */); hb_blob_destroy (blob); - blob = nullptr; + blob = NULL; const hb_ot_name_entry_t *entries; unsigned int count = hb_ot_name_get_names (face, &entries); commit dc11a38107ac1f0a2d3edacae33ff7f10f5e894c Author: Ebrahim Byagowi <ebra...@gnu.org> Date: Sat Oct 27 12:15:25 2018 +0330 [sbix] Set num_glyphs on accelerator dump-emoji was broken without it diff --git a/src/hb-ot-color-sbix-table.hh b/src/hb-ot-color-sbix-table.hh index 1b643c77..ec956a8d 100644 --- a/src/hb-ot-color-sbix-table.hh +++ b/src/hb-ot-color-sbix-table.hh @@ -99,6 +99,7 @@ struct sbix sbix_blob = hb_sanitize_context_t().reference_table<sbix> (face); sbix_len = hb_blob_get_length (sbix_blob); sbix_table = sbix_blob->as<sbix> (); + num_glyphs = face->get_num_glyphs (); } inline void fini (void) _______________________________________________ HarfBuzz mailing list HarfBuzz@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/harfbuzz