## hb-ot-name

hb-ot-name — OpenType font name information

## Functions

const hb_ot_name_entry_t * | hb_ot_name_list_names ()
unsigned int | hb_ot_name_get_utf16 ()
unsigned int | hb_ot_name_get_utf32 ()
unsigned int | hb_ot_name_get_utf8 ()

## Types and Values

typedef | hb_ot_name_id_t
enum | hb_ot_name_id_predefined_t
| hb_ot_name_entry_t

## Includes

    #include <hb-ot.h>

## Description

Functions for fetching name strings from OpenType fonts.

## Functions

### hb_ot_name_list_names ()

    const hb_ot_name_entry_t *
    hb_ot_name_list_names (hb_face_t *face,
                           unsigned int *num_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.

#### Parameters

face | font face. |
num_entries | number of returned entries. | [out][optional]

#### Returns

Array of available name entries.

[transfer none][array length=num_entries]

Since: 2.1.0

### hb_ot_name_get_utf16 ()

    unsigned int
    hb_ot_name_get_utf16 (hb_face_t *face,
                          hb_ot_name_id_t name_id,
                          hb_language_t language,
                          unsigned int *text_size,
                          uint16_t *text);

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. A NUL terminator is always written for convenience, and isn't included in the output `text_size` .

#### Parameters

face | font face. |
name_id | OpenType name identifier to fetch. |
language | language to fetch the name for. |
text_size | input size of `text` buffer, and output size of text written to buffer. | [inout][optional]
text | buffer to write fetched name into. | [out caller-allocates][array length=text_size]

#### Returns

full length of the requested string, or 0 if not found.

Since: 2.1.0

### hb_ot_name_get_utf32 ()

    unsigned int
    hb_ot_name_get_utf32 (hb_face_t *face,
                          hb_ot_name_id_t name_id,
                          hb_language_t language,
                          unsigned int *text_size,
                          uint32_t *text);

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. A NUL terminator is always written for convenience, and isn't included in the output `text_size` .

#### Parameters

face | font face. |
name_id | OpenType name identifier to fetch. |
language | language to fetch the name for. |
text_size | input size of `text` buffer, and output size of text written to buffer. | [inout][optional]
text | buffer to write fetched name into. | [out caller-allocates][array length=text_size]

#### Returns

full length of the requested string, or 0 if not found.

Since: 2.1.0

### hb_ot_name_get_utf8 ()

    unsigned int
    hb_ot_name_get_utf8 (hb_face_t *face,
                         hb_ot_name_id_t name_id,
                         hb_language_t language,
                         unsigned int *text_size,
                         char *text);

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. A NUL terminator is always written for convenience, and isn't included in the output `text_size` .

#### Parameters

face | font face. |
name_id | OpenType name identifier to fetch. |
language | language to fetch the name for. |
text_size | input size of `text` buffer, and output size of text written to buffer. | [inout][optional]
text | buffer to write fetched name into. | [out caller-allocates][array length=text_size]

#### Returns

full length of the requested string, or 0 if not found.

Since: 2.1.0

## Types and Values

### hb_ot_name_id_t

    typedef unsigned int hb_ot_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

### enum hb_ot_name_id_predefined_t

An enum type representing the pre-defined name IDs.

For more information on these fields, see the OpenType spec.

#### Members

HB_OT_NAME_ID_COPYRIGHT | Copyright notice |
HB_OT_NAME_ID_FONT_FAMILY | Font Family name |
HB_OT_NAME_ID_FONT_SUBFAMILY | Font Subfamily name |
HB_OT_NAME_ID_UNIQUE_ID | Unique font identifier |
HB_OT_NAME_ID_FULL_NAME | Full font name that reflects all family and relevant subfamily descriptors |
HB_OT_NAME_ID_VERSION_STRING | Version string |
HB_OT_NAME_ID_POSTSCRIPT_NAME | PostScript name for the font |
HB_OT_NAME_ID_TRADEMARK | Trademark |
HB_OT_NAME_ID_MANUFACTURER | Manufacturer Name |
HB_OT_NAME_ID_DESIGNER | Designer |
HB_OT_NAME_ID_DESCRIPTION | Description |
HB_OT_NAME_ID_VENDOR_URL | URL of font vendor |
HB_OT_NAME_ID_DESIGNER_URL | URL of typeface designer |
HB_OT_NAME_ID_LICENSE | License Description |
HB_OT_NAME_ID_LICENSE_URL | URL where additional licensing information can be found |
HB_OT_NAME_ID_TYPOGRAPHIC_FAMILY | Typographic Family name |
HB_OT_NAME_ID_TYPOGRAPHIC_SUBFAMILY | Typographic Subfamily name |
HB_OT_NAME_ID_MAC_FULL_NAME | Compatible Full Name for MacOS |
HB_OT_NAME_ID_SAMPLE_TEXT | Sample text |
HB_OT_NAME_ID_CID_FINDFONT_NAME | PostScript CID findfont name |
HB_OT_NAME_ID_WWS_FAMILY | WWS Family Name |
HB_OT_NAME_ID_WWS_SUBFAMILY | WWS Subfamily Name |
HB_OT_NAME_ID_LIGHT_BACKGROUND | Light Background Palette |
HB_OT_NAME_ID_DARK_BACKGROUND | Dark Background Palette |
HB_OT_NAME_ID_VARIATIONS_PS_PREFIX | Variations PostScript Name Prefix |
HB_OT_NAME_ID_INVALID | Value to represent a nonexistent name ID. |

Since: 7.0.0

### hb_ot_name_entry_t

    typedef struct {
      hb_ot_name_id_t name_id;
      hb_language_t   language;
    } hb_ot_name_entry_t;

Structure representing a name ID in a particular language.

#### Members

hb_ot_name_id_t `name_id`; | name ID |
hb_language_t `language`; | language |

Since: 2.1.0