## hb-ot-layout

hb-ot-layout — OpenType Layout

## Functions

hb_language_t | hb_ot_tag_to_language ()
hb_script_t | hb_ot_tag_to_script ()
void | hb_ot_tags_from_script_and_language ()
void | hb_ot_tags_to_script_and_language ()
void | hb_ot_layout_collect_lookups ()
void | hb_ot_layout_collect_features ()
unsigned int | hb_ot_layout_feature_get_characters ()
unsigned int | hb_ot_layout_feature_get_lookups ()
hb_bool_t | hb_ot_layout_feature_get_name_ids ()
unsigned int | hb_ot_layout_feature_with_variations_get_lookups ()
unsigned int | hb_ot_layout_get_attach_points ()
hb_ot_layout_glyph_class_t | hb_ot_layout_get_glyph_class ()
void | hb_ot_layout_get_glyphs_in_class ()
unsigned int | hb_ot_layout_get_ligature_carets ()
hb_bool_t | hb_ot_layout_get_size_params ()
hb_bool_t | (*hb_ot_layout_glyph_sequence_func_t) ()
hb_bool_t | hb_ot_layout_has_glyph_classes ()
hb_bool_t | hb_ot_layout_has_positioning ()
hb_bool_t | hb_ot_layout_has_substitution ()
hb_bool_t | hb_ot_layout_language_find_feature ()
unsigned int | hb_ot_layout_language_get_feature_indexes ()
unsigned int | hb_ot_layout_language_get_feature_tags ()
hb_bool_t | hb_ot_layout_language_get_required_feature ()
void | hb_ot_layout_lookup_collect_glyphs ()
void | hb_ot_layout_lookup_substitute_closure ()
void | hb_ot_layout_lookups_substitute_closure ()
hb_bool_t | hb_ot_layout_lookup_would_substitute ()
unsigned int | hb_ot_layout_script_get_language_tags ()
hb_bool_t | hb_ot_layout_script_select_language ()
hb_bool_t | hb_ot_layout_table_find_feature_variations ()
unsigned int | hb_ot_layout_table_get_feature_tags ()
unsigned int | hb_ot_layout_table_get_script_tags ()
unsigned int | hb_ot_layout_table_get_lookup_count ()
hb_bool_t | hb_ot_layout_table_select_script ()
void | hb_ot_shape_plan_collect_lookups ()
hb_bool_t | hb_ot_layout_language_get_required_feature_index ()

## Types and Values

#define | HB_OT_MAX_TAGS_PER_LANGUAGE
#define | HB_OT_MAX_TAGS_PER_SCRIPT
#define | HB_OT_TAG_DEFAULT_LANGUAGE
#define | HB_OT_TAG_DEFAULT_SCRIPT
#define | HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX
#define | HB_OT_LAYOUT_NO_FEATURE_INDEX
#define | HB_OT_LAYOUT_NO_SCRIPT_INDEX
#define | HB_OT_LAYOUT_NO_VARIATIONS_INDEX
#define | HB_OT_TAG_BASE
#define | HB_OT_TAG_GDEF
#define | HB_OT_TAG_GPOS
#define | HB_OT_TAG_GSUB
#define | HB_OT_TAG_JSTF
enum | hb_ot_layout_glyph_class_t

## Includes

    #include <hb-ot.h>

## Description

Functions for querying OpenType Layout features in the font face.

## Functions

### hb_ot_tag_to_language ()

    hb_language_t
    hb_ot_tag_to_language (hb_tag_t tag);

#### Returns

.

[transfer none]

Since: 0.9.2

### hb_ot_tag_to_script ()

    hb_script_t
    hb_ot_tag_to_script (hb_tag_t tag);

### hb_ot_tags_from_script_and_language ()

    void
    hb_ot_tags_from_script_and_language (hb_script_t script,
                                         hb_language_t language,
                                         unsigned int *script_count,
                                         hb_tag_t *script_tags,
                                         unsigned int *language_count,
                                         hb_tag_t *language_tags);

Converts an hb_script_t and an hb_language_t to script and language tags.

#### Parameters

script | an hb_script_t to convert. |
language | an hb_language_t to convert. |
script_count | maximum number of script tags to retrieve (IN) and actual number of script tags retrieved (OUT). | [allow-none]
script_tags | array of size at least `script_count` to store the script tag results. | [out][allow-none]
language_count | maximum number of language tags to retrieve (IN) and actual number of language tags retrieved (OUT). | [allow-none]
language_tags | array of size at least `language_count` to store the language tag results. | [out][allow-none]

Since: 2.0.0

### hb_ot_tags_to_script_and_language ()

    void
    hb_ot_tags_to_script_and_language (hb_tag_t script_tag,
                                       hb_tag_t language_tag,
                                       hb_script_t *script,
                                       hb_language_t *language);

