## hb-buffer hb-buffer |

## Functions

void | hb_buffer_add ()
void | hb_buffer_add_utf16 ()
void | hb_buffer_add_utf32 ()
void | hb_buffer_add_utf8 ()
hb_bool_t | hb_buffer_allocation_successful ()
void | hb_buffer_clear_contents ()
hb_buffer_t * | hb_buffer_create ()
hb_bool_t | hb_buffer_deserialize_glyphs ()
void | hb_buffer_destroy ()
hb_buffer_content_type_t | hb_buffer_get_content_type ()
hb_direction_t | hb_buffer_get_direction ()
hb_buffer_t * | hb_buffer_get_empty ()
hb_buffer_flags_t | hb_buffer_get_flags ()
hb_glyph_info_t * | hb_buffer_get_glyph_infos ()
hb_glyph_position_t * | hb_buffer_get_glyph_positions ()
hb_language_t | hb_buffer_get_language ()
unsigned int | hb_buffer_get_length ()
hb_script_t | hb_buffer_get_script ()
void | hb_buffer_get_segment_properties ()
hb_unicode_funcs_t * | hb_buffer_get_unicode_funcs ()
void * | hb_buffer_get_user_data ()
void | hb_buffer_guess_segment_properties ()
void | hb_buffer_normalize_glyphs ()
hb_bool_t | hb_buffer_pre_allocate ()
hb_buffer_t * | hb_buffer_reference ()
void | hb_buffer_reset ()
void | hb_buffer_reverse ()
void | hb_buffer_reverse_clusters ()
hb_buffer_serialize_format_t | hb_buffer_serialize_format_from_string ()
const char * | hb_buffer_serialize_format_to_string ()
unsigned int | hb_buffer_serialize_glyphs ()
const char ** | hb_buffer_serialize_list_formats ()
void | hb_buffer_set_content_type ()
void | hb_buffer_set_direction ()
void | hb_buffer_set_flags ()
void | hb_buffer_set_language ()
hb_bool_t | hb_buffer_set_length ()
void | hb_buffer_set_script ()
void | hb_buffer_set_segment_properties ()
void | hb_buffer_set_unicode_funcs ()
hb_bool_t | hb_buffer_set_user_data ()
hb_bool_t | hb_segment_properties_equal ()
unsigned int | hb_segment_properties_hash ()

## Types and Values

#define | HB_SEGMENT_PROPERTIES_DEFAULT
enum | hb_buffer_content_type_t
enum | hb_buffer_flags_t
enum | hb_buffer_serialize_flags_t
enum | hb_buffer_serialize_format_t
typedef | hb_buffer_t
| hb_glyph_info_t
| hb_glyph_position_t
| hb_segment_properties_t

## Description

## Functions

### hb_buffer_add ()

    void
    hb_buffer_add (hb_buffer_t *buffer,
                   hb_codepoint_t codepoint,
                   unsigned int cluster);

#### Parameters

buffer | a buffer. |

Since 1.0

### hb_buffer_add_utf16 ()

    void
    hb_buffer_add_utf16 (hb_buffer_t *buffer,
                         const uint16_t *text,
                         int text_length,
                         unsigned int item_offset,
                         int item_length);

#### Parameters

buffer | a buffer. |
text | . | [array length=text_length]

Since 1.0

### hb_buffer_add_utf32 ()

    void
    hb_buffer_add_utf32 (hb_buffer_t *buffer,
                         const uint32_t *text,
                         int text_length,
                         unsigned int item_offset,
                         int item_length);

#### Parameters

buffer | a buffer. |
text | . | [array length=text_length]

Since 1.0

### hb_buffer_add_utf8 ()

    void
    hb_buffer_add_utf8 (hb_buffer_t *buffer,
                        const char *text,
                        int text_length,
                        unsigned int item_offset,
                        int item_length);

#### Parameters

buffer | a buffer. |
text | . | [array length=text_length]

Since 1.0

