From b2dd0c1c32ba30714355baca1857d64c1608b4c2 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 23 Aug 2017 13:12:54 -0700 Subject: [PATCH] Add hb_glyph_info_get_glyph_flags() New API. --- src/hb-buffer.cc | 17 +++++++++++++++++ src/hb-buffer.h | 9 ++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index 0c175a38..a25a2cb6 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -1411,6 +1411,23 @@ hb_buffer_get_glyph_positions (hb_buffer_t *buffer, return (hb_glyph_position_t *) buffer->pos; } +/** + * hb_glyph_info_get_glyph_flags: + * @buffer: a #hb_glyph_info_t. + * + * Returns glyph flags encoded within a #hb_glyph_info_t. + * + * Return value: + * The #hb_glyph_flags_t encoded within @info. + * + * Since: 1.5.0 + **/ +hb_glyph_flags_t +(hb_glyph_info_get_glyph_flags) (const hb_glyph_info_t *info) +{ + return hb_glyph_info_get_glyph_flags (info); +} + /** * hb_buffer_reverse: * @buffer: an #hb_buffer_t. diff --git a/src/hb-buffer.h b/src/hb-buffer.h index 9f5943ec..ffbf66ee 100644 --- a/src/hb-buffer.h +++ b/src/hb-buffer.h @@ -63,7 +63,7 @@ HB_BEGIN_DECLS */ typedef struct hb_glyph_info_t { hb_codepoint_t codepoint; - hb_mask_t mask; /* Holds hb_glyph_flags_t after hb_shape() */ + hb_mask_t mask; /* Holds hb_glyph_flags_t after hb_shape(), plus other things. */ uint32_t cluster; /*< private >*/ @@ -77,6 +77,13 @@ typedef enum { /*< flags >*/ HB_GLYPH_FLAG_DEFINED = 0x00000001 /* OR of all defined flags */ } hb_glyph_flags_t; +HB_EXTERN hb_glyph_flags_t +hb_glyph_info_get_glyph_flags (const hb_glyph_info_t *info); + +#define hb_glyph_info_get_glyph_flags(info) \ + ((hb_glyph_flags_t) ((unsigned int) (info)->mask & HB_GLYPH_FLAG_DEFINED)) + + /** * hb_glyph_position_t: * @x_advance: how much the line advances after drawing this glyph when setting -- GitLab