Converts a script tag and a language tag to an hb_script_t and an hb_language_t.

#### Parameters

script_tag | a script tag |
language_tag | a language tag |
script | the hb_script_t corresponding to `script_tag` (OUT). | [allow-none]
language | the hb_language_t corresponding to `script_tag` and `language_tag` (OUT). | [allow-none]

Since: 2.0.0

### hb_ot_layout_collect_lookups ()

    void
    hb_ot_layout_collect_lookups (hb_face_t *face,
                                  hb_tag_t table_tag,
                                  const hb_tag_t *scripts,
                                  const hb_tag_t *languages,
                                  const hb_tag_t *features,
                                  hb_set_t *lookup_indexes);

Since: 0.9.8

### hb_ot_layout_collect_features ()

    void
    hb_ot_layout_collect_features (hb_face_t *face,
                                   hb_tag_t table_tag,
                                   const hb_tag_t *scripts,
                                   const hb_tag_t *languages,
                                   const hb_tag_t *features,
                                   hb_set_t *feature_indexes);

Since: 1.8.5

### hb_ot_layout_feature_get_characters ()

    unsigned int
    hb_ot_layout_feature_get_characters (hb_face_t *face,
                                         hb_tag_t table_tag,
                                         unsigned int feature_index,
                                         unsigned int start_offset,
                                         unsigned int *char_count,
                                         hb_codepoint_t *characters);

Fetches characters listed by designer under feature parameters for "Character Variant" ("cvXX") features.

#### Parameters

face | hb_face_t to work upon |
table_tag | table tag to query, "GSUB" or "GPOS". |
feature_index | index of feature to query. |
start_offset | In case the resulting char_count was equal to its input value, there is a chance there were more characters on the tag so this API can be called with an offset till resulting char_count gets to a number lower than input buffer (or consider using just a bigger buffer for one shot copying). |
char_count | The count of characters for which this feature provides glyph variants. (May be zero.). | [inout][allow-none]
characters | A buffer pointer. The Unicode codepoints of the characters for which this feature provides glyph variants. | [out caller-allocates][array length=char_count]

#### Returns

Number of total sample characters in the cvXX feature.

Since: 2.0.0

### hb_ot_layout_feature_get_lookups ()

    unsigned int
    hb_ot_layout_feature_get_lookups (hb_face_t *face,
                                      hb_tag_t table_tag,
                                      unsigned int feature_index,
                                      unsigned int start_offset,
                                      unsigned int *lookup_count,
                                      unsigned int *lookup_indexes);

Since: 0.9.7

### hb_ot_layout_feature_get_name_ids ()

    hb_bool_t
    hb_ot_layout_feature_get_name_ids (hb_face_t *face,
                                       hb_tag_t table_tag,
                                       unsigned int feature_index,
                                       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_ot_name_id_t *first_param_id);

Fetches name indices from feature parameters for "Stylistic Set" ('ssXX') or "Character Variant" ('cvXX') features.

#### Parameters

face | hb_face_t to work upon |
table_tag | table tag to query, "GSUB" or "GPOS". |
feature_index | index of feature to query. |
label_id | The ‘name’ table name ID that specifies a string for a user-interface label for this feature. (May be NULL.). | [out][allow-none]
tooltip_id | The ‘name’ table name ID that specifies a string that an application can use for tooltip text for this feature. (May be NULL.). | [out][allow-none]
sample_id | The ‘name’ table name ID that specifies sample text that illustrates the effect of this feature. (May be NULL.). | [out][allow-none]
num_named_parameters | Number of named parameters. (May be zero.). | [out][allow-none]
first_param_id | The first ‘name’ table name ID used to specify strings for user-interface labels for the feature parameters. (Must be zero if numParameters is zero.). | [out][allow-none]

#### Returns

true if data found, false otherwise

Since: 2.0.0

### hb_ot_layout_feature_with_variations_get_lookups ()

    unsigned int
    hb_ot_layout_feature_with_variations_get_lookups
                                   (hb_face_t *face,
                                    hb_tag_t table_tag,
                                    unsigned int feature_index,
                                    unsigned int variations_index,
                                    unsigned int start_offset,
                                    unsigned int *lookup_count,
                                    unsigned int *lookup_indexes);

### hb_ot_layout_get_attach_points ()

    unsigned int
    hb_ot_layout_get_attach_points (hb_face_t *face,
                                    hb_codepoint_t glyph,
                                    unsigned int start_offset,
                                    unsigned int *point_count,
                                    unsigned int *point_array);

### hb_ot_layout_get_glyph_class ()

    hb_ot_layout_glyph_class_t
    hb_ot_layout_get_glyph_class (hb_face_t *face,
                                  hb_codepoint_t glyph);

