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

Behdad Esfahbod behdad at kemper.freedesktop.org
Fri Jul 14 13:23:16 UTC 2017


 CMakeLists.txt                                                          |    4 
 src/hb-buffer.cc                                                        |    4 
 src/hb-common.cc                                                        |   28 ++
 src/hb-ot-font.cc                                                       |    2 
 src/hb-ot-layout-gsubgpos-private.hh                                    |   45 ++-
 src/hb-ot-layout.cc                                                     |    3 
 src/hb-ot-map-private.hh                                                |   10 
 src/hb-ot-map.cc                                                        |    8 
 src/hb-ot-shape-complex-arabic-table.hh                                 |   14 -
 src/hb-ot-shape-complex-arabic.cc                                       |    2 
 src/hb-ot-shape-complex-hangul.cc                                       |   16 -
 src/hb-ot-shape-complex-indic-table.cc                                  |   22 -
 src/hb-ot-shape-complex-indic.cc                                        |   16 -
 src/hb-ot-shape-complex-myanmar.cc                                      |    2 
 src/hb-ot-shape-complex-thai.cc                                         |   12 
 src/hb-ot-shape-complex-use-table.cc                                    |   42 +--
 src/hb-unicode-private.hh                                               |   25 +-
 src/hb-utf-private.hh                                                   |   18 -
 test/shaping/Makefile.am                                                |    4 
 test/shaping/fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf |binary
 test/shaping/fonts/sha1sum/82f4f3b57bb55344e72e70231380202a52af5805.ttf |binary
 test/shaping/fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf |binary
 test/shaping/fonts/sha1sum/f443753e8ffe8e8aae606cfba158e00334b6efb1.ttf |binary
 test/shaping/tests/indic-joiners.tests                                  |    2 
 test/shaping/tests/tibetan-contractions-1.tests                         |   60 ++++
 test/shaping/tests/tibetan-contractions-2.tests                         |   53 ++++
 test/shaping/tests/tibetan-vowels.tests                                 |   11 
 win32/README.txt                                                        |   20 +
 win32/build-rules-msvc.mak                                              |    5 
 win32/config-msvc.mak                                                   |    7 
 win32/create-lists-msvc.mak                                             |    9 
 win32/generate-msvc.mak                                                 |    6 
 win32/info-msvc.mak                                                     |    8 
 win32/pc_base.py                                                        |  124 ++++++++++
 win32/replace.py                                                        |  115 +++++++++
 win32/setup.py                                                          |   62 +++++
 36 files changed, 639 insertions(+), 120 deletions(-)

New commits:
commit e359a4b8f57bbc778843f233c4f5d6fb07ff11d9
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Jul 14 14:14:35 2017 +0100

    [indic] Disable automatic ZWNJ handling for Indic features
    
    Fixes https://github.com/behdad/harfbuzz/issues/294
    
    Also fixes a bunch of other Indic issues.  Test results after:
    
    BENGALI: 353725 out of 354188 tests passed. 463 failed (0.130722%)
    DEVANAGARI: 707307 out of 707394 tests passed. 87 failed (0.0122987%)
    GUJARATI: 366355 out of 366457 tests passed. 102 failed (0.0278341%)
    GURMUKHI: 60732 out of 60747 tests passed. 15 failed (0.0246926%)
    KANNADA: 951201 out of 951913 tests passed. 712 failed (0.0747968%)
    KHMER: 299071 out of 299124 tests passed. 53 failed (0.0177184%)
    MALAYALAM: 1048136 out of 1048334 tests passed. 198 failed (0.0188871%)
    ORIYA: 42320 out of 42329 tests passed. 9 failed (0.021262%)
    SINHALA: 271662 out of 271847 tests passed. 185 failed (0.068053%)
    TAMIL: 1091754 out of 1091754 tests passed. 0 failed (0%)
    TELUGU: 970555 out of 970573 tests passed. 18 failed (0.00185457%)
    
    Before:
    
    BENGALI: 353725 out of 354188 tests passed. 463 failed (0.130722%)
    DEVANAGARI: 707307 out of 707394 tests passed. 87 failed (0.0122987%)
    GUJARATI: 366349 out of 366457 tests passed. 108 failed (0.0294714%)
    GURMUKHI: 60732 out of 60747 tests passed. 15 failed (0.0246926%)
    KANNADA: 951190 out of 951913 tests passed. 723 failed (0.0759523%)
    KHMER: 299070 out of 299124 tests passed. 54 failed (0.0180527%)
    MALAYALAM: 1048136 out of 1048334 tests passed. 198 failed (0.0188871%)
    ORIYA: 42320 out of 42329 tests passed. 9 failed (0.021262%)
    SINHALA: 271662 out of 271847 tests passed. 185 failed (0.068053%)
    TAMIL: 1091753 out of 1091754 tests passed. 1 failed (9.15957e-05%)
    TELUGU: 970555 out of 970573 tests passed. 18 failed (0.00185457%)

diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index cbc46c8c..8227a77d 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -411,12 +411,12 @@ collect_features_indic (hb_ot_shape_planner_t *plan)
   unsigned int i = 0;
   map->add_gsub_pause (initial_reordering);
   for (; i < INDIC_BASIC_FEATURES; i++) {
-    map->add_feature (indic_features[i].tag, 1, indic_features[i].flags | F_MANUAL_ZWJ);
+    map->add_feature (indic_features[i].tag, 1, indic_features[i].flags | F_MANUAL_ZWJ | F_MANUAL_ZWNJ);
     map->add_gsub_pause (NULL);
   }
   map->add_gsub_pause (final_reordering);
   for (; i < INDIC_NUM_FEATURES; i++) {
-    map->add_feature (indic_features[i].tag, 1, indic_features[i].flags | F_MANUAL_ZWJ);
+    map->add_feature (indic_features[i].tag, 1, indic_features[i].flags | F_MANUAL_ZWJ | F_MANUAL_ZWNJ);
   }
 
   map->add_global_bool_feature (HB_TAG('c','a','l','t'));
diff --git a/test/shaping/Makefile.am b/test/shaping/Makefile.am
index 410a258d..f84b4671 100644
--- a/test/shaping/Makefile.am
+++ b/test/shaping/Makefile.am
@@ -56,6 +56,7 @@ TESTS = \
 	tests/hangul-jamo.tests \
 	tests/hyphens.tests \
 	tests/indic-joiner-candrabindu.tests \
+	tests/indic-joiners.tests \
 	tests/indic-old-spec.tests \
 	tests/indic-pref-blocking.tests \
 	tests/language-tags.tests \
diff --git a/test/shaping/fonts/sha1sum/f443753e8ffe8e8aae606cfba158e00334b6efb1.ttf b/test/shaping/fonts/sha1sum/f443753e8ffe8e8aae606cfba158e00334b6efb1.ttf
new file mode 100644
index 00000000..93c2f582
Binary files /dev/null and b/test/shaping/fonts/sha1sum/f443753e8ffe8e8aae606cfba158e00334b6efb1.ttf differ
diff --git a/test/shaping/tests/indic-joiners.tests b/test/shaping/tests/indic-joiners.tests
new file mode 100644
index 00000000..63f67290
--- /dev/null
+++ b/test/shaping/tests/indic-joiners.tests
@@ -0,0 +1,2 @@
+fonts/sha1sum/f443753e8ffe8e8aae606cfba158e00334b6efb1.ttf::U+179A,U+1784,U+17D2,U+179F,U+200C,U+17CA,U+17B8,U+0020:[uni179a=0+775|uni1784=1+1550|uni179f.sub=1+775|space=1+0|uni17ca=1+0|uni17b8=1 at 0,300+0|space=7+600]
+fonts/sha1sum/f443753e8ffe8e8aae606cfba158e00334b6efb1.ttf::U+179A,U+1784,U+17D2,U+179F,U+17CA,U+17B8:[uni179a=0+775|uni1784=1+1550|uni179f.sub=1+775|uni17bb=1 at -75,-700+0|uni17b8=1+0]
commit cdf1fd0627c5517c948ca05d2e9427c3e441adf9
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Jul 14 12:43:34 2017 +0100

    [indic] Add infrastructure to disable ZWNJ-skipping in context-matching
    
    Not used yet.

diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index f77f5d98..2235d3a0 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -346,9 +346,9 @@ struct hb_apply_context_t :
       matcher.set_match_func (NULL, NULL);
       matcher.set_lookup_props (c->lookup_props);
       /* Ignore ZWNJ if we are matching GSUB context, or matching GPOS. */
-      matcher.set_ignore_zwnj (context_match || c->table_index == 1);
+      matcher.set_ignore_zwnj (c->table_index == 1 || (context_match && c->auto_zwnj));
       /* Ignore ZWJ if we are matching GSUB context, or matching GPOS, or if asked to. */
-      matcher.set_ignore_zwj (context_match || c->table_index == 1 || c->auto_zwj);
+      matcher.set_ignore_zwj  (c->table_index == 1 || (context_match || c->auto_zwj));
       matcher.set_mask (context_match ? -1 : c->lookup_mask);
     }
     inline void set_lookup_props (unsigned int lookup_props)
@@ -457,45 +457,50 @@ struct hb_apply_context_t :
     return ret;
   }
 
-  unsigned int table_index; /* GSUB/GPOS */
+  skipping_iterator_t iter_input, iter_context;
+
   hb_font_t *font;
   hb_face_t *face;
   hb_buffer_t *buffer;
-  hb_direction_t direction;
-  hb_mask_t lookup_mask;
-  bool auto_zwj;
   recurse_func_t recurse_func;
-  unsigned int nesting_level_left;
-  unsigned int lookup_props;
   const GDEF &gdef;
-  bool has_glyph_classes;
   const VariationStore &var_store;
-  skipping_iterator_t iter_input, iter_context;
+
+  hb_direction_t direction;
+  hb_mask_t lookup_mask;
+  unsigned int table_index; /* GSUB/GPOS */
   unsigned int lookup_index;
+  unsigned int lookup_props;
+  unsigned int nesting_level_left;
   unsigned int debug_depth;
 
+  bool auto_zwnj;
+  bool auto_zwj;
+  bool has_glyph_classes;
+
 
   hb_apply_context_t (unsigned int table_index_,
 		      hb_font_t *font_,
 		      hb_buffer_t *buffer_) :
-			table_index (table_index_),
+			iter_input (), iter_context (),
 			font (font_), face (font->face), buffer (buffer_),
-			direction (buffer_->props.direction),
-			lookup_mask (1),
-			auto_zwj (true),
 			recurse_func (NULL),
-			nesting_level_left (HB_MAX_NESTING_LEVEL),
-			lookup_props (0),
 			gdef (*hb_ot_layout_from_face (face)->gdef),
-			has_glyph_classes (gdef.has_glyph_classes ()),
 			var_store (gdef.get_var_store ()),
-			iter_input (),
-			iter_context (),
+			direction (buffer_->props.direction),
+			lookup_mask (1),
+			table_index (table_index_),
 			lookup_index ((unsigned int) -1),
-			debug_depth (0) {}
+			lookup_props (0),
+			nesting_level_left (HB_MAX_NESTING_LEVEL),
+			debug_depth (0),
+			auto_zwnj (true),
+			auto_zwj (true),
+			has_glyph_classes (gdef.has_glyph_classes ()) {}
 
   inline void set_lookup_mask (hb_mask_t mask) { lookup_mask = mask; }
   inline void set_auto_zwj (bool auto_zwj_) { auto_zwj = auto_zwj_; }
