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

Behdad Esfahbod behdad at kemper.freedesktop.org
Mon Mar 11 11:29:19 PDT 2013


 src/hb-atomic-private.hh             |   14 ---
 src/hb-ft.cc                         |    9 -
 src/hb-open-type-private.hh          |    2 
 src/hb-ot-layout-gpos-table.hh       |  105 +++++++++++------------
 src/hb-ot-layout-gsub-table.hh       |  159 +++++++++++++++++------------------
 src/hb-ot-layout-gsubgpos-private.hh |   36 +++----
 src/hb-private.hh                    |    8 +
 7 files changed, 162 insertions(+), 171 deletions(-)

New commits:
commit 190e19e6842875c7a487c66235300ee6b42fb5da
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Mar 9 20:30:22 2013 -0500

    [ft] Remove TODO items that I'm not going to fix

diff --git a/src/hb-ft.cc b/src/hb-ft.cc
index 44b71d2..978230c 100644
--- a/src/hb-ft.cc
+++ b/src/hb-ft.cc
@@ -53,12 +53,7 @@
  *
  *   - We don't handle / allow for emboldening / obliqueing.
  *
- *   - Rounding, etc?
- *
- *   - In the future, we should add constructors to create fonts in font space.
- *
- *   - I believe transforms are not correctly implemented.  FreeType does not
- *     provide any API to get to the transform/delta set on the face. :(
+ *   - In the future, we should add constructors to create fonts in font space?
  *
  *   - FT_Load_Glyph() is exteremely costly.  Do something about it?
  */
commit 392ee97431b368ee74e1b521fd539b69d2efadfb
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Mar 9 20:27:55 2013 -0500

    [ft] Remove TODO item re FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH
    
    That flag is redundant, deprecated, and ignored since April 2011.
    From FreeType git log:
    
    commit 8c82ec5b17d0cfc9b0876a2d848acc207a62a25a
    Author: Behdad Esfahbod <behdad at behdad.org>
    Date:   Thu Apr 21 08:21:37 2011 +0200
    
        Always ignore global advance.
    
        This makes FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH redundant,
        deprecated, and ignored.  The new behavior is what every major user
        of FreeType has been requesting.  Global advance is broken in many
        CJK fonts.  Just ignoring it by default makes most sense.
    
        * src/truetype/ttdriver.c (tt_get_advances),
        src/truetype/ttgload.c (TT_Get_HMetrics, TT_Get_VMetrics,
        tt_get_metrics, compute_glyph_metrics, TT_Load_Glyph),
        src/truetype/ttgload.h: Implement it.
    
        * docs/CHANGES: Updated.

diff --git a/src/hb-ft.cc b/src/hb-ft.cc
index a25d5a4..44b71d2 100644
--- a/src/hb-ft.cc
+++ b/src/hb-ft.cc
@@ -60,8 +60,6 @@
  *   - I believe transforms are not correctly implemented.  FreeType does not
  *     provide any API to get to the transform/delta set on the face. :(
  *
- *   - Always use FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH?
- *
  *   - FT_Load_Glyph() is exteremely costly.  Do something about it?
  */
 
commit c5d91f39802078fc6f6de71940739ec4d04eca07
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Mar 9 04:34:21 2013 -0500

    Add hb_auto_array_t

diff --git a/src/hb-private.hh b/src/hb-private.hh
index 0f652ad..ff1e85d 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -376,6 +376,14 @@ struct hb_prealloced_array_t
   }
 };
 
+#define HB_AUTO_ARRAY_PREALLOCED 64
+template <typename Type>
+struct hb_auto_array_t : hb_prealloced_array_t <Type, HB_AUTO_ARRAY_PREALLOCED>
+{
+  hb_auto_array_t (void) { hb_prealloced_array_t<Type, HB_AUTO_ARRAY_PREALLOCED>::init (); }
+  ~hb_auto_array_t (void) { hb_prealloced_array_t<Type, HB_AUTO_ARRAY_PREALLOCED>::finish (); }
+};
+
 
 #define HB_LOCKABLE_SET_INIT {HB_PREALLOCED_ARRAY_INIT}
 template <typename item_t, typename lock_t>
commit ee5464d17fa4c59f5adaaa13dde70dd5264dbc64
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Mar 9 01:59:30 2013 -0500

    [OTLayout] Move code around

diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh
index 1fe3f6f..4413927 100644
--- a/src/hb-ot-layout-gpos-table.hh
+++ b/src/hb-ot-layout-gpos-table.hh
@@ -1434,22 +1434,6 @@ struct PosLookup : Lookup
   inline const PosLookupSubTable& get_subtable (unsigned int i) const
   { return this+CastR<OffsetArrayOf<PosLookupSubTable> > (subTable)[i]; }
 