Since: 0.9.7

### hb_ot_layout_get_glyphs_in_class ()

    void
    hb_ot_layout_get_glyphs_in_class (hb_face_t *face,
                                      hb_ot_layout_glyph_class_t klass,
                                      hb_set_t *glyphs);

Since: 0.9.7

### hb_ot_layout_get_ligature_carets ()

    unsigned int
    hb_ot_layout_get_ligature_carets (hb_font_t *font,
                                      hb_direction_t direction,
                                      hb_codepoint_t glyph,
                                      unsigned int start_offset,
                                      unsigned int *caret_count,
                                      hb_position_t *caret_array);

### hb_ot_layout_get_size_params ()

    hb_bool_t
    hb_ot_layout_get_size_params (hb_face_t *face,
                                  unsigned int *design_size,
                                  unsigned int *subfamily_id,
                                  hb_ot_name_id_t *subfamily_name_id,
                                  unsigned int *range_start,
                                  unsigned int *range_end);

Since: 0.9.10

### hb_ot_layout_glyph_sequence_func_t ()

    hb_bool_t
    (*hb_ot_layout_glyph_sequence_func_t) (hb_font_t *font,
                                           hb_tag_t table_tag,
                                           unsigned int lookup_index,
                                           const hb_ot_layout_glyph_sequence_t *sequence,
                                           void *user_data);

### hb_ot_layout_has_glyph_classes ()

    hb_bool_t
    hb_ot_layout_has_glyph_classes (hb_face_t *face);

### hb_ot_layout_has_positioning ()

    hb_bool_t
    hb_ot_layout_has_positioning (hb_face_t *face);

### hb_ot_layout_has_substitution ()

    hb_bool_t
    hb_ot_layout_has_substitution (hb_face_t *face);

### hb_ot_layout_language_find_feature ()

    hb_bool_t
    hb_ot_layout_language_find_feature (hb_face_t *face,
                                        hb_tag_t table_tag,
                                        unsigned int script_index,
                                        unsigned int language_index,
                                        hb_tag_t feature_tag,
                                        unsigned int *feature_index);

### hb_ot_layout_language_get_feature_indexes ()

    unsigned int
    hb_ot_layout_language_get_feature_indexes
                                   (hb_face_t *face,
                                    hb_tag_t table_tag,
                                    unsigned int script_index,
                                    unsigned int language_index,
                                    unsigned int start_offset,
                                    unsigned int *feature_count,
                                    unsigned int *feature_indexes);

### hb_ot_layout_language_get_feature_tags ()

    unsigned int
    hb_ot_layout_language_get_feature_tags
                                   (hb_face_t *face,
                                    hb_tag_t table_tag,
                                    unsigned int script_index,
                                    unsigned int language_index,
                                    unsigned int start_offset,
                                    unsigned int *feature_count,
                                    hb_tag_t *feature_tags);

### hb_ot_layout_language_get_required_feature ()

    hb_bool_t
    hb_ot_layout_language_get_required_feature
                                   (hb_face_t *face,
                                    hb_tag_t table_tag,
                                    unsigned int script_index,
                                    unsigned int language_index,
                                    unsigned int *feature_index,
                                    hb_tag_t *feature_tag);

Since: 0.9.30

### hb_ot_layout_lookup_collect_glyphs ()

    void
    hb_ot_layout_lookup_collect_glyphs (hb_face_t *face,
                                        hb_tag_t table_tag,
                                        unsigned int lookup_index,
                                        hb_set_t *glyphs_before,
                                        hb_set_t *glyphs_input,
                                        hb_set_t *glyphs_after,
                                        hb_set_t *glyphs_output);

Since: 0.9.7

### hb_ot_layout_lookup_substitute_closure ()

    void
    hb_ot_layout_lookup_substitute_closure
                                   (hb_face_t *face,
                                    unsigned int lookup_index,
                                    hb_set_t *glyphs);

Since: 0.9.7

### hb_ot_layout_lookups_substitute_closure ()

    void
    hb_ot_layout_lookups_substitute_closure
                                   (hb_face_t *face,
                                    const hb_set_t *lookups,
                                    hb_set_t *glyphs);

Compute the transitive closure of glyphs needed for all of the provided lookups.

Since: 1.8.1

### hb_ot_layout_lookup_would_substitute ()

    hb_bool_t
    hb_ot_layout_lookup_would_substitute (hb_face_t *face,
                                          unsigned int lookup_index,
                                          const hb_codepoint_t *glyphs,
                                          unsigned int glyphs_length,
                                          hb_bool_t zero_context);

Since: 0.9.7