+  inline void set_auto_zwnj (bool auto_zwnj_) { auto_zwnj = auto_zwnj_; }
   inline void set_recurse_func (recurse_func_t func) { recurse_func = func; }
   inline void set_lookup_index (unsigned int lookup_index_) { lookup_index = lookup_index_; }
   inline void set_lookup_props (unsigned int lookup_props_)
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 5b781a72..977e5830 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -1219,6 +1219,7 @@ inline void hb_ot_map_t::apply (const Proxy &proxy,
       c.set_lookup_index (lookup_index);
       c.set_lookup_mask (lookups[table_index][i].mask);
       c.set_auto_zwj (lookups[table_index][i].auto_zwj);
+      c.set_auto_zwnj (lookups[table_index][i].auto_zwnj);
       apply_string<Proxy> (&c,
 			   proxy.table.get_lookup (lookup_index),
 			   proxy.accels[lookup_index]);
diff --git a/src/hb-ot-map-private.hh b/src/hb-ot-map-private.hh
index b69e5344..6f774dde 100644
--- a/src/hb-ot-map-private.hh
+++ b/src/hb-ot-map-private.hh
@@ -50,6 +50,7 @@ struct hb_ot_map_t
     hb_mask_t mask;
     hb_mask_t _1_mask; /* mask for value=1, for quick access */
     unsigned int needs_fallback : 1;
+    unsigned int auto_zwnj : 1;
     unsigned int auto_zwj : 1;
 
     static int cmp (const feature_map_t *a, const feature_map_t *b)
@@ -58,6 +59,7 @@ struct hb_ot_map_t
 
   struct lookup_map_t {
     unsigned short index;
+    unsigned short auto_zwnj : 1;
     unsigned short auto_zwj : 1;
     hb_mask_t mask;
 
@@ -150,8 +152,9 @@ enum hb_ot_map_feature_flags_t {
   F_NONE		= 0x0000u,
   F_GLOBAL		= 0x0001u, /* Feature applies to all characters; results in no mask allocated for it. */
   F_HAS_FALLBACK	= 0x0002u, /* Has fallback implementation, so include mask bit even if feature not found. */
-  F_MANUAL_ZWJ		= 0x0004u, /* Don't skip over ZWJ when matching. */
-  F_GLOBAL_SEARCH	= 0x0008u  /* If feature not found in LangSys, look for it in global feature list and pick one. */
+  F_MANUAL_ZWNJ		= 0x0004u, /* Don't skip over ZWNJ when matching **context**. */
+  F_MANUAL_ZWJ		= 0x0008u, /* Don't skip over ZWJ when matching **input**. */
+  F_GLOBAL_SEARCH	= 0x0010u  /* If feature not found in LangSys, look for it in global feature list and pick one. */
 };
 HB_MARK_AS_FLAG_T (hb_ot_map_feature_flags_t);
 /* Macro version for where const is desired. */
@@ -196,7 +199,8 @@ struct hb_ot_map_builder_t
 				unsigned int  feature_index,
 				unsigned int  variations_index,
 				hb_mask_t     mask,
-				bool          auto_zwj);
+				bool          auto_zwnj = true,
+				bool          auto_zwj = true);
 
   struct feature_info_t {
     hb_tag_t tag;
diff --git a/src/hb-ot-map.cc b/src/hb-ot-map.cc
index 9b331d52..014e4430 100644
--- a/src/hb-ot-map.cc
+++ b/src/hb-ot-map.cc
@@ -85,6 +85,7 @@ hb_ot_map_builder_t::add_lookups (hb_ot_map_t  &m,
 				  unsigned int  feature_index,
 				  unsigned int  variations_index,
 				  hb_mask_t     mask,
+				  bool          auto_zwnj,
 				  bool          auto_zwj)
 {
   unsigned int lookup_indices[32];
@@ -112,6 +113,7 @@ hb_ot_map_builder_t::add_lookups (hb_ot_map_t  &m,
         return;
       lookup->mask = mask;
       lookup->index = lookup_indices[i];
+      lookup->auto_zwnj = auto_zwnj;
       lookup->auto_zwj = auto_zwj;
     }
 
@@ -243,6 +245,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t  &m,
     map->index[1] = feature_index[1];
     map->stage[0] = info->stage[0];
     map->stage[1] = info->stage[1];
+    map->auto_zwnj = !(info->flags & F_MANUAL_ZWNJ);
     map->auto_zwj = !(info->flags & F_MANUAL_ZWJ);
     if ((info->flags & F_GLOBAL) && info->max_value == 1) {
       /* Uses the global bit */
@@ -284,8 +287,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t  &m,
 	add_lookups (m, face, table_index,
 		     required_feature_index[table_index],
 		     variations_index,
-		     1 /* mask */,
-		     true /* auto_zwj */);
+		     1 /* mask */);
 
       for (unsigned i = 0; i < m.features.len; i++)
         if (m.features[i].stage[table_index] == stage)
@@ -293,6 +295,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t  &m,
 		       m.features[i].index[table_index],
 		       variations_index,
 		       m.features[i].mask,
+		       m.features[i].auto_zwnj,
 		       m.features[i].auto_zwj);
 
       /* Sort lookups and merge duplicates */
@@ -307,6 +310,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t  &m,
 	  else
 	  {
 	    m.lookups[table_index][j].mask |= m.lookups[table_index][i].mask;
+	    m.lookups[table_index][j].auto_zwnj &= m.lookups[table_index][i].auto_zwnj;
 	    m.lookups[table_index][j].auto_zwj &= m.lookups[table_index][i].auto_zwj;
 	  }
 	m.lookups[table_index].shrink (j + 1);
commit 3a73e0d5e17b87ac7e307d855c2cb43d040bd195
Author: Dominik Schlösser <dominik.schloesser at gmail.com>
Date:   Fri Jul 14 13:14:55 2017 +0200

    Shaping tests for Tibetan vowels (#446)
    
    * Shaping tests for Tibetan vowels
    
    * Test-cases for the Dzongkha contractions with multiple vowel-signs added.
    
    * going to be removed
    
    * Extended contraction-test-cases to all test cases in contractions.txt that actually use multiple-vowels (113 cases)

diff --git a/test/shaping/Makefile.am b/test/shaping/Makefile.am
index ab25a50a..410a258d 100644
--- a/test/shaping/Makefile.am
+++ b/test/shaping/Makefile.am
@@ -64,6 +64,9 @@ TESTS = \
 	tests/mongolian-variation-selector.tests \
 	tests/spaces.tests \
 	tests/simple.tests \
+	tests/tibetan-contractions-1.tests \
+	tests/tibetan-contractions-2.tests \
+	tests/tibetan-vowels.tests \
 	tests/use.tests \
 	tests/use-marchen.tests \
 	tests/vertical.tests \
diff --git a/test/shaping/fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf b/test/shaping/fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf
new file mode 100644
index 00000000..c4b47912
Binary files /dev/null and b/test/shaping/fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf differ
diff --git a/test/shaping/fonts/sha1sum/82f4f3b57bb55344e72e70231380202a52af5805.ttf b/test/shaping/fonts/sha1sum/82f4f3b57bb55344e72e70231380202a52af5805.ttf
new file mode 100644
index 00000000..a8fd4956
Binary files /dev/null and b/test/shaping/fonts/sha1sum/82f4f3b57bb55344e72e70231380202a52af5805.ttf differ
diff --git a/test/shaping/fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf b/test/shaping/fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf
new file mode 100644
index 00000000..7d0809eb
Binary files /dev/null and b/test/shaping/fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf differ
diff --git a/test/shaping/tests/tibetan-contractions-1.tests b/test/shaping/tests/tibetan-contractions-1.tests
new file mode 100644
index 00000000..8577c9d0
--- /dev/null
+++ b/test/shaping/tests/tibetan-contractions-1.tests
@@ -0,0 +1,60 @@
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+FEFF,U+0F40,U+0F72,U+0F72,U+0F0B,U+0F66,U+0FAD,U+0F7C,U+0F7C,U+0F0B:[uni0F40=0+680|uni0F720F72=0+0|uni0F0B=4+190|uni0F660FAD=5+680|uni0F7D=5+0|uni0F0B=9+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F40,U+0F74,U+0F72,U+0F66,U+0F0B:[uni0F400F740F72=0+680|uni0F66=3+680|uni0F0B=4+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F40,U+0F74,U+0F7A,U+0F53,U+0F0B:[uni0F400F74=0+680|uni0F7A=0+0|uni0F53=3+590|uni0F0B=4 at -30,0+160]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F40,U+0F74,U+0F7C,U+0F56,U+0F39,U+0F0B:[uni0F400F74=0+680|uni0F7C=0+0|uni0F56=3+610|uni0F39=3+0|uni0F0B=5+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F40,U+0F74,U+0F72,U+0F42,U+0F66,U+0F0B:[uni0F400F740F72=0+680|uni0F42=3+680|uni0F66=4+680|uni0F0B=5+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F40,U+0F74,U+0F7A,U+0F66,U+0F0B:[uni0F400F74=0+680|uni0F7A=0+0|uni0F66=3+680|uni0F0B=4+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F40,U+0FB3,U+0F74,U+0F7A,U+0F56,U+0F66,U+0F0B:[uni0F400FB30F740F7A=0+660|uni0F56=4+610|uni0F66=5+680|uni0F0B=6+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F40,U+0FB3,U+0F74,U+0F7C,U+0F42,U+0F0B:[uni0F400FB30F74=0+660|uni0F7C=0+0|uni0F42=4+680|uni0F0B=5+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F51,U+0F40,U+0F7C,U+0F7C,U+0F42,U+0F0B:[uni0F51=0+600|uni0F400F7D=1+680|uni0F42=4+680|uni0F0B=5+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F51,U+0F40,U+0F7C,U+0F7C,U+0F62,U+0F0B:[uni0F51=0+600|uni0F400F7D=1+680|uni0F62=4+620|uni0F0B=5 at -65,0+130]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F51,U+0F40,U+0FB1,U+0F7C,U+0F72,U+0F62,U+0F0B:[uni0F51=0+600|uni0F400FB10F7C0F72=1+660|uni0F62=5+620|uni0F0B=6 at -65,0+130]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F66,U+0F90,U+0FB1,U+0F74,U+0F7A,U+0F0B:[uni0F660F900FB10F74=0+680|uni0F7A=0+0|uni0F0B=5+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F56,U+0F66,U+0F90,U+0FB1,U+0F7A,U+0F7A,U+0F51,U+0F0B:[uni0F56=0+610|uni0F660F900FB1=1+660|uni0F7B=1+0|uni0F51=6+600|uni0F0B=7 at -70,0+106]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F56,U+0F66,U+0F90,U+0FB1,U+0F7A,U+0F7A,U+0F7A,U+0F51,U+0F0B:[uni0F56=0+610|uni0F660F900FB1=1+660|uni0F7B0F7A=1+0|uni0F51=7+600|uni0F0B=8 at -70,0+106]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F41,U+0F58,U+0F66,U+0F74,U+0F7E,U+0F0B:[uni0F41=0+660|uni0F58=1+660|uni0F660F740F7E=2+680|uni0F0B=5+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F41,U+0F74,U+0F7C,U+0F66,U+0F39,U+0F0B:[uni0F410F74=0+680|uni0F7C=0+0|uni0F66=3+680|uni0F39=3+0|uni0F0B=5+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F41,U+0FB1,U+0F74,U+0F7C,U+0F42,U+0F0B:[uni0F410FB10F74=0+670|uni0F7C=0+0|uni0F42=4+680|uni0F0B=5+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F41,U+0FB2,U+0F74,U+0F7A,U+0F51,U+0F0B:[uni0F410FB20F74=0+660|uni0F7A=0+0|uni0F51=4+600|uni0F0B=5 at -70,0+106]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F41,U+0FB2,U+0F74,U+0F72,U+0F44,U+0F0B:[uni0F410FB20F74=0+660|uni0F72=0+0|uni0F44=4+560|uni0F0B=5 at -20,0+110]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F41,U+0FB2,U+0F74,U+0F7C,U+0F51,U+0F0B:[uni0F410FB20F74=0+660|uni0F7C=0+0|uni0F51=4+600|uni0F0B=5 at -70,0+106]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F41,U+0FB2,U+0F74,U+0F7E,U+0F51,U+0F0B:[uni0F410FB20F740F7E=0+660|uni0F51=4+600|uni0F0B=5 at -70,0+106]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F58,U+0F41,U+0FB1,U+0F7A,U+0F7A,U+0F7A,U+0F53,U+0F0B:[uni0F58=0+660|uni0F410FB1=1+680|uni0F7B0F7A=1+0|uni0F53=6+590|uni0F0B=7 at -30,0+160]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F60,U+0F41,U+0F7C,U+0F7C,U+0F62,U+0F0B:[uni0F60=0+600|uni0F410F7D=1+660|uni0F62=4+620|uni0F0B=5 at -65,0+130]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F42,U+0F74,U+0F7C,U+0F42,U+0F0B:[uni0F420F74=0+680|uni0F7C=0+0|uni0F42=3+680|uni0F0B=4+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F42,U+0FB1,U+0F74,U+0F72,U+0F42,U+0F0B:[uni0F420FB10F74=0+700|uni0F72=0+0|uni0F42=4+680|uni0F0B=5+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F42,U+0FB2,U+0F74,U+0F72,U+0F53,U+0F0B:[uni0F420FB20F74=0+680|uni0F72=0+0|uni0F53=4+590|uni0F0B=5 at -30,0+160]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F42,U+0FB2,U+0F74,U+0F72,U+0F0B:[uni0F420FB20F74=0+680|uni0F72=0+0|uni0F0B=4+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F42,U+0FB2,U+0F74,U+0F7C,U+0F53,U+0F0B:[uni0F420FB20F74=0+680|uni0F7C=0+0|uni0F53=4+590|uni0F0B=5 at -30,0+160]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F42,U+0FB2,U+0F74,U+0F7C,U+0F56,U+0F0B:[uni0F420FB20F74=0+680|uni0F7C=0+0|uni0F56=4+610|uni0F0B=5+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F42,U+0FB2,U+0F7C,U+0F72,U+0F53,U+0F0B:[uni0F420FB2=0+680|uni0F7C0F72=0+0|uni0F53=4+590|uni0F0B=5 at -30,0+160]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F42,U+0FB2,U+0F7C,U+0F7A,U+0F62,U+0F0B:[uni0F420FB2=0+680|uni0F7C0F7A=0+0|uni0F62=4+620|uni0F0B=5 at -65,0+130]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F51,U+0F42,U+0F74,U+0F72,U+0F42,U+0F0B:[uni0F51=0+600|uni0F420F740F72=1+680|uni0F42=4+680|uni0F0B=5+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F51,U+0F42,U+0F74,U+0F7A,U+0F53,U+0F0B:[uni0F51=0+600|uni0F420F74=1+680|uni0F7A=1+0|uni0F53=4+590|uni0F0B=5 at -30,0+160]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F51,U+0F42,U+0F74,U+0F7A,U+0F42,U+0F66,U+0F0B:[uni0F51=0+600|uni0F420F74=1+680|uni0F7A=1+0|uni0F42=4+680|uni0F66=5+680|uni0F0B=6+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F51,U+0F42,U+0FB3,U+0F7C,U+0F7A,U+0F44,U+0F0B:[uni0F51=0+600|uni0F420FB3=1+680|uni0F7C0F7A=1+0|uni0F44=5+560|uni0F0B=6 at -20,0+110]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F58,U+0F42,U+0F7C,U+0F7C,U+0F53,U+0F0B:[uni0F58=0+660|uni0F420F7D=1+680|uni0F53=4+590|uni0F0B=5 at -30,0+160]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F44,U+0F74,U+0F72,U+0F42,U+0F0B:[uni0F440F74=0+610|uni0F72=0+0|uni0F42=3+680|uni0F0B=4+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F51,U+0F42,U+0FB2,U+0F74,U+0F7C,U+0F56,U+0F0B:[uni0F51=0+600|uni0F420FB20F74=1+680|uni0F7C=1+0|uni0F56=5+610|uni0F0B=6+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F56,U+0F45,U+0F74,U+0F72,U+0F42,U+0F0B:[uni0F56=0+610|uni0F450F740F72=1+630|uni0F42=4+680|uni0F0B=5+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F56,U+0F45,U+0F74,U+0F72,U+0F66,U+0F0B:[uni0F56=0+610|uni0F450F740F72=1+630|uni0F66=4+680|uni0F0B=5+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F56,U+0F45,U+0FB2,U+0F74,U+0F42,U+0F0B:[uni0F56=0+610|uni0F450FB20F74=1+640|uni0F42=4+680|uni0F0B=5+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F56,U+0F45,U+0F74,U+0F72,U+0F0B:[uni0F56=0+610|uni0F450F740F72=1+630|uni0F0B=4+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F56,U+0F45,U+0F74,U+0F7E,U+0F0B:[uni0F56=0+610|uni0F450F740F7E=1+630|uni0F0B=4+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F46,U+0F74,U+0F72,U+0F63,U+0F0B:[uni0F460F74=0+650|uni0F72=0+0|uni0F63=3+700|uni0F0B=4+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F46,U+0F74,U+0F7C,U+0F51,U+0F0B:[uni0F460F74=0+650|uni0F7C=0+0|uni0F51=3+600|uni0F0B=4 at -70,0+106]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F46,U+0F74,U+0F7C,U+0F51,U+0F0B:[uni0F460F74=0+650|uni0F7C=0+0|uni0F51=3+600|uni0F0B=4 at -70,0+106]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F46,U+0F74,U+0F7E,U+0F51,U+0F0B:[uni0F460F740F7E=0+650|uni0F51=3+600|uni0F0B=4 at -70,0+106]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F46,U+0F39,U+0F74,U+0F7C,U+0F51,U+0F0B:[uni0F46=0+620|uni0F39=0+0|uni0F74=0+0|uni0F7C=0+0|uni0F51=4+600|uni0F0B=5 at -70,0+106]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F46,U+0FB2,U+0F74,U+0F72,U+0F53,U+0F0B:[uni0F460FB20F740F72=0+660|uni0F53=4+590|uni0F0B=5 at -30,0+160]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F46,U+0FB2,U+0F74,U+0F7C,U+0F63,U+0F0B:[uni0F460FB20F74=0+660|uni0F7C=0+0|uni0F63=4+700|uni0F0B=5+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F58,U+0F46,U+0F7C,U+0F7A,U+0F53,U+0F0B:[uni0F58=0+660|uni0F46=1+620|uni0F7C0F7A=1+0|uni0F53=4+590|uni0F0B=5 at -30,0+160]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F60,U+0F46,U+0FB1,U+0F7C,U+0F72,U+0F62,U+0F0B:[uni0F60=0+600|uni0F460FB10F7C0F72=1+660|uni0F62=5+620|uni0F0B=6 at -65,0+130]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F47,U+0F7C,U+0F7C,U+0F0B:[uni0F470F7D=0+570|uni0F0B=3+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F62,U+0F97,U+0F74,U+0F7A,U+0F53,U+0F39,U+0F0B:[uni0F620F970F74=0+600|uni0F7A=0+0|uni0F53=4+590|uni0F39=4+0|uni0F0B=6+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F49,U+0F74,U+0F72,U+0F0B:[uni0F490F74=0+580|uni0F72=0+0|uni0F0B=3+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F49,U+0F74,U+0F72,U+0F44,U+0F0B:[uni0F490F74=0+580|uni0F72=0+0|uni0F44=3+560|uni0F0B=4 at -20,0+110]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F58,U+0F49,U+0F72,U+0F7E,U+0F51,U+0F0B:[uni0F58=0+660|uni0F49=1+580|uni0F720F7E=1+0|uni0F51=4+600|uni0F0B=5 at -70,0+106]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F42,U+0F4F,U+0F74,U+0F72,U+0F42,U+0F0B:[uni0F42=0+680|uni0F4F0F740F72=1+600|uni0F42=4+680|uni0F0B=5+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F56,U+0F4F,U+0F44,U+0F7C,U+0F7E,U+0F66,U+0F0B:[uni0F56=0+610|uni0F4F=1+560|uni0F44=2+560|uni0F7C0F7E=2+0|uni0F66=5+680|uni0F0B=6+190]
+fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf::U+0F50,U+0F39,U+0F74,U+0F7A,U+0F4A,U+0F0B:[uni0F50=0+600|uni0F39=0+0|uni0F74=0+0|uni0F7A=0+0|uni0F4A=4+590|uni0F0B=5+190]
diff --git a/test/shaping/tests/tibetan-contractions-2.tests b/test/shaping/tests/tibetan-contractions-2.tests
new file mode 100644
index 00000000..ac15d522
--- /dev/null
+++ b/test/shaping/tests/tibetan-contractions-2.tests
@@ -0,0 +1,53 @@
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F50,U+0F74,U+0F72,U+0F53,U+0F0B:[uni0F500F74=0+600|uni0F72=0+0|uni0F53=3+590|uni0F0B=4 at -30,0+160]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F58,U+0F50,U+0F74,U+0F7C,U+0F44,U+0F0B:[uni0F58=0+660|uni0F500F74=1+600|uni0F7C=1+0|uni0F44=4+560|uni0F0B=5 at -20,0+110]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F58,U+0F50,U+0F7C,U+0F7A,U+0F44,U+0F0B:[uni0F58=0+660|uni0F50=1+600|uni0F7C0F7A=1+0|uni0F44=4+560|uni0F0B=5 at -20,0+110]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F58,U+0F50,U+0F7C,U+0F72,U+0F66,U+0F0B:[uni0F58=0+660|uni0F50=1+600|uni0F7C0F72=1+0|uni0F66=4+680|uni0F0B=5+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F51,U+0F74,U+0F62,U+0FB2,U+0F7C,U+0F51,U+0F0B:[uni0F510F74=0+600|uni0F620FB2=2+600|uni0F7C=2+0|uni0F51=5+600|uni0F0B=6 at -70,0+106]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F51,U+0FB2,U+0F74,U+0F72,U+0F42,U+0F0B:[uni0F510FB20F74=0+600|uni0F72=0+0|uni0F42=4+680|uni0F0B=5+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F42,U+0F51,U+0F74,U+0F7A,U+0F53,U+0F0B:[uni0F42=0+680|uni0F510F740F7A=1+600|uni0F53=4+590|uni0F0B=5 at -30,0+160]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F56,U+0F51,U+0F7B,U+0F42,U+0F66,U+0F0B:[uni0F56=0+610|uni0F510F7B=1+579|uni0F42=3+680|uni0F66=4+680|uni0F0B=5+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F60,U+0F51,U+0F74,U+0F7A,U+0F51,U+0F0B:[uni0F60=0+600|uni0F510F740F7A=1+600|uni0F51=4+600|uni0F0B=5 at -70,0+106]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F62,U+0FA1,U+0F7C,U+0F7A,U+0F0B:[uni0F620FA10F7C0F7A=0+580|uni0F0B=4+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F66,U+0FA1,U+0F74,U+0F72,U+0F56,U+0F0B:[uni0F660FA10F74=0+680|uni0F72=0+0|uni0F56=4+610|uni0F0B=5+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F53,U+0F74,U+0F7C,U+0F42,U+0F66,U+0F0B:[uni0F530F74=0+600|uni0F7C=0+0|uni0F42=3+680|uni0F66=4+680|uni0F0B=5+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F53,U+0F74,U+0F7C,U+0F62,U+0F0B:[uni0F530F74=0+600|uni0F7C=0+0|uni0F62=3+620|uni0F0B=4 at -65,0+130]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F42,U+0F53,U+0FB1,U+0F7C,U+0F7E,U+0F62,U+0F0B:[uni0F42=0+680|uni0F530FB1=1+600|uni0F7C0F7E=1+0|uni0F62=5+620|uni0F0B=6 at -65,0+130]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F51,U+0F54,U+0F74,U+0F7C,U+0F42,U+0F66,U+0F0B:[uni0F51=0+600|uni0F540F74=1+610|uni0F7C=1+0|uni0F42=4+680|uni0F66=5+680|uni0F0B=6+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F56,U+0FB1,U+0F74,U+0F7E,U+0F56,U+0F0B:[uni0F560FB10F74=0+620|uni0F7E=0+0|uni0F56=4+610|uni0F0B=5+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F56,U+0FB3,U+0F74,U+0F7C,U+0F53,U+0F0B:[uni0F560FB30F74=0+650|uni0F7C=0+0|uni0F53=4+590|uni0F0B=5 at -30,0+160]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F56,U+0FB3,U+0F7C,U+0F7C,U+0F53,U+0F0B:[uni0F560FB3=0+650|uni0F7D=0+0|uni0F53=4+590|uni0F0B=5 at -30,0+160]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F51,U+0F56,U+0F74,U+0F7C,U+0F51,U+0F0B:[uni0F51=0+600|uni0F560F74=1+610|uni0F7C=1+0|uni0F51=4+600|uni0F0B=5 at -70,0+106]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F51,U+0F56,U+0F74,U+0F7C,U+0F56,U+0F66,U+0F0B:[uni0F51=0+600|uni0F560F74=1+610|uni0F7C=1+0|uni0F56=4+610|uni0F66=5+680|uni0F0B=6+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F58,U+0F74,U+0F7A,U+0F42,U+0F66,U+0F0B:[uni0F580F74=0+680|uni0F7A=0+0|uni0F42=3+680|uni0F66=4+680|uni0F0B=5+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F58,U+0F74,U+0F72,U+0F42,U+0F0B:[uni0F580F74=0+680|uni0F72=0+0|uni0F42=3+680|uni0F0B=4+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F58,U+0F74,U+0F7A,U+0F42,U+0F66,U+0F0B:[uni0F580F74=0+680|uni0F7A=0+0|uni0F42=3+680|uni0F66=4+680|uni0F0B=5+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F58,U+0F74,U+0F7A,U+0F53,U+0F0B:[uni0F580F74=0+680|uni0F7A=0+0|uni0F53=3+590|uni0F0B=4 at -30,0+160]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F58,U+0F9F,U+0F7C,U+0F7A,U+0F42,U+0F0B:[uni0F580F9F0F7C0F7A=0+660|uni0F42=4+680|uni0F0B=5+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F58,U+0F7C,U+0F7A,U+0F44,U+0F0B:[uni0F58=0+660|uni0F7C0F7A=0+0|uni0F44=3+560|uni0F0B=4 at -20,0+110]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F42,U+0F59,U+0F74,U+0F7C,U+0F62,U+0F0B:[uni0F42=0+680|uni0F590F74=1+620|uni0F7C=1+0|uni0F62=4+620|uni0F0B=5 at -65,0+130]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F58,U+0F5A,U+0FAE,U+0F74,U+0F7E,U+0F66,U+0F0B:[uni0F58=0+660|uni0F5A0FAE0F740F7E=1+620|uni0F66=5+680|uni0F0B=6+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F62,U+0FAB,U+0F74,U+0F7A,U+0F66,U+0F0B:[uni0F620FAB0F74=0+660|uni0F7A=0+0|uni0F66=4+680|uni0F0B=5+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F62,U+0FAB,U+0F74,U+0F7A,U+0F53,U+0F0B:[uni0F620FAB0F74=0+660|uni0F7A=0+0|uni0F53=4+590|uni0F0B=5 at -30,0+160]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F5E,U+0F74,U+0F7C,U+0F63,U+0F0B:[uni0F5E0F74=0+660|uni0F7C=0+0|uni0F63=3+700|uni0F0B=4+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F42,U+0F5E,U+0F74,U+0F7C,U+0F42,U+0F0B:[uni0F42=0+680|uni0F5E0F74=1+660|uni0F7C=1+0|uni0F42=4+680|uni0F0B=5+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F42,U+0F5E,U+0F74,U+0F7C,U+0F58,U+0F66,U+0F0B:[uni0F42=0+680|uni0F5E0F74=1+660|uni0F7C=1+0|uni0F58=4+660|uni0F66=5+680|uni0F0B=6+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F42,U+0F5F,U+0F74,U+0F7C,U+0F0B:[uni0F42=0+680|uni0F5F0F74=1+610|uni0F7C=1+0|uni0F0B=4+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F42,U+0F5F,U+0F74,U+0F72,U+0F44,U+0F0B:[uni0F42=0+680|uni0F5F0F740F72=1+610|uni0F44=4+560|uni0F0B=5 at -20,0+110]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F42,U+0F5F,U+0F74,U+0F7A,U+0F62,U+0F0B:[uni0F42=0+680|uni0F5F0F74=1+610|uni0F7A=1+0|uni0F62=4+620|uni0F0B=5 at -65,0+130]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F42,U+0F5F,U+0F74,U+0F7A,U+0F62,U+0F0B:[uni0F42=0+680|uni0F5F0F74=1+610|uni0F7A=1+0|uni0F62=4+620|uni0F0B=5 at -65,0+130]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F42,U+0F5F,U+0F74,U+0F7A,U+0F51,U+0F0B:[uni0F42=0+680|uni0F5F0F74=1+610|uni0F7A=1+0|uni0F51=4+600|uni0F0B=5 at -70,0+106]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F60,U+0F7C,U+0F7A,U+0F62,U+0F0B:[uni0F60=0+600|uni0F7C0F7A=0+0|uni0F62=3+620|uni0F0B=4 at -65,0+130]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F61,U+0F72,U+0F7A,U+0F0B:[uni0F61=0+700|uni0F720F7A=0+0|uni0F0B=3+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F61,U+0F7A,U+0F7A,U+0F66,U+0F0B:[uni0F61=0+700|uni0F7B=0+0|uni0F66=3+680|uni0F0B=4+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F62,U+0F72,U+0F53,U+0F7C,U+0F7A,U+0F0B:[uni0F620F72=0+620|uni0F530F7C0F7A=2+590|uni0F0B=5+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F62,U+0F74,U+0F7C,U+0F63,U+0F0B:[uni0F620F74=0+601|uni0F7C=0+0|uni0F63=3+700|uni0F0B=4+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F66,U+0F7A,U+0F7E,U+0F53,U+0F0B:[uni0F66=0+680|uni0F7A0F7E=0+0|uni0F53=3+590|uni0F0B=4 at -30,0+160]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F66,U+0F7A,U+0F7E,U+0F51,U+0F60,U+0F0B:[uni0F66=0+680|uni0F7A0F7E=0+0|uni0F51=3+600|uni0F60=4+600|uni0F0B=5 at -40,0+150]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F66,U+0F7C,U+0F7C,U+0F56,U+0F0B:[uni0F660F7D=0+680|uni0F56=3+610|uni0F0B=4+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F66,U+0F7C,U+0F7C,U+0F62,U+0F0B:[uni0F660F7D=0+680|uni0F62=3+620|uni0F0B=4 at -65,0+130]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F66,U+0FB2,U+0F7C,U+0F7A,U+0F66,U+0F0B:[uni0F660FB2=0+680|uni0F7C0F7A=0+0|uni0F66=4+680|uni0F0B=5+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F66,U+0FB3,U+0F7C,U+0F7C,U+0F51,U+0F0B:[uni0F660FB3=0+680|uni0F7D=0+0|uni0F51=4+600|uni0F0B=5 at -70,0+106]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F66,U+0FB3,U+0F7C,U+0F7C,U+0F53,U+0F0B:[uni0F660FB3=0+680|uni0F7D=0+0|uni0F53=4+590|uni0F0B=5 at -30,0+160]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F56,U+0F66,U+0F99,U+0F7C,U+0F7E,U+0F51,U+0F66,U+0F0B:[uni0F56=0+610|uni0F660F99=1+670|uni0F7C0F7E=1+0|uni0F51=5+600|uni0F66=6+680|uni0F0B=7+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F63,U+0FB7,U+0FB1,U+0F7C,U+0F42,U+0F66,U+0F0B:[uni0F630FB70FB1=0+680|uni0F7C=0+0|uni0F42=4+680|uni0F66=5+680|uni0F0B=6+190]
+fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf::U+0F68,U+0FB1,U+0F7C,U+0F53,U+0F0B:[uni0F680FB1=0+740|uni0F7C=0+0|uni0F53=3+590|uni0F0B=4 at -30,0+160]
diff --git a/test/shaping/tests/tibetan-vowels.tests b/test/shaping/tests/tibetan-vowels.tests
new file mode 100644
index 00000000..75e13c8a
--- /dev/null
+++ b/test/shaping/tests/tibetan-vowels.tests
@@ -0,0 +1,11 @@
+fonts/sha1sum/82f4f3b57bb55344e72e70231380202a52af5805.ttf::U+0F68,U+0F72:[uni0F680F72=0+730]
+fonts/sha1sum/82f4f3b57bb55344e72e70231380202a52af5805.ttf::U+0F68,U+0F74:[uni0F680F74=0+730]
+fonts/sha1sum/82f4f3b57bb55344e72e70231380202a52af5805.ttf::U+0F68,U+0F7A:[uni0F680F7A=0+730]
+fonts/sha1sum/82f4f3b57bb55344e72e70231380202a52af5805.ttf::U+0F68,U+0F7C:[uni0F680F7C=0+730]
+fonts/sha1sum/82f4f3b57bb55344e72e70231380202a52af5805.ttf::U+0F68,U+0F71,U+0F72:[uni0F680F710F72=0+720]
+fonts/sha1sum/82f4f3b57bb55344e72e70231380202a52af5805.ttf::U+0F68,U+0F71,U+0F74:[uni0F680F75=0+720]
+fonts/sha1sum/82f4f3b57bb55344e72e70231380202a52af5805.ttf::U+0F68,U+0F7B:[uni0F680F7B=0+720]
+fonts/sha1sum/82f4f3b57bb55344e72e70231380202a52af5805.ttf::U+0F68,U+0F7D:[uni0F680F7D=0+730]
+fonts/sha1sum/82f4f3b57bb55344e72e70231380202a52af5805.ttf::U+0F68,U+0F7E:[uni0F680F7E=0+730]
+fonts/sha1sum/82f4f3b57bb55344e72e70231380202a52af5805.ttf::U+0F68,U+0F7F:[uni0F68=0+730|uni0F7F=0+408]
+fonts/sha1sum/82f4f3b57bb55344e72e70231380202a52af5805.ttf::U+0F00:[uni0F00=0+730]
commit 4e21ec546932c2a982aa52fce718c1a0d90a71d6
Author: Dominik Schlösser <dominik.schloesser at gmail.com>
Date:   Fri Jul 14 13:14:23 2017 +0200

    Fix for reordering of Tibetan vowel u (#443)
    
    * Undone change for Tibetan vowel u
    
    * removed comment on reordering that became invalid with roll-back
    
    * Support for Dzongkha contractions with multiple vowel-signs
    
    * Removed non-functional and unnecessary defines for HB_MODIFIED_COMBINING_CLASS_CCC138,140

diff --git a/src/hb-unicode-private.hh b/src/hb-unicode-private.hh
index 75b55c02..aa86a72c 100644
--- a/src/hb-unicode-private.hh
+++ b/src/hb-unicode-private.hh
@@ -346,12 +346,13 @@ extern HB_INTERNAL const hb_unicode_funcs_t _hb_unicode_funcs_nil;
 #define HB_MODIFIED_COMBINING_CLASS_CCC122 122 /* mai * */
 
 /* Tibetan
- * Modify U+0F74 (ccc=132) to reorder before ccc=130 marks.
+ * 
+ * In case of multiple vowel-signs, use u first (but after achung) 
+ * this allows Dzongkha multi-vowel shortcuts to render correctly 
  */
 #define HB_MODIFIED_COMBINING_CLASS_CCC129 129 /* sign aa */
-#define HB_MODIFIED_COMBINING_CLASS_CCC130 130 /* sign i */
-#define HB_MODIFIED_COMBINING_CLASS_CCC132 128 /* sign u */
-
+#define HB_MODIFIED_COMBINING_CLASS_CCC130 132 /* sign i */
+#define HB_MODIFIED_COMBINING_CLASS_CCC132 131 /* sign u */
 
 /* Misc */
 
commit ad52e044bcf733bcc6c0373bafcd78a8c0beb400
Author: fanc999 <fanc999 at yahoo.com.tw>
Date:   Wed Jun 21 22:19:57 2017 +0800

    Win32/NMake builds: Support builds from GIT (#498)
    
    Add Python scripts to generate the full win32/config.h.win32 and
    src/hb-version.h which can be used to build directly from a GIT
    checkout.  Since the scripts are currently intended for building from a
    GIT checkout, these are not distributed in the release tarballs.
    
    Also, support the re-build of Ragel-generated .hh headers using the NMake
    build system, and allow one to specify the path of the Ragel executable
    if a suitable one cannot be found in the PATH.
    
    Update the Win32/NMake build documentation to let people know about how
    these mechanisms can be utilized.

diff --git a/win32/README.txt b/win32/README.txt
index dc31e8b6..90554c01 100644
--- a/win32/README.txt
+++ b/win32/README.txt
@@ -11,7 +11,22 @@ backends are enabled, and this is the base configuration that is built if no
 options (see below) are specified.  A 'clean' target is provided-it is recommended
 that one cleans the build and redo the build if any configuration option changed.
 An 'install' target is also provided to copy the built items in their appropriate
-locations under $(PREFIX), which is described below.
+locations under $(PREFIX), which is described below.  A 'reallyclean' target is
+provided that not only does what is done for the 'clean' target, but also removes
+the sources/headers that are generated from the Ragel sources.  Therefore, if one
+is not building from a release tarball, or is rebuilding after using the 'reallyclean'
+target or when the Ragel (*.rl) sources are updated, the Ragel state machine
+compiler (ragel.exe) is needed, and needs to be passed in via RAGEL=<path_to_ragel_exe>
+if ragel.exe is not already in the PATH.
+
+We now support building from a GIT checkout via NMake for convenience.  In addition to
+the requirements as outlined in the later part of this file, you will need to run the
+setup.py (Python 2.7.x or later) script to generate the headers (src\hb-version.h and
+win32\config.h.win32) that are normally shipped in a release tarball before running
+NMake, and you will need to pass RAGEL=<path_to_ragel_exe> if the Ragel state machine
+compiler (ragel.exe) is not in your PATH when invoking NMake.  Note that the
+'reallyclean' target does not remove these 2 generated headers, so re-run the setup.py
+script if necessary.
 
 Invoke the build by issuing the command:
 nmake /f Makefile.vc CFG=[release|debug] [PREFIX=...] <option1=1 option2=1 ...>
@@ -32,6 +47,7 @@ PREFIX: Optional.  Base directory of where the third-party headers, libraries
         2012: 11
         2013: 12
         2015: 14
+        2017: 15
 
 Explanation of options, set by <option>=1:
 ------------------------------------------
@@ -75,4 +91,6 @@ PYTHON: Full path to the Python interpretor to be used, if it is not in %PATH%.
 
 PERL: Full path to the PERL interpretor to be used, if it is not in %PATH%.
 
+RAGEL: Full path to the Ragel state machine compiler executable, if not in %PATH%
+
 LIBTOOL_DLL_NAME: Enable libtool-style DLL names.
diff --git a/win32/build-rules-msvc.mak b/win32/build-rules-msvc.mak
index bfe02864..5408ead6 100644
--- a/win32/build-rules-msvc.mak
+++ b/win32/build-rules-msvc.mak
@@ -52,7 +52,7 @@ $(CFG)\$(PLAT)\harfbuzz-gobject.lib: $(HARFBUZZ_GOBJECT_DLL_FILENAME).dll
 # $(dependent_objects)
 # <<
 # 	@-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
-$(HARFBUZZ_DLL_FILENAME).dll: config.h $(harfbuzz_dll_OBJS) $(CFG)\$(PLAT)\harfbuzz
+$(HARFBUZZ_DLL_FILENAME).dll: config.h $(HB_RAGEL_GENERATED_ACTUAL_SOURCES) $(harfbuzz_dll_OBJS) $(CFG)\$(PLAT)\harfbuzz
 	link /DLL $(LDFLAGS) $(HB_DEP_LIBS) /implib:$(CFG)\$(PLAT)\harfbuzz.lib -out:$@ @<<
 $(harfbuzz_dll_OBJS)
 <<
@@ -125,3 +125,6 @@ clean:
 	@-if exist $(CFG)\$(PLAT)\harfbuzz-gobject\hb-gobject-enums.cc del $(CFG)\$(PLAT)\harfbuzz-gobject\hb-gobject-enums.cc
 	@-del vc$(VSVER)0.pdb
 	@-del config.h
+
+reallyclean: clean
+	@-del /f /q $(HB_RAGEL_GENERATED_ACTUAL_SOURCES)
diff --git a/win32/config-msvc.mak b/win32/config-msvc.mak
index 6865bed6..dfdf3cd9 100644
--- a/win32/config-msvc.mak
+++ b/win32/config-msvc.mak
@@ -30,6 +30,11 @@ UNISCRIBE_LIB = usp10.lib gdi32.lib rpcrt4.lib user32.lib
 # Directwrite is needed for DirectWrite shaping support
 DIRECTWRITE_LIB = dwrite.lib
 
+# Full path to Ragel state machine compiler if not already in PATH
+!if "$(RAGEL)" == ""
+RAGEL = ragel
+!endif
+
 # Please do not change anything beneath this line unless maintaining the NMake Makefiles
 # Bare minimum features and sources built into HarfBuzz on Windows
 HB_DEFINES =
@@ -48,6 +53,8 @@ HB_HEADERS =	\
 	$(HB_NODIST_headers)	\
 	$(HB_OT_headers)
 
+RAGEL_RAW_GEN_SRCS = $(HB_OT_RAGEL_GENERATED_sources) $(HB_BASE_RAGEL_GENERATED_sources)
+
 # Minimal set of (system) libraries needed for the HarfBuzz DLL
 HB_DEP_LIBS =
 
diff --git a/win32/create-lists-msvc.mak b/win32/create-lists-msvc.mak
index dbd2a579..2be0e987 100644
--- a/win32/create-lists-msvc.mak
+++ b/win32/create-lists-msvc.mak
@@ -132,6 +132,15 @@ NULL=
 !if [call create-lists.bat footer hb_srcs.mak]
 !endif
 
+!if [call create-lists.bat header hb_srcs.mak HB_RAGEL_GENERATED_ACTUAL_SOURCES]
+!endif
+
+!if [for %s in ($(RAGEL_RAW_GEN_SRCS)) do @call create-lists.bat file hb_srcs.mak ..\src\%s]
+!endif
+
+!if [call create-lists.bat footer hb_srcs.mak]
+!endif
+
 !include hb_srcs.mak
 
 !if [del /f /q hb_srcs.mak]
diff --git a/win32/generate-msvc.mak b/win32/generate-msvc.mak
index 32214ebb..b0727d50 100644
--- a/win32/generate-msvc.mak
+++ b/win32/generate-msvc.mak
@@ -24,3 +24,9 @@ $(HB_GOBJECT_ENUM_GENERATED_SOURCES): ..\src\hb-gobject-enums.h.tmpl ..\src\hb-g
 # Create the build directories
 $(CFG)\$(PLAT)\harfbuzz $(CFG)\$(PLAT)\harfbuzz-gobject $(CFG)\$(PLAT)\util:
 	@-md $@
+
+.SUFFIXES: .c .cc .hh .rl
+
+# Generate headers from Ragel sources
+{..\src\}.rl{..\src\}.hh:
+	$(RAGEL) -e -F1 -o $@ $<
diff --git a/win32/info-msvc.mak b/win32/info-msvc.mak
index 70daf762..4586548c 100644
--- a/win32/info-msvc.mak
+++ b/win32/info-msvc.mak
@@ -133,10 +133,16 @@ help:
 	@echo NO_UCDN:
 	@echo Do not use the bundled Unicode callback, which is the default.  GLib or
 	@echo ICU-based unicode callback is therefore required.
-	@echo
+	@echo.
 	@echo UNISCRIBE:
 	@echo Enable Uniscribe support.
 	@echo.
+	@echo RAGEL:
+	@echo Set the full path to the Ragel state machine compiler, if not already in
+	@echo PATH.  The Ragel state machine compiler is required if not building from
+	@echo a release tarball, or a rebuild is to be carried out after using the
+	@echo 'reallyclean' target.
+	@echo.
 	@echo Note that GLib2 support is required for all utility and test programs.
 	@echo ======
 	@echo A 'clean' target is supported to remove all generated files, intermediate
diff --git a/win32/pc_base.py b/win32/pc_base.py
new file mode 100644
index 00000000..f7976e8d
--- /dev/null
+++ b/win32/pc_base.py
@@ -0,0 +1,124 @@
+#!/usr/bin/python
+#
+# Simple utility script to generate the basic info
+# needed in a .pc (pkg-config) file, used especially
+# for introspection purposes
+
+# This can be used in various projects where
+# there is the need to generate .pc files,
+# and is copied from GLib's $(srcroot)/win32
+
+# Author: Fan, Chun-wei
+# Date: March 10, 2016
+
+import os
+import sys
+import argparse
+
+class BasePCItems:
+    def __init__(self):
+        self.base_replace_items = {}
+        self.exec_prefix = ''
+        self.includedir = ''
+        self.libdir = ''
+        self.prefix = ''
+        self.srcdir = os.path.dirname(__file__)
+        self.top_srcdir = self.srcdir + '\\..'
+        self.version = ''
+
+    def setup(self, argv, parser=None):
+        if parser is None:
+            parser = argparse.ArgumentParser(description='Setup basic .pc file info')
+        parser.add_argument('--prefix', help='prefix of the installed library',
+                            required=True)
+        parser.add_argument('--exec-prefix',
+                            help='prefix of the installed programs, \
+                                  if different from the prefix')
+        parser.add_argument('--includedir',
+                            help='includedir of the installed library, \
+                                  if different from ${prefix}/include')
+        parser.add_argument('--libdir',
+                            help='libdir of the installed library, \
+                                  if different from ${prefix}/lib')
+        parser.add_argument('--version', help='Version of the package',
+                            required=True)
+        args = parser.parse_args()
+
+        self.version = args.version
+
+        # check whether the prefix and exec_prefix are valid
+        if not os.path.exists(args.prefix):
+            raise SystemExit('Specified prefix \'%s\' is invalid' % args.prefix)
+
+        # use absolute paths for prefix
+        self.prefix = os.path.abspath(args.prefix).replace('\\','/')
+
+        # check and setup the exec_prefix
+        if getattr(args, 'exec_prefix', None) is None:
+            exec_prefix_use_shorthand = True
+            self.exec_prefix = '${prefix}'
+        else:
+            if args.exec_prefix.startswith('${prefix}'):
+                exec_prefix_use_shorthand = True
+                input_exec_prefix = args.prefix + args.exec_prefix[len('${prefix}'):]
+            else:
+                exec_prefix_use_shorthand = False
+                input_exec_prefix = args.exec_prefix
+            if not os.path.exists(input_exec_prefix):
+                raise SystemExit('Specified exec_prefix \'%s\' is invalid' %
+                                  args.exec_prefix)
+            if exec_prefix_use_shorthand is True:
+                self.exec_prefix = args.exec_prefix.replace('\\','/')
+            else:
+                self.exec_prefix = os.path.abspath(input_exec_prefix).replace('\\','/')
+
+        # check and setup the includedir
+        if getattr(args, 'includedir', None) is None:
+            self.includedir = '${prefix}/include'
+        else:
+            if args.includedir.startswith('${prefix}'):
+                includedir_use_shorthand = True
+                input_includedir = args.prefix + args.includedir[len('${prefix}'):]
+            else:
+                if args.includedir.startswith('${exec_prefix}'):
+                    includedir_use_shorthand = True
+                    input_includedir = input_exec_prefix + args.includedir[len('${exec_prefix}'):]
+                else:
+                    includedir_use_shorthand = False
+                    input_includedir = args.includedir
+            if not os.path.exists(input_includedir):
+                raise SystemExit('Specified includedir \'%s\' is invalid' %
+                                  args.includedir)
+            if includedir_use_shorthand is True:
+                self.includedir = args.includedir.replace('\\','/')
+            else:
+                self.includedir = os.path.abspath(input_includedir).replace('\\','/')
+
+        # check and setup the libdir
+        if getattr(args, 'libdir', None) is None:
+            self.libdir = '${prefix}/lib'
+        else:
+            if args.libdir.startswith('${prefix}'):
+                libdir_use_shorthand = True
+                input_libdir = args.prefix + args.libdir[len('${prefix}'):]
+            else:
+                if args.libdir.startswith('${exec_prefix}'):
+                    libdir_use_shorthand = True
+                    input_libdir = input_exec_prefix + args.libdir[len('${exec_prefix}'):]
+                else:
+                    libdir_use_shorthand = False
+                    input_libdir = args.libdir
+            if not os.path.exists(input_libdir):
+                raise SystemExit('Specified libdir \'%s\' is invalid' %
+			                      args.libdir)
+            if libdir_use_shorthand is True:
+                self.libdir = args.libdir.replace('\\','/')
+            else:
+                self.libdir = os.path.abspath(input_libdir).replace('\\','/')
+
+        # setup dictionary for replacing items in *.pc.in
+        self.base_replace_items.update({'@VERSION@': self.version})
+        self.base_replace_items.update({'@prefix@': self.prefix})
+        self.base_replace_items.update({'@exec_prefix@': self.exec_prefix})
+        self.base_replace_items.update({'@libdir@': self.libdir})
+        self.base_replace_items.update({'@includedir@': self.includedir})
diff --git a/win32/replace.py b/win32/replace.py
new file mode 100644
index 00000000..3aeceb1f
--- /dev/null
+++ b/win32/replace.py
@@ -0,0 +1,115 @@
+#!/usr/bin/python
+#
+# Simple utility script to manipulate
+# certain types of strings in a file
+
+# This can be used in various projects where
+# there is the need to replace strings in files,
+# and is copied from GLib's $(srcroot)/win32
+
+# Author: Fan, Chun-wei
+# Date: September 03, 2014
+
+import os
+import sys
+import re
+import string
+import argparse
+
+valid_actions = ['remove-prefix',
+                 'replace-var',
+                 'replace-str',
+                 'remove-str']
+
+def open_file(filename, mode):
+    if sys.version_info[0] < 3:
+        return open(filename, mode=mode)
+    else:
+        return open(filename, mode=mode, encoding='utf-8')
+
+def replace_multi(src, dest, replace_items):
+    with open_file(src, 'r') as s:
+        with open_file(dest, 'w') as d:
+            for line in s:
+                replace_dict = dict((re.escape(key), value) \
+                               for key, value in replace_items.items())
+                replace_pattern = re.compile("|".join(replace_dict.keys()))
+                d.write(replace_pattern.sub(lambda m: \
+                        replace_dict[re.escape(m.group(0))], line))
+
+def replace(src, dest, instring, outstring):
+    replace_item = {instring: outstring}
+    replace_multi(src, dest, replace_item)
+
+def check_required_args(args, params):
+    for param in params:
+        if getattr(args, param, None) is None:
+            raise SystemExit('%s: error: --%s argument is required' % (__file__, param))
+
+def warn_ignored_args(args, params):
+    for param in params:
+        if getattr(args, param, None) is not None:
+            print('%s: warning: --%s argument is ignored' % (__file__, param))
+
+def main(argv):
+
+    parser = argparse.ArgumentParser(description='Process strings in a file.')
+    parser.add_argument('-a',
+                        '--action',
+                        help='Action to carry out.  Can be one of:\n'
+                             'remove-prefix\n'
+                             'replace-var\n'
+                             'replace-str\n'
+                             'remove-str',
+                        choices=valid_actions)
+    parser.add_argument('-i', '--input', help='Input file')
+    parser.add_argument('-o', '--output', help='Output file')
+    parser.add_argument('--instring', help='String to replace or remove')
+    parser.add_argument('--var', help='Autotools variable name to replace')
+    parser.add_argument('--outstring',
+                        help='New String to replace specified string or variable')
+    parser.add_argument('--removeprefix', help='Prefix of string to remove')
+
+    args = parser.parse_args()
+
+    input_string = ''
+    output_string = ''
+
+    # We must have action, input, output for all operations
+    check_required_args(args, ['action','input','output'])
+
+    # Build the arguments by the operation that is to be done,
+    # to be fed into replace()
+
+    # Get rid of prefixes from a string
+    if args.action == 'remove-prefix':
+        check_required_args(args, ['instring','removeprefix'])
+        warn_ignored_args(args, ['outstring','var'])
+        input_string = args.removeprefix + args.instring
+        output_string = args.instring
+
+    # Replace an m4-style variable (those surrounded by @...@)
+    if args.action == 'replace-var':
+        check_required_args(args, ['var','outstring'])
+        warn_ignored_args(args, ['instring','removeprefix'])
+        input_string = '@' + args.var + '@'
+        output_string = args.outstring
+
+    # Replace a string
+    if args.action == 'replace-str':
+        check_required_args(args, ['instring','outstring'])
+        warn_ignored_args(args, ['var','removeprefix'])
+        input_string = args.instring
+        output_string = args.outstring
+
+    # Remove a string
+    if args.action == 'remove-str':
+        check_required_args(args, ['instring'])
+        warn_ignored_args(args, ['var','outstring','removeprefix'])
+        input_string = args.instring
+        output_string = ''
+
+    replace(args.input, args.output, input_string, output_string)
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
diff --git a/win32/setup.py b/win32/setup.py
new file mode 100644
index 00000000..c31b9e74
--- /dev/null
+++ b/win32/setup.py
@@ -0,0 +1,62 @@
+#!/usr/bin/python
+# vim: encoding=utf-8
+#expand *.in files
+#this script is only intended for building from git, not for building from the released tarball, which already includes all necessary files
+import os
+import sys
+import re
+import string
+import subprocess
+import optparse
+from pc_base import BasePCItems
+from replace import replace_multi
+
+def get_version_items(srcroot):
+    ver = {}
+    RE_VERSION_LINE_START = re.compile(r'^AC_INIT\(\[(.+)\], *\n')
+    RE_VERSION_LINE_BODY = re.compile(r'^        \[(.+)\], *\n')
+    RE_VERSION_LINE_END = re.compile(r'^        \[(.+)\]\) *\n')
+
+    # Read from the AC_INIT lines to get the version/name/URLs info
+    with open(os.path.join(srcroot, 'configure.ac'), 'r') as ac:
+        for i in ac:
+            mo_init = RE_VERSION_LINE_START.search(i)
+            mo_pkg_info = RE_VERSION_LINE_BODY.search(i)
+            mo_pkg_url = RE_VERSION_LINE_END.search(i)
+            if mo_init:
+                ver['@PACKAGE_NAME@'] = mo_init.group(1) 
+            if mo_pkg_info:
+                if mo_pkg_info.group(1).startswith('http'):
+                    ver['@PACKAGE_BUGREPORT@'] = mo_pkg_info.group(1)
+                elif mo_pkg_info.group(1)[0].isdigit():
+                    ver['@PACKAGE_VERSION@'] = mo_pkg_info.group(1)
+                else:
+                    ver['@PACKAGE_TARNAME@'] = mo_pkg_info.group(1)
+            if mo_pkg_url:
+                ver['@PACKAGE_URL@'] = mo_pkg_url.group(1)
+            
+    ver['@HB_VERSION@'] = ver['@PACKAGE_VERSION@']
+
+    pkg_ver_parts = ver['@PACKAGE_VERSION@'].split('.')
+    ver['@HB_VERSION_MAJOR@'] = pkg_ver_parts[0]
+    ver['@HB_VERSION_MINOR@'] = pkg_ver_parts[1]
+    ver['@HB_VERSION_MICRO@'] = pkg_ver_parts[2]
+    return ver
+
+def main(argv):
+    pc = BasePCItems()
+    srcroot = pc.top_srcdir
+    srcdir = pc.srcdir
+    ver = get_version_items(srcroot)
+
+    replace_multi(os.path.join(srcdir, 'config.h.win32.in'),
+                  os.path.join(srcdir, 'config.h.win32'),
+                  ver)
+
+    replace_multi(os.path.join(srcroot, 'src', 'hb-version.h.in'),
+                  os.path.join(srcroot, 'src', 'hb-version.h'),
+                  ver)
+    return 0
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
commit 3b0e47ca006b8fe6a24ace72dd931e3649bb8e6f
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date:   Mon Jun 19 14:47:09 2017 +0430

    Fix arm-none-eabi build (fixes #451) (#496)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b25cac0d..ee313566 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,7 +71,7 @@ endif ()
 
 ## Detect if we are running inside a distribution or regular repository folder
 set(IN_HB_DIST FALSE)
-if (EXISTS "${PROJECT_SOURCE_DIR}/src/hb-version.h")
+if (EXISTS "${PROJECT_SOURCE_DIR}/ChangeLog")
   # perhaps we are on dist directory
   set(IN_HB_DIST TRUE)
   set(HB_VERSION_H "${PROJECT_SOURCE_DIR}/src/hb-version.h")
@@ -128,7 +128,7 @@ set(HB_VERSION_MICRO ${CMAKE_MATCH_4})
 
 ## Define ragel tasks
 if (NOT IN_HB_DIST)
-  find_program(RAGEL "ragel")
+  find_program(RAGEL "ragel" CMAKE_FIND_ROOT_PATH_BOTH)
 
   if (RAGEL)
     message(STATUS "ragel found at: ${RAGEL}")
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index 3940a3db..3777f7f8 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -552,7 +552,7 @@ hb_buffer_t::merge_clusters_impl (unsigned int start,
   if (cluster_level == HB_BUFFER_CLUSTER_LEVEL_CHARACTERS)
     return;
 
-  unsigned int cluster = info[start].cluster;
+  uint32_t cluster = info[start].cluster;
 
   for (unsigned int i = start + 1; i < end; i++)
     cluster = MIN (cluster, info[i].cluster);
@@ -583,7 +583,7 @@ hb_buffer_t::merge_out_clusters (unsigned int start,
   if (unlikely (end - start < 2))
     return;
 
-  unsigned int cluster = out_info[start].cluster;
+  uint32_t cluster = out_info[start].cluster;
 
   for (unsigned int i = start + 1; i < end; i++)
     cluster = MIN (cluster, out_info[i].cluster);
diff --git a/src/hb-common.cc b/src/hb-common.cc
index 4716cfb3..0483816d 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
@@ -671,6 +671,30 @@ parse_uint (const char **pp, const char *end, unsigned int *pv)
 }
 
 static bool
+parse_uint32 (const char **pp, const char *end, uint32_t *pv)
+{
+  char buf[32];
+  unsigned int len = MIN (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - *pp));
+  strncpy (buf, *pp, len);
+  buf[len] = '\0';
+
+  char *p = buf;
+  char *pend = p;
+  unsigned int v;
+
+  /* Intentionally use strtol instead of strtoul, such that
+   * -1 turns into "big number"... */
+  errno = 0;
+  v = strtol (p, &pend, 0);
+  if (errno || p == pend)
+    return false;
+
+  *pv = v;
+  *pp += pend - p;
+  return true;
+}
+
+static bool
 parse_float (const char **pp, const char *end, float *pv)
 {
   char buf[32];
@@ -693,7 +717,7 @@ parse_float (const char **pp, const char *end, float *pv)
 }
 
 static bool
-parse_bool (const char **pp, const char *end, unsigned int *pv)
+parse_bool (const char **pp, const char *end, uint32_t *pv)
 {
   parse_space (pp, end);
 
@@ -792,7 +816,7 @@ static bool
 parse_feature_value_postfix (const char **pp, const char *end, hb_feature_t *feature)
 {
   bool had_equal = parse_char (pp, end, '=');
-  bool had_value = parse_uint (pp, end, &feature->value) ||
+  bool had_value = parse_uint32 (pp, end, &feature->value) ||
                    parse_bool (pp, end, &feature->value);
   /* CSS doesn't use equal-sign between tag and value.
    * If there was an equal-sign, then there *must* be a value.
diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc
index 009db20a..2ce29cdf 100644
--- a/src/hb-ot-font.cc
+++ b/src/hb-ot-font.cc
@@ -138,7 +138,7 @@ struct hb_ot_face_metrics_accelerator_t
 	return this->default_advance;
     }
 
-    return this->table->longMetric[MIN (glyph, this->num_advances - 1)].advance
+    return this->table->longMetric[MIN (glyph, (uint32_t) this->num_advances - 1)].advance
 	 + this->var->get_advance_var (glyph, font->coords, font->num_coords); // TODO Optimize?!
   }
 };
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 7f4e0184..5b781a72 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -279,7 +279,7 @@ hb_ot_layout_get_ligature_carets (hb_font_t      *font,
 				  hb_codepoint_t  glyph,
 				  unsigned int    start_offset,
 				  unsigned int   *caret_count /* IN/OUT */,
-				  int            *caret_array /* OUT */)
+				  hb_position_t  *caret_array /* OUT */)
 {
   return _get_gdef (font->face).get_lig_carets (font, direction, glyph, start_offset, caret_count, caret_array);
 }
diff --git a/src/hb-ot-shape-complex-arabic-table.hh b/src/hb-ot-shape-complex-arabic-table.hh
index 736c7f76..228f3665 100644
--- a/src/hb-ot-shape-complex-arabic-table.hh
+++ b/src/hb-ot-shape-complex-arabic-table.hh
@@ -139,28 +139,28 @@ joining_type (hb_codepoint_t u)
   switch (u >> 12)
   {
     case 0x0u:
-      if (hb_in_range (u, 0x0600u, 0x08E2u)) return joining_table[u - 0x0600u + joining_offset_0x0600u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x0600u, 0x08E2u)) return joining_table[u - 0x0600u + joining_offset_0x0600u];
       break;
 
     case 0x1u:
-      if (hb_in_range (u, 0x1806u, 0x18AAu)) return joining_table[u - 0x1806u + joining_offset_0x1806u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x1806u, 0x18AAu)) return joining_table[u - 0x1806u + joining_offset_0x1806u];
       break;
 
     case 0x2u:
-      if (hb_in_range (u, 0x200Cu, 0x2069u)) return joining_table[u - 0x200Cu + joining_offset_0x200cu];
+      if (hb_in_range<hb_codepoint_t> (u, 0x200Cu, 0x2069u)) return joining_table[u - 0x200Cu + joining_offset_0x200cu];
       break;
 
     case 0xAu:
-      if (hb_in_range (u, 0xA840u, 0xA873u)) return joining_table[u - 0xA840u + joining_offset_0xa840u];
+      if (hb_in_range<hb_codepoint_t> (u, 0xA840u, 0xA873u)) return joining_table[u - 0xA840u + joining_offset_0xa840u];
       break;
 
     case 0x10u:
-      if (hb_in_range (u, 0x10AC0u, 0x10AEFu)) return joining_table[u - 0x10AC0u + joining_offset_0x10ac0u];
-      if (hb_in_range (u, 0x10B80u, 0x10BAFu)) return joining_table[u - 0x10B80u + joining_offset_0x10b80u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x10AC0u, 0x10AEFu)) return joining_table[u - 0x10AC0u + joining_offset_0x10ac0u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x10B80u, 0x10BAFu)) return joining_table[u - 0x10B80u + joining_offset_0x10b80u];
       break;
 
     case 0x1Eu:
-      if (hb_in_range (u, 0x1E900u, 0x1E943u)) return joining_table[u - 0x1E900u + joining_offset_0x1e900u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x1E900u, 0x1E943u)) return joining_table[u - 0x1E900u + joining_offset_0x1e900u];
       break;
 
     default:
diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc
index 57ffc1dc..c6609c57 100644
--- a/src/hb-ot-shape-complex-arabic.cc
+++ b/src/hb-ot-shape-complex-arabic.cc
@@ -345,7 +345,7 @@ mongolian_variation_selectors (hb_buffer_t *buffer)
   unsigned int count = buffer->len;
   hb_glyph_info_t *info = buffer->info;
   for (unsigned int i = 1; i < count; i++)
-    if (unlikely (hb_in_range (info[i].codepoint, 0x180Bu, 0x180Du)))
+    if (unlikely (hb_in_range<hb_codepoint_t> (info[i].codepoint, 0x180Bu, 0x180Du)))
       info[i].arabic_shaping_action() = info[i - 1].arabic_shaping_action();
 }
 
diff --git a/src/hb-ot-shape-complex-hangul.cc b/src/hb-ot-shape-complex-hangul.cc
index af505652..23e07e59 100644
--- a/src/hb-ot-shape-complex-hangul.cc
+++ b/src/hb-ot-shape-complex-hangul.cc
@@ -105,16 +105,16 @@ data_destroy_hangul (void *data)
 #define NCount (VCount * TCount)
 #define SCount (LCount * NCount)
 
-#define isCombiningL(u) (hb_in_range ((u), LBase, LBase+LCount-1))
-#define isCombiningV(u) (hb_in_range ((u), VBase, VBase+VCount-1))
-#define isCombiningT(u) (hb_in_range ((u), TBase+1, TBase+TCount-1))
-#define isCombinedS(u) (hb_in_range ((u), SBase, SBase+SCount-1))
+#define isCombiningL(u) (hb_in_range<hb_codepoint_t> ((u), LBase, LBase+LCount-1))
+#define isCombiningV(u) (hb_in_range<hb_codepoint_t> ((u), VBase, VBase+VCount-1))
+#define isCombiningT(u) (hb_in_range<hb_codepoint_t> ((u), TBase+1, TBase+TCount-1))
+#define isCombinedS(u) (hb_in_range<hb_codepoint_t> ((u), SBase, SBase+SCount-1))
 
-#define isL(u) (hb_in_ranges ((u), 0x1100u, 0x115Fu, 0xA960u, 0xA97Cu))
-#define isV(u) (hb_in_ranges ((u), 0x1160u, 0x11A7u, 0xD7B0u, 0xD7C6u))
-#define isT(u) (hb_in_ranges ((u), 0x11A8u, 0x11FFu, 0xD7CBu, 0xD7FBu))
+#define isL(u) (hb_in_ranges<hb_codepoint_t> ((u), 0x1100u, 0x115Fu, 0xA960u, 0xA97Cu))
+#define isV(u) (hb_in_ranges<hb_codepoint_t> ((u), 0x1160u, 0x11A7u, 0xD7B0u, 0xD7C6u))
+#define isT(u) (hb_in_ranges<hb_codepoint_t> ((u), 0x11A8u, 0x11FFu, 0xD7CBu, 0xD7FBu))
 
-#define isHangulTone(u) (hb_in_range ((u), 0x302Eu, 0x302Fu))
+#define isHangulTone(u) (hb_in_range<hb_codepoint_t> ((u), 0x302Eu, 0x302Fu))
 
 /* buffer var allocations */
 #define hangul_shaping_feature() complex_var_u8_0() /* hangul jamo shaping feature */
diff --git a/src/hb-ot-shape-complex-indic-table.cc b/src/hb-ot-shape-complex-indic-table.cc
index e10a4d25..3bf5285e 100644
--- a/src/hb-ot-shape-complex-indic-table.cc
+++ b/src/hb-ot-shape-complex-indic-table.cc
@@ -398,28 +398,28 @@ hb_indic_get_categories (hb_codepoint_t u)
   switch (u >> 12)
   {
     case 0x0u:
-      if (hb_in_range (u, 0x0028u, 0x003Fu)) return indic_table[u - 0x0028u + indic_offset_0x0028u];
-      if (hb_in_range (u, 0x00B0u, 0x00D7u)) return indic_table[u - 0x00B0u + indic_offset_0x00b0u];
-      if (hb_in_range (u, 0x0900u, 0x0DF7u)) return indic_table[u - 0x0900u + indic_offset_0x0900u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x0028u, 0x003Fu)) return indic_table[u - 0x0028u + indic_offset_0x0028u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x00B0u, 0x00D7u)) return indic_table[u - 0x00B0u + indic_offset_0x00b0u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x0900u, 0x0DF7u)) return indic_table[u - 0x0900u + indic_offset_0x0900u];
       if (unlikely (u == 0x00A0u)) return _(CP,x);
       break;
 
     case 0x1u:
-      if (hb_in_range (u, 0x1000u, 0x109Fu)) return indic_table[u - 0x1000u + indic_offset_0x1000u];
-      if (hb_in_range (u, 0x1780u, 0x17EFu)) return indic_table[u - 0x1780u + indic_offset_0x1780u];
-      if (hb_in_range (u, 0x1CD0u, 0x1CFFu)) return indic_table[u - 0x1CD0u + indic_offset_0x1cd0u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x1000u, 0x109Fu)) return indic_table[u - 0x1000u + indic_offset_0x1000u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x1780u, 0x17EFu)) return indic_table[u - 0x1780u + indic_offset_0x1780u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x1CD0u, 0x1CFFu)) return indic_table[u - 0x1CD0u + indic_offset_0x1cd0u];
       break;
 
     case 0x2u:
-      if (hb_in_range (u, 0x2008u, 0x2017u)) return indic_table[u - 0x2008u + indic_offset_0x2008u];
-      if (hb_in_range (u, 0x2070u, 0x2087u)) return indic_table[u - 0x2070u + indic_offset_0x2070u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x2008u, 0x2017u)) return indic_table[u - 0x2008u + indic_offset_0x2008u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x2070u, 0x2087u)) return indic_table[u - 0x2070u + indic_offset_0x2070u];
       if (unlikely (u == 0x25CCu)) return _(CP,x);
       break;
 
     case 0xAu:
-      if (hb_in_range (u, 0xA8E0u, 0xA8F7u)) return indic_table[u - 0xA8E0u + indic_offset_0xa8e0u];
-      if (hb_in_range (u, 0xA9E0u, 0xA9FFu)) return indic_table[u - 0xA9E0u + indic_offset_0xa9e0u];
-      if (hb_in_range (u, 0xAA60u, 0xAA7Fu)) return indic_table[u - 0xAA60u + indic_offset_0xaa60u];
+      if (hb_in_range<hb_codepoint_t> (u, 0xA8E0u, 0xA8F7u)) return indic_table[u - 0xA8E0u + indic_offset_0xa8e0u];
+      if (hb_in_range<hb_codepoint_t> (u, 0xA9E0u, 0xA9FFu)) return indic_table[u - 0xA9E0u + indic_offset_0xa9e0u];
+      if (hb_in_range<hb_codepoint_t> (u, 0xAA60u, 0xAA7Fu)) return indic_table[u - 0xAA60u + indic_offset_0xaa60u];
       break;
 
     case 0x11u:
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index ec12ce69..cbc46c8c 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -177,15 +177,15 @@ set_indic_properties (hb_glyph_info_t &info)
    */
 
   /* The following act more like the Bindus. */
-  if (unlikely (hb_in_range (u, 0x0953u, 0x0954u)))
+  if (unlikely (hb_in_range<hb_codepoint_t> (u, 0x0953u, 0x0954u)))
     cat = OT_SM;
   /* The following act like consonants. */
-  else if (unlikely (hb_in_ranges (u, 0x0A72u, 0x0A73u,
+  else if (unlikely (hb_in_ranges<hb_codepoint_t> (u, 0x0A72u, 0x0A73u,
 				      0x1CF5u, 0x1CF6u)))
     cat = OT_C;
   /* TODO: The following should only be allowed after a Visarga.
    * For now, just treat them like regular tone marks. */
-  else if (unlikely (hb_in_range (u, 0x1CE2u, 0x1CE8u)))
+  else if (unlikely (hb_in_range<hb_codepoint_t> (u, 0x1CE2u, 0x1CE8u)))
     cat = OT_A;
   /* TODO: The following should only be allowed after some of
    * the nasalization marks, maybe only for U+1CE9..U+1CF1.
@@ -193,7 +193,7 @@ set_indic_properties (hb_glyph_info_t &info)
   else if (unlikely (u == 0x1CEDu))
     cat = OT_A;
   /* The following take marks in standalone clusters, similar to Avagraha. */
-  else if (unlikely (hb_in_ranges (u, 0xA8F2u, 0xA8F7u,
+  else if (unlikely (hb_in_ranges<hb_codepoint_t> (u, 0xA8F2u, 0xA8F7u,
 				      0x1CE9u, 0x1CECu,
 				      0x1CEEu, 0x1CF1u)))
   {
@@ -201,7 +201,7 @@ set_indic_properties (hb_glyph_info_t &info)
     ASSERT_STATIC ((int) INDIC_SYLLABIC_CATEGORY_AVAGRAHA == OT_Symbol);
   }
   else if (unlikely (u == 0x17C6u)) cat = OT_N; /* Khmer Bindu doesn't like to be repositioned. */
-  else if (unlikely (hb_in_range (u, 0x2010u, 0x2011u)))
+  else if (unlikely (hb_in_range<hb_codepoint_t> (u, 0x2010u, 0x2011u)))
 				    cat = OT_PLACEHOLDER;
   else if (unlikely (u == 0x25CCu)) cat = OT_DOTTEDCIRCLE;
 
@@ -1738,7 +1738,7 @@ decompose_indic (const hb_ot_shape_normalize_context_t *c,
 #endif
   }
 
-  if ((ab == 0x0DDAu || hb_in_range (ab, 0x0DDCu, 0x0DDEu)))
+  if ((ab == 0x0DDAu || hb_in_range<hb_codepoint_t> (ab, 0x0DDCu, 0x0DDEu)))
   {
     /*
      * Sinhala split matras...  Let the fun begin.
diff --git a/src/hb-ot-shape-complex-myanmar.cc b/src/hb-ot-shape-complex-myanmar.cc
index bb68622e..4e912c36 100644
--- a/src/hb-ot-shape-complex-myanmar.cc
+++ b/src/hb-ot-shape-complex-myanmar.cc
@@ -175,7 +175,7 @@ set_myanmar_properties (hb_glyph_info_t &info)
   /* Myanmar
    * http://www.microsoft.com/typography/OpenTypeDev/myanmar/intro.htm#analyze
    */
-  if (unlikely (hb_in_range (u, 0xFE00u, 0xFE0Fu)))
+  if (unlikely (hb_in_range<hb_codepoint_t> (u, 0xFE00u, 0xFE0Fu)))
     cat = (indic_category_t) OT_VS;
 
   switch (u)
diff --git a/src/hb-ot-shape-complex-thai.cc b/src/hb-ot-shape-complex-thai.cc
index e6f80f59..e75b3537 100644
--- a/src/hb-ot-shape-complex-thai.cc
+++ b/src/hb-ot-shape-complex-thai.cc
@@ -52,7 +52,7 @@ get_consonant_type (hb_codepoint_t u)
     return RC;
   if (u == 0x0E0Eu || u == 0x0E0Fu)
     return DC;
-  if (hb_in_range (u, 0x0E01u, 0x0E2Eu))
+  if (hb_in_range<hb_codepoint_t> (u, 0x0E01u, 0x0E2Eu))
     return NC;
   return NOT_CONSONANT;
 }
@@ -70,12 +70,12 @@ enum thai_mark_type_t
 static thai_mark_type_t
 get_mark_type (hb_codepoint_t u)
 {
-  if (u == 0x0E31u || hb_in_range (u, 0x0E34u, 0x0E37u) ||
-      u == 0x0E47u || hb_in_range (u, 0x0E4Du, 0x0E4Eu))
+  if (u == 0x0E31u || hb_in_range<hb_codepoint_t> (u, 0x0E34u, 0x0E37u) ||
+      u == 0x0E47u || hb_in_range<hb_codepoint_t> (u, 0x0E4Du, 0x0E4Eu))
     return AV;
-  if (hb_in_range (u, 0x0E38u, 0x0E3Au))
+  if (hb_in_range<hb_codepoint_t> (u, 0x0E38u, 0x0E3Au))
     return BV;
-  if (hb_in_range (u, 0x0E48u, 0x0E4Cu))
+  if (hb_in_range<hb_codepoint_t> (u, 0x0E48u, 0x0E4Cu))
     return T;
   return NOT_MARK;
 }
@@ -310,7 +310,7 @@ preprocess_text_thai (const hb_ot_shape_plan_t *plan,
 #define IS_SARA_AM(x) (((x) & ~0x0080u) == 0x0E33u)
 #define NIKHAHIT_FROM_SARA_AM(x) ((x) - 0x0E33u + 0x0E4Du)
 #define SARA_AA_FROM_SARA_AM(x) ((x) - 1)
-#define IS_TONE_MARK(x) (hb_in_ranges ((x) & ~0x0080u, 0x0E34u, 0x0E37u, 0x0E47u, 0x0E4Eu, 0x0E31u, 0x0E31u))
+#define IS_TONE_MARK(x) (hb_in_ranges<hb_codepoint_t> ((x) & ~0x0080u, 0x0E34u, 0x0E37u, 0x0E47u, 0x0E4Eu, 0x0E31u, 0x0E31u))
 
   buffer->clear_output ();
   unsigned int count = buffer->len;
diff --git a/src/hb-ot-shape-complex-use-table.cc b/src/hb-ot-shape-complex-use-table.cc
index 38c46d00..416d7481 100644
--- a/src/hb-ot-shape-complex-use-table.cc
+++ b/src/hb-ot-shape-complex-use-table.cc
@@ -644,47 +644,47 @@ hb_use_get_categories (hb_codepoint_t u)
   switch (u >> 12)
   {
     case 0x0u:
-      if (hb_in_range (u, 0x0028u, 0x003Fu)) return use_table[u - 0x0028u + use_offset_0x0028u];
-      if (hb_in_range (u, 0x00A0u, 0x00D7u)) return use_table[u - 0x00A0u + use_offset_0x00a0u];
-      if (hb_in_range (u, 0x0900u, 0x0DF7u)) return use_table[u - 0x0900u + use_offset_0x0900u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x0028u, 0x003Fu)) return use_table[u - 0x0028u + use_offset_0x0028u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x00A0u, 0x00D7u)) return use_table[u - 0x00A0u + use_offset_0x00a0u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x0900u, 0x0DF7u)) return use_table[u - 0x0900u + use_offset_0x0900u];
       if (unlikely (u == 0x034Fu)) return CGJ;
       break;
 
     case 0x1u:
-      if (hb_in_range (u, 0x1000u, 0x109Fu)) return use_table[u - 0x1000u + use_offset_0x1000u];
-      if (hb_in_range (u, 0x1700u, 0x17EFu)) return use_table[u - 0x1700u + use_offset_0x1700u];
-      if (hb_in_range (u, 0x1900u, 0x1A9Fu)) return use_table[u - 0x1900u + use_offset_0x1900u];
-      if (hb_in_range (u, 0x1B00u, 0x1C4Fu)) return use_table[u - 0x1B00u + use_offset_0x1b00u];
-      if (hb_in_range (u, 0x1CD0u, 0x1CFFu)) return use_table[u - 0x1CD0u + use_offset_0x1cd0u];
-      if (hb_in_range (u, 0x1DF8u, 0x1DFFu)) return use_table[u - 0x1DF8u + use_offset_0x1df8u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x1000u, 0x109Fu)) return use_table[u - 0x1000u + use_offset_0x1000u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x1700u, 0x17EFu)) return use_table[u - 0x1700u + use_offset_0x1700u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x1900u, 0x1A9Fu)) return use_table[u - 0x1900u + use_offset_0x1900u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x1B00u, 0x1C4Fu)) return use_table[u - 0x1B00u + use_offset_0x1b00u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x1CD0u, 0x1CFFu)) return use_table[u - 0x1CD0u + use_offset_0x1cd0u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x1DF8u, 0x1DFFu)) return use_table[u - 0x1DF8u + use_offset_0x1df8u];
       break;
 
     case 0x2u:
-      if (hb_in_range (u, 0x2008u, 0x2017u)) return use_table[u - 0x2008u + use_offset_0x2008u];
-      if (hb_in_range (u, 0x2060u, 0x2087u)) return use_table[u - 0x2060u + use_offset_0x2060u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x2008u, 0x2017u)) return use_table[u - 0x2008u + use_offset_0x2008u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x2060u, 0x2087u)) return use_table[u - 0x2060u + use_offset_0x2060u];
       if (unlikely (u == 0x25CCu)) return GB;
       break;
 
     case 0xAu:
-      if (hb_in_range (u, 0xA800u, 0xAAF7u)) return use_table[u - 0xA800u + use_offset_0xa800u];
-      if (hb_in_range (u, 0xABC0u, 0xABFFu)) return use_table[u - 0xABC0u + use_offset_0xabc0u];
+      if (hb_in_range<hb_codepoint_t> (u, 0xA800u, 0xAAF7u)) return use_table[u - 0xA800u + use_offset_0xa800u];
+      if (hb_in_range<hb_codepoint_t> (u, 0xABC0u, 0xABFFu)) return use_table[u - 0xABC0u + use_offset_0xabc0u];
       break;
 
     case 0xFu:
-      if (hb_in_range (u, 0xFE00u, 0xFE0Fu)) return use_table[u - 0xFE00u + use_offset_0xfe00u];
+      if (hb_in_range<hb_codepoint_t> (u, 0xFE00u, 0xFE0Fu)) return use_table[u - 0xFE00u + use_offset_0xfe00u];
       break;
 
     case 0x10u:
-      if (hb_in_range (u, 0x10A00u, 0x10A47u)) return use_table[u - 0x10A00u + use_offset_0x10a00u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x10A00u, 0x10A47u)) return use_table[u - 0x10A00u + use_offset_0x10a00u];
       break;
 
     case 0x11u:
-      if (hb_in_range (u, 0x11000u, 0x110BFu)) return use_table[u - 0x11000u + use_offset_0x11000u];
-      if (hb_in_range (u, 0x11100u, 0x1123Fu)) return use_table[u - 0x11100u + use_offset_0x11100u];
-      if (hb_in_range (u, 0x11280u, 0x11377u)) return use_table[u - 0x11280u + use_offset_0x11280u];
-      if (hb_in_range (u, 0x11400u, 0x114DFu)) return use_table[u - 0x11400u + use_offset_0x11400u];
-      if (hb_in_range (u, 0x11580u, 0x1173Fu)) return use_table[u - 0x11580u + use_offset_0x11580u];
-      if (hb_in_range (u, 0x11C00u, 0x11CB7u)) return use_table[u - 0x11C00u + use_offset_0x11c00u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x11000u, 0x110BFu)) return use_table[u - 0x11000u + use_offset_0x11000u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x11100u, 0x1123Fu)) return use_table[u - 0x11100u + use_offset_0x11100u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x11280u, 0x11377u)) return use_table[u - 0x11280u + use_offset_0x11280u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x11400u, 0x114DFu)) return use_table[u - 0x11400u + use_offset_0x11400u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x11580u, 0x1173Fu)) return use_table[u - 0x11580u + use_offset_0x11580u];
+      if (hb_in_range<hb_codepoint_t> (u, 0x11C00u, 0x11CB7u)) return use_table[u - 0x11C00u + use_offset_0x11c00u];
       if (unlikely (u == 0x1107Fu)) return HN;
       break;
 
diff --git a/src/hb-unicode-private.hh b/src/hb-unicode-private.hh
index a4d118b6..75b55c02 100644
--- a/src/hb-unicode-private.hh
+++ b/src/hb-unicode-private.hh
@@ -126,7 +126,7 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
   {
     /* U+180B..180D MONGOLIAN FREE VARIATION SELECTORs are handled in the
      * Arabic shaper.  No need to match them here. */
-    return unlikely (hb_in_ranges (unicode,
+    return unlikely (hb_in_ranges<hb_codepoint_t> (unicode,
 				   0xFE00u, 0xFE0Fu, /* VARIATION SELECTOR-1..16 */
 				   0xE0100u, 0xE01EFu));  /* VARIATION SELECTOR-17..256 */
   }
@@ -179,13 +179,13 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
 	case 0x00: return unlikely (ch == 0x00ADu);
 	case 0x03: return unlikely (ch == 0x034Fu);
 	case 0x06: return unlikely (ch == 0x061Cu);
-	case 0x17: return hb_in_range (ch, 0x17B4u, 0x17B5u);
-	case 0x18: return hb_in_range (ch, 0x180Bu, 0x180Eu);
-	case 0x20: return hb_in_ranges (ch, 0x200Bu, 0x200Fu,
+	case 0x17: return hb_in_range<hb_codepoint_t> (ch, 0x17B4u, 0x17B5u);
+	case 0x18: return hb_in_range<hb_codepoint_t> (ch, 0x180Bu, 0x180Eu);
+	case 0x20: return hb_in_ranges<hb_codepoint_t> (ch, 0x200Bu, 0x200Fu,
 					    0x202Au, 0x202Eu,
 					    0x2060u, 0x206Fu);
-	case 0xFE: return hb_in_range (ch, 0xFE00u, 0xFE0Fu) || ch == 0xFEFFu;
-	case 0xFF: return hb_in_range (ch, 0xFFF0u, 0xFFF8u);
+	case 0xFE: return hb_in_range<hb_codepoint_t> (ch, 0xFE00u, 0xFE0Fu) || ch == 0xFEFFu;
+	case 0xFF: return hb_in_range<hb_codepoint_t> (ch, 0xFFF0u, 0xFFF8u);
 	default: return false;
       }
     }
@@ -193,9 +193,9 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
     {
       /* Other planes */
       switch (plane) {
-	case 0x01: return hb_in_ranges (ch, 0x1BCA0u, 0x1BCA3u,
+	case 0x01: return hb_in_ranges<hb_codepoint_t> (ch, 0x1BCA0u, 0x1BCA3u,
 					    0x1D173u, 0x1D17Au);
-	case 0x0E: return hb_in_range (ch, 0xE0000u, 0xE0FFFu);
+	case 0x0E: return hb_in_range<hb_codepoint_t> (ch, 0xE0000u, 0xE0FFFu);
 	default: return false;
       }
     }
diff --git a/src/hb-utf-private.hh b/src/hb-utf-private.hh
index 74cf5d66..211eb4dc 100644
--- a/src/hb-utf-private.hh
+++ b/src/hb-utf-private.hh
@@ -48,7 +48,7 @@ struct hb_utf8_t
 
     if (c > 0x7Fu)
     {
-      if (hb_in_range (c, 0xC2u, 0xDFu)) /* Two-byte */
+      if (hb_in_range<hb_codepoint_t> (c, 0xC2u, 0xDFu)) /* Two-byte */
       {
 	unsigned int t1;
 	if (likely (text < end &&
@@ -60,7 +60,7 @@ struct hb_utf8_t
 	else
 	  goto error;
       }
-      else if (hb_in_range (c, 0xE0u, 0xEFu)) /* Three-byte */
+      else if (hb_in_range<hb_codepoint_t> (c, 0xE0u, 0xEFu)) /* Three-byte */
       {
 	unsigned int t1, t2;
 	if (likely (1 < end - text &&
@@ -68,14 +68,14 @@ struct hb_utf8_t
 		    (t2 = text[1] - 0x80u) <= 0x3Fu))
 	{
 	  c = ((c&0xFu)<<12) | (t1<<6) | t2;
-	  if (unlikely (c < 0x0800u || hb_in_range (c, 0xD800u, 0xDFFFu)))
+	  if (unlikely (c < 0x0800u || hb_in_range<hb_codepoint_t> (c, 0xD800u, 0xDFFFu)))
 	    goto error;
 	  text += 2;
 	}
 	else
 	  goto error;
       }
-      else if (hb_in_range (c, 0xF0u, 0xF4u)) /* Four-byte */
+      else if (hb_in_range<hb_codepoint_t> (c, 0xF0u, 0xF4u)) /* Four-byte */
       {
 	unsigned int t1, t2, t3;
 	if (likely (2 < end - text &&
@@ -84,7 +84,7 @@ struct hb_utf8_t
 		    (t3 = text[2] - 0x80u) <= 0x3Fu))
 	{
 	  c = ((c&0x7u)<<18) | (t1<<12) | (t2<<6) | t3;
-	  if (unlikely (!hb_in_range (c, 0x10000u, 0x10FFFFu)))
+	  if (unlikely (!hb_in_range<hb_codepoint_t> (c, 0x10000u, 0x10FFFFu)))
 	    goto error;
 	  text += 3;
 	}
@@ -140,7 +140,7 @@ struct hb_utf16_t
   {
     hb_codepoint_t c = *text++;
 
-    if (likely (!hb_in_range (c, 0xD800u, 0xDFFFu)))
+    if (likely (!hb_in_range<hb_codepoint_t> (c, 0xD800u, 0xDFFFu)))
     {
       *unicode = c;
       return text;
@@ -150,7 +150,7 @@ struct hb_utf16_t
     {
       /* High-surrogate in c */
       hb_codepoint_t l = *text;
-      if (likely (hb_in_range (l, 0xDC00u, 0xDFFFu)))
+      if (likely (hb_in_range<hb_codepoint_t> (l, 0xDC00u, 0xDFFFu)))
       {
 	/* Low-surrogate in l */
 	*unicode = (c << 10) + l - ((0xD800u << 10) - 0x10000u + 0xDC00u);
@@ -172,7 +172,7 @@ struct hb_utf16_t
   {
     hb_codepoint_t c = *--text;
 
-    if (likely (!hb_in_range (c, 0xD800u, 0xDFFFu)))
+    if (likely (!hb_in_range<hb_codepoint_t> (c, 0xD800u, 0xDFFFu)))
     {
       *unicode = c;
       return text;
@@ -182,7 +182,7 @@ struct hb_utf16_t
     {
       /* Low-surrogate in c */
       hb_codepoint_t h = text[-1];
-      if (likely (hb_in_range (h, 0xD800u, 0xDBFFu)))
+      if (likely (hb_in_range<hb_codepoint_t> (h, 0xD800u, 0xDBFFu)))
       {
         /* High-surrogate in h */
         *unicode = (h << 10) + c - ((0xD800u << 10) - 0x10000u + 0xDC00u);


More information about the HarfBuzz mailing list