-  template <typename context_t>
-  inline typename context_t::return_t dispatch (context_t *c) const
-  {
-    TRACE_DISPATCH (this);
-    unsigned int lookup_type = get_type ();
-    unsigned int count = get_subtable_count ();
-    for (unsigned int i = 0; i < count; i++) {
-      typename context_t::return_t r = get_subtable (i).dispatch (c, lookup_type);
-      if (c->stop_sublookup_iteration (r))
-        return TRACE_RETURN (r);
-    }
-    return TRACE_RETURN (c->default_return_value ());
-  }
-  template <typename context_t>
-  static inline typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index);
-
   inline hb_collect_glyphs_context_t::return_t collect_glyphs_lookup (hb_collect_glyphs_context_t *c) const
   {
     TRACE_COLLECT_GLYPHS (this);
@@ -1507,6 +1491,23 @@ struct PosLookup : Lookup
     return ret;
   }
 
+  template <typename context_t>
+  static inline typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index);
+
+  template <typename context_t>
+  inline typename context_t::return_t dispatch (context_t *c) const
+  {
+    TRACE_DISPATCH (this);
+    unsigned int lookup_type = get_type ();
+    unsigned int count = get_subtable_count ();
+    for (unsigned int i = 0; i < count; i++) {
+      typename context_t::return_t r = get_subtable (i).dispatch (c, lookup_type);
+      if (c->stop_sublookup_iteration (r))
+        return TRACE_RETURN (r);
+    }
+    return TRACE_RETURN (c->default_return_value ());
+  }
+
   inline bool sanitize (hb_sanitize_context_t *c) {
     TRACE_SANITIZE (this);
     if (unlikely (!Lookup::sanitize (c))) return TRACE_RETURN (false);
diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index 04ed309..35d0729 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -192,17 +192,6 @@ struct SingleSubstFormat2
 
 struct SingleSubst
 {
-  template <typename context_t>
-  inline typename context_t::return_t dispatch (context_t *c) const
-  {
-    TRACE_DISPATCH (this);
-    switch (u.format) {
-    case 1: return TRACE_RETURN (c->dispatch (u.format1));
-    case 2: return TRACE_RETURN (c->dispatch (u.format2));
-    default:return TRACE_RETURN (c->default_return_value ());
-    }
-  }
-
   inline bool serialize (hb_serialize_context_t *c,
 			 Supplier<GlyphID> &glyphs,
 			 Supplier<GlyphID> &substitutes,
@@ -230,6 +219,17 @@ struct SingleSubst
     }
   }
 
+  template <typename context_t>
+  inline typename context_t::return_t dispatch (context_t *c) const
+  {
+    TRACE_DISPATCH (this);
+    switch (u.format) {
+    case 1: return TRACE_RETURN (c->dispatch (u.format1));
+    case 2: return TRACE_RETURN (c->dispatch (u.format2));
+    default:return TRACE_RETURN (c->default_return_value ());
+    }
+  }
+
   inline bool sanitize (hb_sanitize_context_t *c) {
     TRACE_SANITIZE (this);
     if (!u.format.sanitize (c)) return TRACE_RETURN (false);
@@ -385,16 +385,6 @@ struct MultipleSubstFormat1
 
 struct MultipleSubst
 {
-  template <typename context_t>
-  inline typename context_t::return_t dispatch (context_t *c) const
-  {
-    TRACE_DISPATCH (this);
-    switch (u.format) {
-    case 1: return TRACE_RETURN (c->dispatch (u.format1));
-    default:return TRACE_RETURN (c->default_return_value ());
-    }
-  }
-
   inline bool serialize (hb_serialize_context_t *c,
 			 Supplier<GlyphID> &glyphs,
 			 Supplier<unsigned int> &substitute_len_list,
@@ -411,6 +401,16 @@ struct MultipleSubst
     }
   }
 
+  template <typename context_t>
+  inline typename context_t::return_t dispatch (context_t *c) const
+  {
+    TRACE_DISPATCH (this);
+    switch (u.format) {
+    case 1: return TRACE_RETURN (c->dispatch (u.format1));
+    default:return TRACE_RETURN (c->default_return_value ());
+    }
+  }
+
   inline bool sanitize (hb_sanitize_context_t *c) {
     TRACE_SANITIZE (this);
     if (!u.format.sanitize (c)) return TRACE_RETURN (false);
@@ -536,16 +536,6 @@ struct AlternateSubstFormat1
 
 struct AlternateSubst
 {
-  template <typename context_t>
-  inline typename context_t::return_t dispatch (context_t *c) const
-  {
-    TRACE_DISPATCH (this);
-    switch (u.format) {
-    case 1: return TRACE_RETURN (c->dispatch (u.format1));
-    default:return TRACE_RETURN (c->default_return_value ());
-    }
-  }
-
   inline bool serialize (hb_serialize_context_t *c,
 			 Supplier<GlyphID> &glyphs,
 			 Supplier<unsigned int> &alternate_len_list,
@@ -562,6 +552,16 @@ struct AlternateSubst
     }
   }
 
+  template <typename context_t>
+  inline typename context_t::return_t dispatch (context_t *c) const
+  {
+    TRACE_DISPATCH (this);
+    switch (u.format) {
+    case 1: return TRACE_RETURN (c->dispatch (u.format1));
+    default:return TRACE_RETURN (c->default_return_value ());
+    }
+  }
+
   inline bool sanitize (hb_sanitize_context_t *c) {
     TRACE_SANITIZE (this);
     if (!u.format.sanitize (c)) return TRACE_RETURN (false);
@@ -841,16 +841,6 @@ struct LigatureSubstFormat1
 
 struct LigatureSubst
 {
-  template <typename context_t>
-  inline typename context_t::return_t dispatch (context_t *c) const
-  {
-    TRACE_DISPATCH (this);
-    switch (u.format) {
-    case 1: return TRACE_RETURN (c->dispatch (u.format1));
-    default:return TRACE_RETURN (c->default_return_value ());
-    }
-  }
-
   inline bool serialize (hb_serialize_context_t *c,
 			 Supplier<GlyphID> &first_glyphs,
 			 Supplier<unsigned int> &ligature_per_first_glyph_count_list,
@@ -870,6 +860,16 @@ struct LigatureSubst
     }
   }
 
+  template <typename context_t>
+  inline typename context_t::return_t dispatch (context_t *c) const
+  {
+    TRACE_DISPATCH (this);
+    switch (u.format) {
+    case 1: return TRACE_RETURN (c->dispatch (u.format1));
+    default:return TRACE_RETURN (c->default_return_value ());
+    }
+  }
+
   inline bool sanitize (hb_sanitize_context_t *c) {
     TRACE_SANITIZE (this);
     if (!u.format.sanitize (c)) return TRACE_RETURN (false);
@@ -1138,22 +1138,6 @@ struct SubstLookup : Lookup
     return lookup_type_is_reverse (type);
   }
 
-  template <typename context_t>
-  inline typename context_t::return_t dispatch (context_t *c) const
-  {
-    TRACE_DISPATCH (this);
-    unsigned int lookup_type = get_type ();
-    unsigned int count = get_subtable_count ();
-    for (unsigned int i = 0; i < count; i++) {
-      typename context_t::return_t r = get_subtable (i).dispatch (c, lookup_type);
-      if (c->stop_sublookup_iteration (r))
-        return TRACE_RETURN (r);
-    }
-    return TRACE_RETURN (c->default_return_value ());
-  }
-  template <typename context_t>
-  static inline typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index);
-
   inline hb_closure_context_t::return_t closure (hb_closure_context_t *c) const
   {
     TRACE_CLOSURE (this);
@@ -1305,6 +1289,23 @@ struct SubstLookup : Lookup
 									 ligatures_list, component_count_list, component_list));
   }
 
+  template <typename context_t>
+  static inline typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index);
+
+  template <typename context_t>
+  inline typename context_t::return_t dispatch (context_t *c) const
+  {
+    TRACE_DISPATCH (this);
+    unsigned int lookup_type = get_type ();
+    unsigned int count = get_subtable_count ();
+    for (unsigned int i = 0; i < count; i++) {
+      typename context_t::return_t r = get_subtable (i).dispatch (c, lookup_type);
+      if (c->stop_sublookup_iteration (r))
+        return TRACE_RETURN (r);
+    }
+    return TRACE_RETURN (c->default_return_value ());
+  }
+
   inline bool sanitize (hb_sanitize_context_t *c)
   {
     TRACE_SANITIZE (this);
commit 9c5a9ee967120c8a968a1160c420e03620d46c24
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Mar 9 01:55:04 2013 -0500

    [OTLayout] Rename process() to dispatch()

diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index cec7bd6..cd1163e 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -182,7 +182,7 @@ struct hb_sanitize_context_t
   static const unsigned int max_debug_depth = HB_DEBUG_SANITIZE;
   typedef bool return_t;
   template <typename T>
-  inline return_t process (const T &obj) { return obj.sanitize (this); }
+  inline return_t dispatch (const T &obj) { return obj.sanitize (this); }
   static return_t default_return_value (void) { return true; }
   bool stop_sublookup_iteration (const return_t r HB_UNUSED) const { return false; }
 
diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh
index 44f1c64..1fe3f6f 100644
--- a/src/hb-ot-layout-gpos-table.hh
+++ b/src/hb-ot-layout-gpos-table.hh
@@ -519,12 +519,12 @@ struct SinglePosFormat2
 struct SinglePos
 {
   template <typename context_t>
-  inline typename context_t::return_t process (context_t *c) const
+  inline typename context_t::return_t dispatch (context_t *c) const
   {
-    TRACE_PROCESS (this);
+    TRACE_DISPATCH (this);
     switch (u.format) {
-    case 1: return TRACE_RETURN (c->process (u.format1));
-    case 2: return TRACE_RETURN (c->process (u.format2));
+    case 1: return TRACE_RETURN (c->dispatch (u.format1));
+    case 2: return TRACE_RETURN (c->dispatch (u.format2));
     default:return TRACE_RETURN (c->default_return_value ());
     }
   }
@@ -810,12 +810,12 @@ struct PairPosFormat2
 struct PairPos
 {
   template <typename context_t>
-  inline typename context_t::return_t process (context_t *c) const
+  inline typename context_t::return_t dispatch (context_t *c) const
   {
-    TRACE_PROCESS (this);
+    TRACE_DISPATCH (this);
     switch (u.format) {
-    case 1: return TRACE_RETURN (c->process (u.format1));
-    case 2: return TRACE_RETURN (c->process (u.format2));
+    case 1: return TRACE_RETURN (c->dispatch (u.format1));
+    case 2: return TRACE_RETURN (c->dispatch (u.format2));
     default:return TRACE_RETURN (c->default_return_value ());
     }
   }
@@ -976,11 +976,11 @@ struct CursivePosFormat1
 struct CursivePos
 {
   template <typename context_t>
-  inline typename context_t::return_t process (context_t *c) const
+  inline typename context_t::return_t dispatch (context_t *c) const
   {
-    TRACE_PROCESS (this);
+    TRACE_DISPATCH (this);
     switch (u.format) {
-    case 1: return TRACE_RETURN (c->process (u.format1));
+    case 1: return TRACE_RETURN (c->dispatch (u.format1));
     default:return TRACE_RETURN (c->default_return_value ());
     }
   }
@@ -1075,11 +1075,11 @@ struct MarkBasePosFormat1
 struct MarkBasePos
 {
   template <typename context_t>
-  inline typename context_t::return_t process (context_t *c) const
+  inline typename context_t::return_t dispatch (context_t *c) const
   {
-    TRACE_PROCESS (this);
+    TRACE_DISPATCH (this);
     switch (u.format) {
-    case 1: return TRACE_RETURN (c->process (u.format1));
+    case 1: return TRACE_RETURN (c->dispatch (u.format1));
     default:return TRACE_RETURN (c->default_return_value ());
     }
   }
@@ -1196,11 +1196,11 @@ struct MarkLigPosFormat1
 struct MarkLigPos
 {
   template <typename context_t>
-  inline typename context_t::return_t process (context_t *c) const
+  inline typename context_t::return_t dispatch (context_t *c) const
   {
-    TRACE_PROCESS (this);
+    TRACE_DISPATCH (this);
     switch (u.format) {
-    case 1: return TRACE_RETURN (c->process (u.format1));
+    case 1: return TRACE_RETURN (c->dispatch (u.format1));
     default:return TRACE_RETURN (c->default_return_value ());
     }
   }
@@ -1315,11 +1315,11 @@ struct MarkMarkPosFormat1
 struct MarkMarkPos
 {
   template <typename context_t>
-  inline typename context_t::return_t process (context_t *c) const
+  inline typename context_t::return_t dispatch (context_t *c) const
   {
-    TRACE_PROCESS (this);
+    TRACE_DISPATCH (this);
     switch (u.format) {
-    case 1: return TRACE_RETURN (c->process (u.format1));
+    case 1: return TRACE_RETURN (c->dispatch (u.format1));
     default:return TRACE_RETURN (c->default_return_value ());
     }
   }
@@ -1374,19 +1374,19 @@ struct PosLookupSubTable
   };
 
   template <typename context_t>
-  inline typename context_t::return_t process (context_t *c, unsigned int lookup_type) const
+  inline typename context_t::return_t dispatch (context_t *c, unsigned int lookup_type) const
   {
-    TRACE_PROCESS (this);
+    TRACE_DISPATCH (this);
     switch (lookup_type) {
-    case Single:		return TRACE_RETURN (u.single.process (c));
-    case Pair:			return TRACE_RETURN (u.pair.process (c));
-    case Cursive:		return TRACE_RETURN (u.cursive.process (c));
-    case MarkBase:		return TRACE_RETURN (u.markBase.process (c));
-    case MarkLig:		return TRACE_RETURN (u.markLig.process (c));
-    case MarkMark:		return TRACE_RETURN (u.markMark.process (c));
-    case Context:		return TRACE_RETURN (u.context.process (c));
-    case ChainContext:		return TRACE_RETURN (u.chainContext.process (c));
-    case Extension:		return TRACE_RETURN (u.extension.process (c));
+    case Single:		return TRACE_RETURN (u.single.dispatch (c));
+    case Pair:			return TRACE_RETURN (u.pair.dispatch (c));
+    case Cursive:		return TRACE_RETURN (u.cursive.dispatch (c));
+    case MarkBase:		return TRACE_RETURN (u.markBase.dispatch (c));
+    case MarkLig:		return TRACE_RETURN (u.markLig.dispatch (c));
+    case MarkMark:		return TRACE_RETURN (u.markMark.dispatch (c));
+    case Context:		return TRACE_RETURN (u.context.dispatch (c));
+    case ChainContext:		return TRACE_RETURN (u.chainContext.dispatch (c));
+    case Extension:		return TRACE_RETURN (u.extension.dispatch (c));
     default:			return TRACE_RETURN (c->default_return_value ());
     }
   }
@@ -1435,26 +1435,26 @@ struct PosLookup : Lookup
   { return this+CastR<OffsetArrayOf<PosLookupSubTable> > (subTable)[i]; }
 
   template <typename context_t>
-  inline typename context_t::return_t process (context_t *c) const
+  inline typename context_t::return_t dispatch (context_t *c) const
   {
-    TRACE_PROCESS (this);
+    TRACE_DISPATCH (this);
     unsigned int lookup_type = get_type ();
     unsigned int count = get_subtable_count ();
     for (unsigned int i = 0; i < count; i++) {
-      typename context_t::return_t r = get_subtable (i).process (c, lookup_type);
+      typename context_t::return_t r = get_subtable (i).dispatch (c, lookup_type);
       if (c->stop_sublookup_iteration (r))
         return TRACE_RETURN (r);
     }
     return TRACE_RETURN (c->default_return_value ());
   }
   template <typename context_t>
-  static inline typename context_t::return_t process_recurse_func (context_t *c, unsigned int lookup_index);
+  static inline typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index);
 
   inline hb_collect_glyphs_context_t::return_t collect_glyphs_lookup (hb_collect_glyphs_context_t *c) const
   {
     TRACE_COLLECT_GLYPHS (this);
     c->set_recurse_func (NULL);
-    return TRACE_RETURN (process (c));
+    return TRACE_RETURN (dispatch (c));
   }
 
   template <typename set_t>
@@ -1464,7 +1464,7 @@ struct PosLookup : Lookup
     const Coverage *last = NULL;
     unsigned int count = get_subtable_count ();
     for (unsigned int i = 0; i < count; i++) {
-      const Coverage *coverage = &get_subtable (i).process (&c, get_type ());
+      const Coverage *coverage = &get_subtable (i).dispatch (&c, get_type ());
       if (coverage != last) {
         coverage->add_coverage (glyphs);
         last = coverage;
@@ -1477,7 +1477,7 @@ struct PosLookup : Lookup
     TRACE_APPLY (this);
     if (!c->check_glyph_property (&c->buffer->cur(), c->lookup_props))
       return TRACE_RETURN (false);
-    return TRACE_RETURN (process (c));
+    return TRACE_RETURN (dispatch (c));
   }
 
   static bool apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index);
@@ -1618,11 +1618,11 @@ GPOS::position_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer)
 /* Out-of-class implementation for methods recursing */
 
 template <typename context_t>
-inline typename context_t::return_t PosLookup::process_recurse_func (context_t *c, unsigned int lookup_index)
+inline typename context_t::return_t PosLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index)
 {
   const GPOS &gpos = *(hb_ot_layout_from_face (c->face)->gpos);
   const PosLookup &l = gpos.get_lookup (lookup_index);
-  return l.process (c);
+  return l.dispatch (c);
 }
 
 inline bool PosLookup::apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index)
diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index 065d0f1..04ed309 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -193,12 +193,12 @@ struct SingleSubstFormat2
 struct SingleSubst
 {
   template <typename context_t>
-  inline typename context_t::return_t process (context_t *c) const
+  inline typename context_t::return_t dispatch (context_t *c) const
   {
-    TRACE_PROCESS (this);
+    TRACE_DISPATCH (this);
     switch (u.format) {
-    case 1: return TRACE_RETURN (c->process (u.format1));
-    case 2: return TRACE_RETURN (c->process (u.format2));
+    case 1: return TRACE_RETURN (c->dispatch (u.format1));
+    case 2: return TRACE_RETURN (c->dispatch (u.format2));
     default:return TRACE_RETURN (c->default_return_value ());
     }
   }
@@ -386,11 +386,11 @@ struct MultipleSubstFormat1
 struct MultipleSubst
 {
   template <typename context_t>
-  inline typename context_t::return_t process (context_t *c) const
+  inline typename context_t::return_t dispatch (context_t *c) const
   {
-    TRACE_PROCESS (this);
+    TRACE_DISPATCH (this);
     switch (u.format) {
-    case 1: return TRACE_RETURN (c->process (u.format1));
+    case 1: return TRACE_RETURN (c->dispatch (u.format1));
     default:return TRACE_RETURN (c->default_return_value ());
     }
   }
@@ -537,11 +537,11 @@ struct AlternateSubstFormat1
 struct AlternateSubst
 {
   template <typename context_t>
-  inline typename context_t::return_t process (context_t *c) const
+  inline typename context_t::return_t dispatch (context_t *c) const
   {
-    TRACE_PROCESS (this);
+    TRACE_DISPATCH (this);
     switch (u.format) {
-    case 1: return TRACE_RETURN (c->process (u.format1));
+    case 1: return TRACE_RETURN (c->dispatch (u.format1));
     default:return TRACE_RETURN (c->default_return_value ());
     }
   }
@@ -842,11 +842,11 @@ struct LigatureSubstFormat1
 struct LigatureSubst
 {
   template <typename context_t>
-  inline typename context_t::return_t process (context_t *c) const
+  inline typename context_t::return_t dispatch (context_t *c) const
   {
-    TRACE_PROCESS (this);
+    TRACE_DISPATCH (this);
     switch (u.format) {
-    case 1: return TRACE_RETURN (c->process (u.format1));
+    case 1: return TRACE_RETURN (c->dispatch (u.format1));
     default:return TRACE_RETURN (c->default_return_value ());
     }
   }
@@ -1023,11 +1023,11 @@ struct ReverseChainSingleSubstFormat1
 struct ReverseChainSingleSubst
 {
   template <typename context_t>
-  inline typename context_t::return_t process (context_t *c) const
+  inline typename context_t::return_t dispatch (context_t *c) const
   {
-    TRACE_PROCESS (this);
+    TRACE_DISPATCH (this);
     switch (u.format) {
-    case 1: return TRACE_RETURN (c->process (u.format1));
+    case 1: return TRACE_RETURN (c->dispatch (u.format1));
     default:return TRACE_RETURN (c->default_return_value ());
     }
   }
@@ -1070,18 +1070,18 @@ struct SubstLookupSubTable
   };
 
   template <typename context_t>
-  inline typename context_t::return_t process (context_t *c, unsigned int lookup_type) const
+  inline typename context_t::return_t dispatch (context_t *c, unsigned int lookup_type) const
   {
-    TRACE_PROCESS (this);
+    TRACE_DISPATCH (this);
     switch (lookup_type) {
-    case Single:		return TRACE_RETURN (u.single.process (c));
-    case Multiple:		return TRACE_RETURN (u.multiple.process (c));
-    case Alternate:		return TRACE_RETURN (u.alternate.process (c));
-    case Ligature:		return TRACE_RETURN (u.ligature.process (c));
-    case Context:		return TRACE_RETURN (u.context.process (c));
-    case ChainContext:		return TRACE_RETURN (u.chainContext.process (c));
-    case Extension:		return TRACE_RETURN (u.extension.process (c));
-    case ReverseChainSingle:	return TRACE_RETURN (u.reverseChainContextSingle.process (c));
+    case Single:		return TRACE_RETURN (u.single.dispatch (c));
+    case Multiple:		return TRACE_RETURN (u.multiple.dispatch (c));
+    case Alternate:		return TRACE_RETURN (u.alternate.dispatch (c));
+    case Ligature:		return TRACE_RETURN (u.ligature.dispatch (c));
+    case Context:		return TRACE_RETURN (u.context.dispatch (c));
+    case ChainContext:		return TRACE_RETURN (u.chainContext.dispatch (c));
+    case Extension:		return TRACE_RETURN (u.extension.dispatch (c));
+    case ReverseChainSingle:	return TRACE_RETURN (u.reverseChainContextSingle.dispatch (c));
     default:			return TRACE_RETURN (c->default_return_value ());
     }
   }
@@ -1139,33 +1139,33 @@ struct SubstLookup : Lookup
   }
 
   template <typename context_t>
-  inline typename context_t::return_t process (context_t *c) const
+  inline typename context_t::return_t dispatch (context_t *c) const
   {
-    TRACE_PROCESS (this);
+    TRACE_DISPATCH (this);
     unsigned int lookup_type = get_type ();
     unsigned int count = get_subtable_count ();
     for (unsigned int i = 0; i < count; i++) {
-      typename context_t::return_t r = get_subtable (i).process (c, lookup_type);
+      typename context_t::return_t r = get_subtable (i).dispatch (c, lookup_type);
       if (c->stop_sublookup_iteration (r))
         return TRACE_RETURN (r);
     }
     return TRACE_RETURN (c->default_return_value ());
   }
   template <typename context_t>
-  static inline typename context_t::return_t process_recurse_func (context_t *c, unsigned int lookup_index);
+  static inline typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index);
 
   inline hb_closure_context_t::return_t closure (hb_closure_context_t *c) const
   {
     TRACE_CLOSURE (this);
-    c->set_recurse_func (process_recurse_func<hb_closure_context_t>);
-    return TRACE_RETURN (process (c));
+    c->set_recurse_func (dispatch_recurse_func<hb_closure_context_t>);
+    return TRACE_RETURN (dispatch (c));
   }
 
   inline hb_collect_glyphs_context_t::return_t collect_glyphs_lookup (hb_collect_glyphs_context_t *c) const
   {
     TRACE_COLLECT_GLYPHS (this);
-    c->set_recurse_func (process_recurse_func<hb_collect_glyphs_context_t>);
-    return TRACE_RETURN (process (c));
+    c->set_recurse_func (dispatch_recurse_func<hb_collect_glyphs_context_t>);
+    return TRACE_RETURN (dispatch (c));
   }
 
   template <typename set_t>
@@ -1175,7 +1175,7 @@ struct SubstLookup : Lookup
     const Coverage *last = NULL;
     unsigned int count = get_subtable_count ();
     for (unsigned int i = 0; i < count; i++) {
-      const Coverage *coverage = &get_subtable (i).process (&c, get_type ());
+      const Coverage *coverage = &get_subtable (i).dispatch (&c, get_type ());
       if (coverage != last) {
         coverage->add_coverage (glyphs);
         last = coverage;
@@ -1188,7 +1188,7 @@ struct SubstLookup : Lookup
     TRACE_WOULD_APPLY (this);
     if (unlikely (!c->len))  return TRACE_RETURN (false);
     if (!digest->may_have (c->glyphs[0]))  return TRACE_RETURN (false);
-      return TRACE_RETURN (process (c));
+      return TRACE_RETURN (dispatch (c));
   }
 
   inline bool apply_once (hb_apply_context_t *c) const
@@ -1196,7 +1196,7 @@ struct SubstLookup : Lookup
     TRACE_APPLY (this);
     if (!c->check_glyph_property (&c->buffer->cur(), c->lookup_props))
       return TRACE_RETURN (false);
-    return TRACE_RETURN (process (c));
+    return TRACE_RETURN (dispatch (c));
   }
 
   static bool apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index);
@@ -1386,11 +1386,11 @@ inline bool ExtensionSubst::is_reverse (void) const
 }
 
 template <typename context_t>
-inline typename context_t::return_t SubstLookup::process_recurse_func (context_t *c, unsigned int lookup_index)
+inline typename context_t::return_t SubstLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index)
 {
   const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->gsub);
   const SubstLookup &l = gsub.get_lookup (lookup_index);
-  return l.process (c);
+  return l.dispatch (c);
 }
 
 inline bool SubstLookup::apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index)
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 23fbdf4..d749efa 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -38,7 +38,7 @@ namespace OT {
 
 
 
-#define TRACE_PROCESS(this) \
+#define TRACE_DISPATCH(this) \
 	hb_auto_trace_t<context_t::max_debug_depth, typename context_t::return_t> trace \
 	(&c->debug_depth, c->get_name (), this, HB_FUNC, \
 	 "");
@@ -60,7 +60,7 @@ struct hb_closure_context_t
   typedef hb_void_t return_t;
   typedef return_t (*recurse_func_t) (hb_closure_context_t *c, unsigned int lookup_index);
   template <typename T>
-  inline return_t process (const T &obj) { obj.closure (this); return HB_VOID; }
+  inline return_t dispatch (const T &obj) { obj.closure (this); return HB_VOID; }
   static return_t default_return_value (void) { return HB_VOID; }
   bool stop_sublookup_iteration (return_t r HB_UNUSED) const { return false; }
   return_t recurse (unsigned int lookup_index)
@@ -109,7 +109,7 @@ struct hb_would_apply_context_t
   static const unsigned int max_debug_depth = HB_DEBUG_WOULD_APPLY;
   typedef bool return_t;
   template <typename T>
-  inline return_t process (const T &obj) { return obj.would_apply (this); }
+  inline return_t dispatch (const T &obj) { return obj.would_apply (this); }
   static return_t default_return_value (void) { return false; }
   bool stop_sublookup_iteration (return_t r) const { return r; }
 
@@ -148,7 +148,7 @@ struct hb_collect_glyphs_context_t
   typedef hb_void_t return_t;
   typedef return_t (*recurse_func_t) (hb_collect_glyphs_context_t *c, unsigned int lookup_index);
   template <typename T>
-  inline return_t process (const T &obj) { obj.collect_glyphs (this); return HB_VOID; }
+  inline return_t dispatch (const T &obj) { obj.collect_glyphs (this); return HB_VOID; }
   static return_t default_return_value (void) { return HB_VOID; }
   bool stop_sublookup_iteration (return_t r HB_UNUSED) const { return false; }
   return_t recurse (unsigned int lookup_index)
@@ -214,7 +214,7 @@ struct hb_get_coverage_context_t
   static const unsigned int max_debug_depth = 0;
   typedef const Coverage &return_t;
   template <typename T>
-  inline return_t process (const T &obj) { return obj.get_coverage (); }
+  inline return_t dispatch (const T &obj) { return obj.get_coverage (); }
   static return_t default_return_value (void) { return Null(Coverage); }
 
   hb_get_coverage_context_t (void) :
@@ -241,7 +241,7 @@ struct hb_apply_context_t
   typedef bool return_t;
   typedef return_t (*recurse_func_t) (hb_apply_context_t *c, unsigned int lookup_index);
   template <typename T>
-  inline return_t process (const T &obj) { return obj.apply (this); }
+  inline return_t dispatch (const T &obj) { return obj.apply (this); }
   static return_t default_return_value (void) { return false; }
   bool stop_sublookup_iteration (return_t r) const { return r; }
   return_t recurse (unsigned int lookup_index)
@@ -1493,13 +1493,13 @@ struct ContextFormat3
 struct Context
 {
   template <typename context_t>
-  inline typename context_t::return_t process (context_t *c) const
+  inline typename context_t::return_t dispatch (context_t *c) const
   {
-    TRACE_PROCESS (this);
+    TRACE_DISPATCH (this);
     switch (u.format) {
-    case 1: return TRACE_RETURN (c->process (u.format1));
-    case 2: return TRACE_RETURN (c->process (u.format2));
-    case 3: return TRACE_RETURN (c->process (u.format3));
+    case 1: return TRACE_RETURN (c->dispatch (u.format1));
+    case 2: return TRACE_RETURN (c->dispatch (u.format2));
+    case 3: return TRACE_RETURN (c->dispatch (u.format3));
     default:return TRACE_RETURN (c->default_return_value ());
     }
   }
@@ -2109,13 +2109,13 @@ struct ChainContextFormat3
 struct ChainContext
 {
   template <typename context_t>
-  inline typename context_t::return_t process (context_t *c) const
+  inline typename context_t::return_t dispatch (context_t *c) const
   {
-    TRACE_PROCESS (this);
+    TRACE_DISPATCH (this);
     switch (u.format) {
-    case 1: return TRACE_RETURN (c->process (u.format1));
-    case 2: return TRACE_RETURN (c->process (u.format2));
-    case 3: return TRACE_RETURN (c->process (u.format3));
+    case 1: return TRACE_RETURN (c->dispatch (u.format1));
+    case 2: return TRACE_RETURN (c->dispatch (u.format2));
+    case 3: return TRACE_RETURN (c->dispatch (u.format3));
     default:return TRACE_RETURN (c->default_return_value ());
     }
   }
@@ -2189,9 +2189,9 @@ struct Extension
   }
 
   template <typename context_t>
-  inline typename context_t::return_t process (context_t *c) const
+  inline typename context_t::return_t dispatch (context_t *c) const
   {
-    return get_subtable<typename T::LookupSubTable> ().process (c, get_type ());
+    return get_subtable<typename T::LookupSubTable> ().dispatch (c, get_type ());
   }
 
   inline bool sanitize_self (hb_sanitize_context_t *c) {
commit 2761e8a632c14353f286708898be8df6ebad7407
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Mar 7 20:51:30 2013 -0500

    [win32] Remove MemoryBarrier() fallback implementation
    
    I added these because the older mingw32 toolchain didn't have
    MemoryBarrier().  The newer mingw-w64 toolchain however has.
    As reported by John Emmas this was causing build failure with
    MSVC (on glib) because of inline issues.  But that reminded me
    that we may be taking this path even if the system implements
    MemoryBarrier as a function, which is a waste.  So, just remove
    it.

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index bb10fe1..7047e21 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -47,22 +47,10 @@
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 
-/* mingw32 does not have MemoryBarrier.
- * MemoryBarrier may be defined as a macro or a function.
- * Just make a failsafe version for ourselves. */
-#ifdef MemoryBarrier
-#define HBMemoryBarrier MemoryBarrier
-#else
-static inline void HBMemoryBarrier (void) {
-  long dummy = 0;
-  InterlockedExchange (&dummy, 1);
-}
-#endif
-
 typedef LONG hb_atomic_int_t;
 #define hb_atomic_int_add(AI, V)	InterlockedExchangeAdd (&(AI), (V))
 
-#define hb_atomic_ptr_get(P)		(HBMemoryBarrier (), (void *) *(P))
+#define hb_atomic_ptr_get(P)		(MemoryBarrier (), (void *) *(P))
 #define hb_atomic_ptr_cmpexch(P,O,N)	(InterlockedCompareExchangePointer ((void **) (P), (void *) (N), (void *) (O)) == (void *) (O))
 
 



More information about the HarfBuzz mailing list