aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2018-10-19 19:12:33 -0700
committerBehdad Esfahbod <behdad@behdad.org>2018-10-19 19:12:33 -0700
commit08b7172969b442cc83b47f44e685a0495b2d8cd4 (patch)
treeb17b6b539f473b2c76eed529ea2432227e2bd2be
parent77d5c3df07bec8e9d2dd57f89d5810b768bdc4f5 (diff)
downloadharfbuzz_ng-08b7172969b442cc83b47f44e685a0495b2d8cd4.tar.gz
[font] Fix parallel funcs passing to eachover in infinite-loop
Fixes test just added.
-rw-r--r--src/hb-font.cc20
-rw-r--r--src/hb-font.hh8
2 files changed, 21 insertions, 7 deletions
diff --git a/src/hb-font.cc b/src/hb-font.cc
index 7a430237c..b6b668dd8 100644
--- a/src/hb-font.cc
+++ b/src/hb-font.cc
@@ -103,7 +103,7 @@ hb_font_get_nominal_glyph_default (hb_font_t *font,
hb_codepoint_t *glyph,
void *user_data HB_UNUSED)
{
- if (font->has_nominal_glyphs_func ())
+ if (font->has_nominal_glyphs_func_set ())
{
return font->get_nominal_glyphs (1, &unicode, 0, glyph, 0);
}
@@ -121,7 +121,7 @@ hb_font_get_nominal_glyphs_default (hb_font_t *font,
unsigned int glyph_stride,
void *user_data HB_UNUSED)
{
- if (font->has_nominal_glyph_func ())
+ if (font->has_nominal_glyph_func_set ())
{
for (unsigned int i = 0; i < count; i++)
{
@@ -176,7 +176,7 @@ hb_font_get_glyph_h_advance_default (hb_font_t *font,
hb_codepoint_t glyph,
void *user_data HB_UNUSED)
{
- if (font->has_glyph_h_advances_func ())
+ if (font->has_glyph_h_advances_func_set ())
{
hb_position_t ret;
font->get_glyph_h_advances (1, &glyph, 0, &ret, 0);
@@ -200,7 +200,7 @@ hb_font_get_glyph_v_advance_default (hb_font_t *font,
hb_codepoint_t glyph,
void *user_data HB_UNUSED)
{
- if (font->has_glyph_v_advances_func ())
+ if (font->has_glyph_v_advances_func_set ())
{
hb_position_t ret;
font->get_glyph_v_advances (1, &glyph, 0, &ret, 0);
@@ -220,7 +220,7 @@ hb_font_get_glyph_h_advances_default (hb_font_t* font,
unsigned int advance_stride,
void *user_data HB_UNUSED)
{
- if (font->has_glyph_h_advance_func ())
+ if (font->has_glyph_h_advance_func_set ())
{
for (unsigned int i = 0; i < count; i++)
{
@@ -252,7 +252,7 @@ hb_font_get_glyph_v_advances_default (hb_font_t* font,
unsigned int advance_stride,
void *user_data HB_UNUSED)
{
- if (font->has_glyph_v_advance_func ())
+ if (font->has_glyph_v_advance_func_set ())
{
for (unsigned int i = 0; i < count; i++)
{
@@ -688,9 +688,15 @@ HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT
bool
+hb_font_t::has_func_set (unsigned int i)
+{
+ return this->klass->get.array[i] != _hb_font_funcs_default.get.array[i];
+}
+
+bool
hb_font_t::has_func (unsigned int i)
{
- return (this->klass->get.array[i] != _hb_font_funcs_default.get.array[i]) ||
+ return has_func_set (i) ||
(parent && parent != &_hb_Null_hb_font_t && parent->has_func (i));
}
diff --git a/src/hb-font.hh b/src/hb-font.hh
index e10d56745..2df5e42ee 100644
--- a/src/hb-font.hh
+++ b/src/hb-font.hh
@@ -171,6 +171,7 @@ struct hb_font_t
/* Public getters */
HB_INTERNAL bool has_func (unsigned int i);
+ HB_INTERNAL bool has_func_set (unsigned int i);
/* has_* ... */
#define HB_FONT_FUNC_IMPLEMENT(name) \
@@ -180,6 +181,13 @@ struct hb_font_t
hb_font_funcs_t *funcs = this->klass; \
unsigned int i = offsetof (hb_font_funcs_t::get_t::get_funcs_t, name) / sizeof (funcs->get.array[0]); \
return has_func (i); \
+ } \
+ bool \
+ has_##name##_func_set (void) \
+ { \
+ hb_font_funcs_t *funcs = this->klass; \
+ unsigned int i = offsetof (hb_font_funcs_t::get_t::get_funcs_t, name) / sizeof (funcs->get.array[0]); \
+ return has_func_set (i); \
}
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT