[HarfBuzz] harfbuzz: Branch 'master' - 6 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Tue Aug 12 14:16:07 PDT 2014


 src/hb-private.hh    |    9 ++++++++
 src/hb-shape-plan.cc |   53 +++++++++++++++++++++++++++++++++++++++------------
 2 files changed, 50 insertions(+), 12 deletions(-)

New commits:
commit 30eed75de24ac0b6648a72d98d10bb24a563d7ef
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Aug 12 17:15:09 2014 -0400

    [shape-plan] Fix typo!
    
    The only effect is, if shaper_list was not NULL and no shaper was found,
    we now don't insert anything into cache and return earlier.

diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc
index e5ccc16..2166173 100644
--- a/src/hb-shape-plan.cc
+++ b/src/hb-shape-plan.cc
@@ -435,7 +435,7 @@ hb_shape_plan_create_cached (hb_face_t                     *face,
 #include "hb-shaper-list.hh"
 #undef HB_SHAPER_IMPLEMENT
 
-    if (unlikely (!proposal.shaper_list))
+    if (unlikely (!proposal.shaper_func))
       return hb_shape_plan_get_empty ();
   }
 
commit dc9aba6fc53898acd7281b118cec0355d61b1df2
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Aug 12 17:14:36 2014 -0400

    [shape-plan] Better debug messages

diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc
index 32658f3..e5ccc16 100644
--- a/src/hb-shape-plan.cc
+++ b/src/hb-shape-plan.cc
@@ -115,8 +115,9 @@ hb_shape_plan_create (hb_face_t                     *face,
 		      unsigned int                   num_user_features,
 		      const char * const            *shaper_list)
 {
-  DEBUG_MSG_FUNC (SHAPE_PLAN, face,
-		  "num_features=%d shaper_list=%p",
+  DEBUG_MSG_FUNC (SHAPE_PLAN, NULL,
+		  "face=%p num_features=%d shaper_list=%p",
+		  face,
 		  num_user_features,
 		  shaper_list);
 
@@ -404,8 +405,9 @@ hb_shape_plan_create_cached (hb_face_t                     *face,
 			     unsigned int                   num_user_features,
 			     const char * const            *shaper_list)
 {
-  DEBUG_MSG_FUNC (SHAPE_PLAN, face,
-		  "num_user_features=%d shaper_list=%p",
+  DEBUG_MSG_FUNC (SHAPE_PLAN, NULL,
+		  "face=%p num_features=%d shaper_list=%p",
+		  face,
 		  num_user_features,
 		  shaper_list);
 
@@ -442,7 +444,10 @@ retry:
   hb_face_t::plan_node_t *cached_plan_nodes = (hb_face_t::plan_node_t *) hb_atomic_ptr_get (&face->shape_plans);
   for (hb_face_t::plan_node_t *node = cached_plan_nodes; node; node = node->next)
     if (hb_shape_plan_matches (node->shape_plan, &proposal))
+    {
+      DEBUG_MSG_FUNC (SHAPE_PLAN, node->shape_plan, "fulfilled from cache");
       return hb_shape_plan_reference (node->shape_plan);
+    }
 
   /* Not found. */
 
@@ -465,6 +470,7 @@ retry:
     free (node);
     goto retry;
   }
+  DEBUG_MSG_FUNC (SHAPE_PLAN, shape_plan, "inserted into cache");
 
   return hb_shape_plan_reference (shape_plan);
 }
commit e956c65bf724a8403471362288d2361361b6ac58
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Aug 12 17:03:27 2014 -0400

    [shape-plan] Simplify macro

diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc
index 23beda1..32658f3 100644
--- a/src/hb-shape-plan.cc
+++ b/src/hb-shape-plan.cc
@@ -418,27 +418,21 @@ hb_shape_plan_create_cached (hb_face_t                     *face,
   };
 
   if (shaper_list) {
-    /* Choose shaper.  Adapted from hb_shape_plan_plan(). */
-#define HB_SHAPER_PLAN(shaper) \
-	  { \
-	    if (hb_##shaper##_shaper_face_data_ensure (face)) \
-	    { \
-	      proposal.shaper_func = _hb_##shaper##_shape; \
-	      break; \
-	    } \
-	  }
-
+    /* Choose shaper.  Adapted from hb_shape_plan_plan().
+     * Must choose shaper exactly the same way as that function. */
     for (const char * const *shaper_item = shaper_list; *shaper_item; shaper_item++)
       if (0)
 	;
 #define HB_SHAPER_IMPLEMENT(shaper) \
-      else if (0 == strcmp (*shaper_item, #shaper)) \
-	HB_SHAPER_PLAN (shaper)
+      else if (0 == strcmp (*shaper_item, #shaper) && \
+	       hb_##shaper##_shaper_face_data_ensure (face)) \
+      { \
+	proposal.shaper_func = _hb_##shaper##_shape; \
+	break; \
+      }
 #include "hb-shaper-list.hh"
 #undef HB_SHAPER_IMPLEMENT
 
-#undef HB_SHAPER_PLAN
-
     if (unlikely (!proposal.shaper_list))
       return hb_shape_plan_get_empty ();
   }
commit 29e25550ce8fee3fecc42d20a45ce9c212dc59df
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Aug 12 17:02:59 2014 -0400

    Fix gcc warning

diff --git a/src/hb-private.hh b/src/hb-private.hh
index ab18274..80fd6c4 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -628,6 +628,15 @@ _hb_debug_msg_va (const char *what,
 		  unsigned int level,
 		  int level_dir,
 		  const char *message,
+		  va_list ap) HB_PRINTF_FUNC(7, 0);
+template <int max_level> static inline void
+_hb_debug_msg_va (const char *what,
+		  const void *obj,
+		  const char *func,
+		  bool indented,
+		  unsigned int level,
+		  int level_dir,
+		  const char *message,
 		  va_list ap)
 {
   if (!_hb_debug (level, max_level))
commit 8d5eebc0c6ada01128c6ee384340efdbef7ba29d
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Aug 12 16:50:22 2014 -0400

    [shape-plan] Fix shape-plan caching with more than one requested shaper
    
    Wasn't breaking out of loop, ouch!
    
    http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1246370.html

diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc
index fa0db6a..23beda1 100644
--- a/src/hb-shape-plan.cc
+++ b/src/hb-shape-plan.cc
@@ -420,17 +420,20 @@ hb_shape_plan_create_cached (hb_face_t                     *face,
   if (shaper_list) {
     /* Choose shaper.  Adapted from hb_shape_plan_plan(). */
 #define HB_SHAPER_PLAN(shaper) \
-	  HB_STMT_START { \
+	  { \
 	    if (hb_##shaper##_shaper_face_data_ensure (face)) \
+	    { \
 	      proposal.shaper_func = _hb_##shaper##_shape; \
-	  } HB_STMT_END
+	      break; \
+	    } \
+	  }
 
     for (const char * const *shaper_item = shaper_list; *shaper_item; shaper_item++)
       if (0)
 	;
 #define HB_SHAPER_IMPLEMENT(shaper) \
       else if (0 == strcmp (*shaper_item, #shaper)) \
-	HB_SHAPER_PLAN (shaper);
+	HB_SHAPER_PLAN (shaper)
 #include "hb-shaper-list.hh"
 #undef HB_SHAPER_IMPLEMENT
 
commit bc3d0dc60104f1cda465a5e8ba5b40ed5bec70b9
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Aug 12 16:49:18 2014 -0400

    [shape-plan] Add debug tracing

diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc
index 5ffc6b1..fa0db6a 100644
--- a/src/hb-shape-plan.cc
+++ b/src/hb-shape-plan.cc
@@ -29,6 +29,12 @@
 #include "hb-font-private.hh"
 #include "hb-buffer-private.hh"
 
+
+#ifndef HB_DEBUG_SHAPE_PLAN
+#define HB_DEBUG_SHAPE_PLAN (HB_DEBUG+0)
+#endif
+
+
 #define HB_SHAPER_IMPLEMENT(shaper) \
 	HB_SHAPER_DATA_ENSURE_DECLARE(shaper, face) \
 	HB_SHAPER_DATA_ENSURE_DECLARE(shaper, font)
@@ -42,6 +48,11 @@ hb_shape_plan_plan (hb_shape_plan_t    *shape_plan,
 		    unsigned int        num_user_features,
 		    const char * const *shaper_list)
 {
+  DEBUG_MSG_FUNC (SHAPE_PLAN, shape_plan,
+		  "num_features=%d shaper_list=%p",
+		  num_user_features,
+		  shaper_list);
+
   const hb_shaper_pair_t *shapers = _hb_shapers_get ();
 
 #define HB_SHAPER_PLAN(shaper) \
@@ -104,6 +115,11 @@ hb_shape_plan_create (hb_face_t                     *face,
 		      unsigned int                   num_user_features,
 		      const char * const            *shaper_list)
 {
+  DEBUG_MSG_FUNC (SHAPE_PLAN, face,
+		  "num_features=%d shaper_list=%p",
+		  num_user_features,
+		  shaper_list);
+
   hb_shape_plan_t *shape_plan;
   hb_feature_t *features = NULL;
 
@@ -271,6 +287,11 @@ hb_shape_plan_execute (hb_shape_plan_t    *shape_plan,
 		       const hb_feature_t *features,
 		       unsigned int        num_features)
 {
+  DEBUG_MSG_FUNC (SHAPE_PLAN, shape_plan,
+		  "num_features=%d shaper_func=%p",
+		  num_features,
+		  shape_plan->shaper_func);
+
   if (unlikely (hb_object_is_inert (shape_plan) ||
 		hb_object_is_inert (font) ||
 		hb_object_is_inert (buffer)))
@@ -383,6 +404,11 @@ hb_shape_plan_create_cached (hb_face_t                     *face,
 			     unsigned int                   num_user_features,
 			     const char * const            *shaper_list)
 {
+  DEBUG_MSG_FUNC (SHAPE_PLAN, face,
+		  "num_user_features=%d shaper_list=%p",
+		  num_user_features,
+		  shaper_list);
+
   hb_shape_plan_proposal_t proposal = {
     *props,
     shaper_list,


More information about the HarfBuzz mailing list