### hb_buffer_allocation_successful ()

    hb_bool_t
    hb_buffer_allocation_successful (hb_buffer_t *buffer);

#### Parameters

buffer | a buffer. |

#### Returns

Since 1.0

### hb_buffer_clear_contents ()

    void
    hb_buffer_clear_contents (hb_buffer_t *buffer);

#### Parameters

buffer | a buffer. |

Since 1.0

### hb_buffer_create ()

    hb_buffer_t *
    hb_buffer_create (void);

#### Returns

### hb_buffer_deserialize_glyphs ()

    hb_bool_t
    hb_buffer_deserialize_glyphs (hb_buffer_t *buffer,
                                  const char *buf,
                                  int buf_len,
                                  const char **end_ptr,
                                  hb_font_t *font,
                                  hb_buffer_serialize_format_t format);

#### Parameters

buffer | a buffer. |
buf | . | [array length=buf_len]
end_ptr | . | [out]

#### Returns

Since 1.0

### hb_buffer_destroy ()

    void
    hb_buffer_destroy (hb_buffer_t *buffer);

#### Parameters

buffer | a buffer. |

Since 1.0

### hb_buffer_get_content_type ()

    hb_buffer_content_type_t
    hb_buffer_get_content_type (hb_buffer_t *buffer);

#### Parameters

buffer | a buffer. |

#### Returns

Since 1.0

### hb_buffer_get_direction ()

    hb_direction_t
    hb_buffer_get_direction (hb_buffer_t *buffer);

#### Parameters

buffer | a buffer. |

#### Returns

Since 1.0

### hb_buffer_get_empty ()

    hb_buffer_t *
    hb_buffer_get_empty (void);

#### Returns

.

[transfer full]

Since 1.0

### hb_buffer_get_flags ()

    hb_buffer_flags_t
    hb_buffer_get_flags (hb_buffer_t *buffer);

#### Parameters

buffer | a buffer. |

#### Returns

Since 1.0

### hb_buffer_get_glyph_infos ()

    hb_glyph_info_t *
    hb_buffer_get_glyph_infos (hb_buffer_t *buffer,
                               unsigned int *length);

Returns buffer glyph information array. Returned pointer is valid as long as buffer contents are not modified.

#### Parameters

buffer | a buffer. |
length | output array length. | [out]

#### Returns

buffer glyph information array.

[transfer none][array length=length]

Since 1.0

### hb_buffer_get_glyph_positions ()

    hb_glyph_position_t *
    hb_buffer_get_glyph_positions (hb_buffer_t *buffer,
                                   unsigned int *length);

Returns buffer glyph position array. Returned pointer is valid as long as buffer contents are not modified.

#### Parameters

buffer | a buffer. |
length | output length. | [out]

#### Returns

buffer glyph position array.

[transfer none][array length=length]

Since 1.0

### hb_buffer_get_language ()

    hb_language_t
    hb_buffer_get_language (hb_buffer_t *buffer);

#### Parameters

buffer | a buffer. |

#### Returns

Since 1.0

### hb_buffer_get_length ()

    unsigned int
    hb_buffer_get_length (hb_buffer_t *buffer);

Returns the number of items in the buffer.

#### Parameters

buffer | a buffer. |

#### Returns

buffer length.

Since 1.0

### hb_buffer_get_script ()

    hb_script_t
    hb_buffer_get_script (hb_buffer_t *buffer);

#### Parameters

buffer | a buffer. |

#### Returns

Since 1.0

### hb_buffer_get_segment_properties ()

    void
    hb_buffer_get_segment_properties (hb_buffer_t *buffer,
                                      hb_segment_properties_t *props);

#### Parameters

buffer | a buffer. |

Since 1.0

### hb_buffer_get_unicode_funcs ()

    hb_unicode_funcs_t *
    hb_buffer_get_unicode_funcs (hb_buffer_t *buffer);

#### Parameters

buffer | a buffer. |

#### Returns

Since 1.0

### hb_buffer_get_user_data ()

    void *
    hb_buffer_get_user_data (hb_buffer_t *buffer,
                             hb_user_data_key_t *key);

