[buffer] Add hb_buffer_has_positions()

Fixes https://github.com/harfbuzz/harfbuzz/issues/2716
This commit is contained in:
Behdad Esfahbod 2020-10-15 00:20:17 -06:00
parent 97a093c52f
commit 3232e6f2a9
3 changed files with 24 additions and 1 deletions

View File

@ -80,6 +80,7 @@ hb_buffer_set_user_data
hb_buffer_get_user_data hb_buffer_get_user_data
hb_buffer_get_glyph_infos hb_buffer_get_glyph_infos
hb_buffer_get_glyph_positions hb_buffer_get_glyph_positions
hb_buffer_has_positions
hb_buffer_get_invisible_glyph hb_buffer_get_invisible_glyph
hb_buffer_set_invisible_glyph hb_buffer_set_invisible_glyph
hb_buffer_set_replacement_codepoint hb_buffer_set_replacement_codepoint

View File

@ -50,7 +50,7 @@
* Checks the equality of two #hb_segment_properties_t's. * Checks the equality of two #hb_segment_properties_t's.
* *
* Return value: * Return value:
* %true if all properties of @a equal those of @b, false otherwise. * %true if all properties of @a equal those of @b, %false otherwise.
* *
* Since: 0.9.7 * Since: 0.9.7
**/ **/
@ -1404,6 +1404,25 @@ hb_buffer_get_glyph_positions (hb_buffer_t *buffer,
return (hb_glyph_position_t *) buffer->pos; return (hb_glyph_position_t *) buffer->pos;
} }
/**
* hb_buffer_has_positions:
* @buffer: an #hb_buffer_t.
*
* Returns whether @buffer has glyph position data.
* A buffer gains position data when hb_buffer_get_glyph_positions() is called on it,
* and cleared of position data when hb_buffer_clear_contents() is called.
*
* Return value:
* %true if the @buffer has position array, %false otherwise.
*
* Since: REPLACEME
**/
HB_EXTERN hb_bool_t
hb_buffer_has_positions (hb_buffer_t *buffer)
{
return buffer->have_positions;
}
/** /**
* hb_glyph_info_get_glyph_flags: * hb_glyph_info_get_glyph_flags:
* @info: a #hb_glyph_info_t. * @info: a #hb_glyph_info_t.

View File

@ -447,6 +447,9 @@ HB_EXTERN hb_glyph_position_t *
hb_buffer_get_glyph_positions (hb_buffer_t *buffer, hb_buffer_get_glyph_positions (hb_buffer_t *buffer,
unsigned int *length); unsigned int *length);
HB_EXTERN hb_bool_t
hb_buffer_has_positions (hb_buffer_t *buffer);
HB_EXTERN void HB_EXTERN void
hb_buffer_normalize_glyphs (hb_buffer_t *buffer); hb_buffer_normalize_glyphs (hb_buffer_t *buffer);