[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.
This commit is contained in:
Behdad Esfahbod 2018-10-27 02:39:20 -07:00
parent 4025ad8043
commit 3b7e5f1313
4 changed files with 14 additions and 15 deletions

View File

@ -490,7 +490,7 @@ hb_ot_font_set_funcs
<FILE>hb-ot-name</FILE> <FILE>hb-ot-name</FILE>
hb_name_id_t hb_name_id_t
HB_NAME_ID_INVALID HB_NAME_ID_INVALID
hb_ot_name_get_names hb_ot_name_list_names
hb_ot_name_get_utf16 hb_ot_name_get_utf16
hb_ot_name_get_utf32 hb_ot_name_get_utf32
hb_ot_name_get_utf8 hb_ot_name_get_utf8

View File

@ -40,25 +40,24 @@ _get_name (hb_face_t *face)
} }
/** /**
* hb_ot_name_get_names: * hb_ot_name_list_names:
* @face: font face. * @face: font face.
* @entries: (out) (transfer none) (array): * @num_entries: (out) number of returned entries.
* *
* Enumerates all available name IDs and language combinations. Returned * Enumerates all available name IDs and language combinations. Returned
* array is owned by the @face and should not be modified. It can be * array is owned by the @face and should not be modified. It can be
* used as long as @face is alive. * 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 * Since: 2.1.0
**/ **/
unsigned int const hb_ot_name_entry_t *
hb_ot_name_get_names (hb_face_t *face, hb_ot_name_list_names (hb_face_t *face,
const hb_ot_name_entry_t **entries /* OUT */) unsigned int *num_entries /* OUT */)
{ {
const OT::name_accelerator_t &name = _get_name (face); const OT::name_accelerator_t &name = _get_name (face);
if (entries) *num_entries = name.names.len;
*entries = name.names.arrayZ(); return name.names.arrayZ();
return name.names.len;
} }

View File

@ -124,9 +124,9 @@ typedef struct hb_ot_name_entry_t
hb_language_t language; hb_language_t language;
} hb_ot_name_entry_t; } hb_ot_name_entry_t;
HB_EXTERN unsigned int HB_EXTERN const hb_ot_name_entry_t *
hb_ot_name_get_names (hb_face_t *face, hb_ot_name_list_names (hb_face_t *face,
const hb_ot_name_entry_t **entries /* OUT */); unsigned int *num_entries /* OUT */);
HB_END_DECLS HB_END_DECLS

View File

@ -43,8 +43,8 @@ main (int argc, char **argv)
hb_blob_destroy (blob); hb_blob_destroy (blob);
blob = NULL; blob = NULL;
const hb_ot_name_entry_t *entries; unsigned int count;
unsigned int count = hb_ot_name_get_names (face, &entries); const hb_ot_name_entry_t *entries = hb_ot_name_list_names (face, &count);
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
{ {