#### Parameters

buffer | a buffer. |

#### Returns

Since 1.0

### hb_buffer_guess_segment_properties ()

    void
    hb_buffer_guess_segment_properties (hb_buffer_t *buffer);

Sets unset buffer segment properties based on buffer Unicode contents. If buffer is not empty, it must have content type `HB_BUFFER_CONTENT_TYPE_UNICODE`.

If buffer script is not set (ie. is `HB_SCRIPT_INVALID`), it will be set to the Unicode script of the first character in the buffer that has a script other than `HB_SCRIPT_COMMON`, `HB_SCRIPT_INHERITED`, and `HB_SCRIPT_UNKNOWN`.

Next, if buffer direction is not set (ie. is `HB_DIRECTION_INVALID`), it will be set to the natural horizontal direction of the buffer script as returned by `hb_script_get_horizontal_direction()`.

Finally, if buffer language is not set (ie. is `HB_LANGUAGE_INVALID`), it will be set to the process's default language as returned by `hb_language_get_default()`. This may change in the future by taking buffer script into consideration when choosing a language.

#### Parameters

buffer | a buffer. |

Since 1.0

### hb_buffer_normalize_glyphs ()

    void
    hb_buffer_normalize_glyphs (hb_buffer_t *buffer);

#### Parameters

buffer | a buffer. |

Since 1.0

### hb_buffer_pre_allocate ()

    hb_bool_t
    hb_buffer_pre_allocate (hb_buffer_t *buffer,
                            unsigned int size);

#### Parameters

buffer | a buffer. |

#### Returns

Since 1.0

### hb_buffer_reference ()

    hb_buffer_t *
    hb_buffer_reference (hb_buffer_t *buffer);

#### Parameters

buffer | a buffer. |

#### Returns

.

[transfer full]

Since 1.0

### hb_buffer_reset ()

    void
    hb_buffer_reset (hb_buffer_t *buffer);

#### Parameters

buffer | a buffer. |

Since 1.0

### hb_buffer_reverse ()

    void
    hb_buffer_reverse (hb_buffer_t *buffer);

Reverses buffer contents.

#### Parameters

buffer | a buffer. |

Since 1.0

### hb_buffer_reverse_clusters ()

    void
    hb_buffer_reverse_clusters (hb_buffer_t *buffer);

Reverses buffer clusters. That is, the buffer contents are reversed, then each cluster (consecutive items having the same cluster number) are reversed again.

#### Parameters

buffer | a buffer. |

Since 1.0

### hb_buffer_serialize_format_from_string ()

    hb_buffer_serialize_format_t
    hb_buffer_serialize_format_from_string
                                   (const char *str,
                                    int len);

#### Returns

Since 1.0

### hb_buffer_serialize_format_to_string ()

    const char *
    hb_buffer_serialize_format_to_string (hb_buffer_serialize_format_t format);

#### Returns

Since 1.0

### hb_buffer_serialize_glyphs ()

    unsigned int
    hb_buffer_serialize_glyphs (hb_buffer_t *buffer,
                                unsigned int start,
                                unsigned int end,
                                char *buf,
                                unsigned int buf_size,
                                unsigned int *buf_consumed,
                                hb_font_t *font,
                                hb_buffer_serialize_format_t format,
                                hb_buffer_serialize_flags_t flags);

#### Parameters

buffer | a buffer. |
buf | . | [array length=buf_size]
buf_consumed | . | [out]

#### Returns

Since 1.0

### hb_buffer_serialize_list_formats ()

    const char **
    hb_buffer_serialize_list_formats (void);

#### Returns

.

[transfer none]

Since 1.0

### hb_buffer_set_content_type ()

    void
    hb_buffer_set_content_type (hb_buffer_t *buffer,
                                hb_buffer_content_type_t content_type);

#### Parameters

buffer | a buffer. |

Since 1.0