### hb_ot_layout_script_get_language_tags ()

    unsigned int
    hb_ot_layout_script_get_language_tags (hb_face_t *face,
                                           hb_tag_t table_tag,
                                           unsigned int script_index,
                                           unsigned int start_offset,
                                           unsigned int *language_count,
                                           hb_tag_t *language_tags);

### hb_ot_layout_script_select_language ()

    hb_bool_t
    hb_ot_layout_script_select_language (hb_face_t *face,
                                         hb_tag_t table_tag,
                                         unsigned int script_index,
                                         unsigned int language_count,
                                         const hb_tag_t *language_tags,
                                         unsigned int *language_index);

Since: 2.0.0

### hb_ot_layout_table_find_feature_variations ()

    hb_bool_t
    hb_ot_layout_table_find_feature_variations
                                   (hb_face_t *face,
                                    hb_tag_t table_tag,
                                    const int *coords,
                                    unsigned int num_coords,
                                    unsigned int *variations_index);

### hb_ot_layout_table_get_feature_tags ()

    unsigned int
    hb_ot_layout_table_get_feature_tags (hb_face_t *face,
                                         hb_tag_t table_tag,
                                         unsigned int start_offset,
                                         unsigned int *feature_count,
                                         hb_tag_t *feature_tags);

### hb_ot_layout_table_get_script_tags ()

    unsigned int
    hb_ot_layout_table_get_script_tags (hb_face_t *face,
                                        hb_tag_t table_tag,
                                        unsigned int start_offset,
                                        unsigned int *script_count,
                                        hb_tag_t *script_tags);

### hb_ot_layout_table_get_lookup_count ()

    unsigned int
    hb_ot_layout_table_get_lookup_count (hb_face_t *face,
                                         hb_tag_t table_tag);

Since: 0.9.22

### hb_ot_layout_table_select_script ()

    hb_bool_t
    hb_ot_layout_table_select_script (hb_face_t *face,
                                      hb_tag_t table_tag,
                                      unsigned int script_count,
                                      const hb_tag_t *script_tags,
                                      unsigned int *script_index,
                                      hb_tag_t *chosen_script);

Since: 2.0.0

### hb_ot_shape_plan_collect_lookups ()

    void
    hb_ot_shape_plan_collect_lookups (hb_shape_plan_t *shape_plan,
                                      hb_tag_t table_tag,
                                      hb_set_t *lookup_indexes);

Since: 0.9.7

### hb_ot_layout_language_get_required_feature_index ()

    hb_bool_t
    hb_ot_layout_language_get_required_feature_index
                                   (hb_face_t *face,
                                    hb_tag_t table_tag,
                                    unsigned int script_index,
                                    unsigned int language_index,
                                    unsigned int *feature_index);

## Types and Values

### HB_OT_MAX_TAGS_PER_LANGUAGE

    #define HB_OT_MAX_TAGS_PER_LANGUAGE 3u

Since: 2.0.0

### HB_OT_MAX_TAGS_PER_SCRIPT

    #define HB_OT_MAX_TAGS_PER_SCRIPT 3u

Since: 2.0.0

### HB_OT_TAG_DEFAULT_LANGUAGE

    #define HB_OT_TAG_DEFAULT_LANGUAGE HB_TAG ('d', 'f', 'l', 't')

### HB_OT_TAG_DEFAULT_SCRIPT

    #define HB_OT_TAG_DEFAULT_SCRIPT HB_TAG ('D', 'F', 'L', 'T')

### HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX

    #define HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX 0xFFFFu

### HB_OT_LAYOUT_NO_FEATURE_INDEX

    #define HB_OT_LAYOUT_NO_FEATURE_INDEX		0xFFFFu

### HB_OT_LAYOUT_NO_SCRIPT_INDEX

    #define HB_OT_LAYOUT_NO_SCRIPT_INDEX		0xFFFFu

### HB_OT_LAYOUT_NO_VARIATIONS_INDEX

    #define HB_OT_LAYOUT_NO_VARIATIONS_INDEX 0xFFFFFFFFu

### HB_OT_TAG_BASE

    #define HB_OT_TAG_BASE HB_TAG('B','A','S','E')

### HB_OT_TAG_GDEF

    #define HB_OT_TAG_GDEF HB_TAG('G','D','E','F')

### HB_OT_TAG_GPOS

    #define HB_OT_TAG_GPOS HB_TAG('G','P','O','S')

### HB_OT_TAG_GSUB

    #define HB_OT_TAG_GSUB HB_TAG('G','S','U','B')

### HB_OT_TAG_JSTF

    #define HB_OT_TAG_JSTF HB_TAG('J','S','T','F')

### enum hb_ot_layout_glyph_class_t

#### Members

HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED |  |
HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH |  |
HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE |  |
HB_OT_LAYOUT_GLYPH_CLASS_MARK |  |
HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT |  |