[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Sat Oct 20 02:13:04 UTC 2018


 src/hb-font.cc |   20 +++++++++++++-------
 src/hb-font.hh |    8 ++++++++
 2 files changed, 21 insertions(+), 7 deletions(-)

New commits:
commit 08b7172969b442cc83b47f44e685a0495b2d8cd4
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Oct 19 19:12:33 2018 -0700

    [font] Fix parallel funcs passing to eachover in infinite-loop
    
    Fixes test just added.

diff --git a/src/hb-font.cc b/src/hb-font.cc
index 7a430237..b6b668dd 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 e10d5674..2df5e42e 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


More information about the HarfBuzz mailing list