### hb_buffer_set_direction ()

    void
    hb_buffer_set_direction (hb_buffer_t *buffer,
                             hb_direction_t direction);

#### Parameters

buffer | a buffer. |

Since 1.0

### hb_buffer_set_flags ()

    void
    hb_buffer_set_flags (hb_buffer_t *buffer,
                         hb_buffer_flags_t flags);

#### Parameters

buffer | a buffer. |

Since 1.0

### hb_buffer_set_language ()

    void
    hb_buffer_set_language (hb_buffer_t *buffer,
                            hb_language_t language);

#### Parameters

buffer | a buffer. |

Since 1.0

### hb_buffer_set_length ()

    hb_bool_t
    hb_buffer_set_length (hb_buffer_t *buffer,
                          unsigned int length);

#### Parameters

buffer | a buffer. |

#### Returns

Since 1.0

### hb_buffer_set_script ()

    void
    hb_buffer_set_script (hb_buffer_t *buffer,
                          hb_script_t script);

#### Parameters

buffer | a buffer. |

Since 1.0

### hb_buffer_set_segment_properties ()

    void
    hb_buffer_set_segment_properties (hb_buffer_t *buffer,
                                      const hb_segment_properties_t *props);

#### Parameters

buffer | a buffer. |

Since 1.0

### hb_buffer_set_unicode_funcs ()

    void
    hb_buffer_set_unicode_funcs (hb_buffer_t *buffer,
                                 hb_unicode_funcs_t *unicode_funcs);

#### Parameters

buffer | a buffer. |

Since 1.0

### hb_buffer_set_user_data ()

    hb_bool_t
    hb_buffer_set_user_data (hb_buffer_t *buffer,
                             hb_user_data_key_t *key,
                             void *data,
                             hb_destroy_func_t destroy,
                             hb_bool_t replace);

#### Parameters

buffer | a buffer. |

#### Returns

Since 1.0

### hb_segment_properties_equal ()

    hb_bool_t
    hb_segment_properties_equal (const hb_segment_properties_t *a,
                                 const hb_segment_properties_t *b);

#### Returns

### hb_segment_properties_hash ()

    unsigned int
    hb_segment_properties_hash (const hb_segment_properties_t *p);

#### Returns

## Types and Values

### HB_SEGMENT_PROPERTIES_DEFAULT

    #define             HB_SEGMENT_PROPERTIES_DEFAULT

### enum hb_buffer_content_type_t

#### Members

HB_BUFFER_CONTENT_TYPE_INVALID |  |
HB_BUFFER_CONTENT_TYPE_UNICODE |  |
HB_BUFFER_CONTENT_TYPE_GLYPHS |  |

### enum hb_buffer_flags_t

#### Members

HB_BUFFER_FLAG_DEFAULT |  |
HB_BUFFER_FLAG_BOT |  |
HB_BUFFER_FLAG_EOT |  |
HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES |  |

### enum hb_buffer_serialize_flags_t

#### Members

HB_BUFFER_SERIALIZE_FLAG_DEFAULT |  |
HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS |  |
HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS |  |
HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES |  |

### enum hb_buffer_serialize_format_t

#### Members

HB_BUFFER_SERIALIZE_FORMAT_TEXT |  |
HB_BUFFER_SERIALIZE_FORMAT_JSON |  |
HB_BUFFER_SERIALIZE_FORMAT_INVALID |  |

### hb_buffer_t

    typedef struct hb_buffer_t hb_buffer_t;

### hb_glyph_info_t

    typedef struct {
      hb_codepoint_t codepoint;
      hb_mask_t      mask;
      uint32_t       cluster;
    } hb_glyph_info_t;

### hb_glyph_position_t

    typedef struct {
      hb_position_t  x_advance;
      hb_position_t  y_advance;
      hb_position_t  x_offset;
      hb_position_t  y_offset;
    } hb_glyph_position_t;

### hb_segment_properties_t

    typedef struct {
      hb_direction_t  direction;
      hb_script_t     script;
      hb_language_t   language;
    } hb_segment_properties_t;