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

Behdad Esfahbod behdad at kemper.freedesktop.org
Fri Nov 23 03:48:16 UTC 2018


 src/hb-ot-shape-complex-use.cc                                                |   48 ++++++----
 src/hb.hh                                                                     |    6 -
 test/shaping/data/in-house/fonts/4afb0e8b9a86bb9bd73a1247de4e33fbe3c1fd93.ttf |binary
 test/shaping/data/in-house/tests/use.tests                                    |    3 
 4 files changed, 40 insertions(+), 17 deletions(-)

New commits:
commit 22798e93c414a2655c757a6e41b300f67e04a9a3
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Nov 22 22:47:51 2018 -0500

    [use] Minor clarification

diff --git a/src/hb-ot-shape-complex-use.cc b/src/hb-ot-shape-complex-use.cc
index 4daa2787..2e3f202f 100644
--- a/src/hb-ot-shape-complex-use.cc
+++ b/src/hb-ot-shape-complex-use.cc
@@ -450,22 +450,22 @@ reorder_syllable (hb_buffer_t *buffer, unsigned int start, unsigned int end)
 
   hb_glyph_info_t *info = buffer->info;
 
-#define POST_BASE_FLAGS (FLAG64 (USE_FM) | \
-			 FLAG64 (USE_FAbv) | \
-			 FLAG64 (USE_FBlw) | \
-			 FLAG64 (USE_FPst) | \
-			 FLAG64 (USE_MAbv) | \
-			 FLAG64 (USE_MBlw) | \
-			 FLAG64 (USE_MPst) | \
-			 FLAG64 (USE_MPre) | \
-			 FLAG64 (USE_VAbv) | \
-			 FLAG64 (USE_VBlw) | \
-			 FLAG64 (USE_VPst) | \
-			 FLAG64 (USE_VPre) | \
-			 FLAG64 (USE_VMAbv) | \
-			 FLAG64 (USE_VMBlw) | \
-			 FLAG64 (USE_VMPst) | \
-			 FLAG64 (USE_VMPre))
+#define POST_BASE_FLAGS64 (FLAG64 (USE_FM) | \
+			   FLAG64 (USE_FAbv) | \
+			   FLAG64 (USE_FBlw) | \
+			   FLAG64 (USE_FPst) | \
+			   FLAG64 (USE_MAbv) | \
+			   FLAG64 (USE_MBlw) | \
+			   FLAG64 (USE_MPst) | \
+			   FLAG64 (USE_MPre) | \
+			   FLAG64 (USE_VAbv) | \
+			   FLAG64 (USE_VBlw) | \
+			   FLAG64 (USE_VPst) | \
+			   FLAG64 (USE_VPre) | \
+			   FLAG64 (USE_VMAbv) | \
+			   FLAG64 (USE_VMBlw) | \
+			   FLAG64 (USE_VMPst) | \
+			   FLAG64 (USE_VMPre))
 
   /* Move things forward. */
   if (info[start].use_category() == USE_R && end - start > 1)
@@ -474,7 +474,7 @@ reorder_syllable (hb_buffer_t *buffer, unsigned int start, unsigned int end)
      * glyph. */
     for (unsigned int i = start + 1; i < end; i++)
     {
-      bool is_post_base_glyph = (FLAG64_UNSAFE (info[i].use_category()) & POST_BASE_FLAGS) ||
+      bool is_post_base_glyph = (FLAG64_UNSAFE (info[i].use_category()) & POST_BASE_FLAGS64) ||
 				is_halant (info[i]);
       if (is_post_base_glyph || i == end - 1)
       {
commit a2d6c1075a5595a08ef09357293919d9df8eb64a
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Nov 22 22:40:57 2018 -0500

    Minor tweak to FLAG64

diff --git a/src/hb.hh b/src/hb.hh
index a40e6f2c..be8b2148 100644
--- a/src/hb.hh
+++ b/src/hb.hh
@@ -446,11 +446,11 @@ typedef uint64_t hb_vector_size_impl_t;
  * For example, for testing "x ∈ {x1, x2, x3}" use:
  * (FLAG_UNSAFE(x) & (FLAG(x1) | FLAG(x2) | FLAG(x3)))
  */
-#define FLAG(x) (ASSERT_STATIC_EXPR_ZERO ((unsigned int)(x) < 32) + (1U << (unsigned int)(x)))
-#define FLAG_UNSAFE(x) ((unsigned int)(x) < 32 ? (1U << (unsigned int)(x)) : 0)
+#define FLAG(x) (ASSERT_STATIC_EXPR_ZERO ((unsigned)(x) < 32) + (1U << (unsigned)(x)))
+#define FLAG_UNSAFE(x) ((unsigned)(x) < 32 ? (1U << (unsigned)(x)) : 0)
 #define FLAG_RANGE(x,y) (ASSERT_STATIC_EXPR_ZERO ((x) < (y)) + FLAG(y+1) - FLAG(x))
-#define FLAG64(x) (ASSERT_STATIC_EXPR_ZERO ((unsigned long long)(x) < 64) + (1ULL << (unsigned long long)(x)))
-#define FLAG64_UNSAFE(x) ((unsigned long long)(x) < 64 ? (1ULL << (unsigned long long)(x)) : 0)
+#define FLAG64(x) (ASSERT_STATIC_EXPR_ZERO ((unsigned)(x) < 64) + (1ULL << (unsigned)(x)))
+#define FLAG64_UNSAFE(x) ((unsigned)(x) < 64 ? (1ULL << (unsigned)(x)) : 0)
 
 
 /* Size signifying variable-sized array */
commit 8280459e74cff2dec3de012abd309cda9578b759
Merge: e4a4555d 3c7792ca
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Nov 22 22:39:12 2018 -0500

    Merge pull request #1291 from harfbuzz/use-reordering
    
    [use] Fix reordering

commit 3c7792ca326abfb989285f794d6ee71ad9f6bf89
Author: David Corbett <corbett.dav at husky.neu.edu>
Date:   Sat Oct 20 15:02:26 2018 -0400

    [use] Fix reordering
    
    Fixes #1235.

diff --git a/src/hb-ot-shape-complex-use.cc b/src/hb-ot-shape-complex-use.cc
index af25b07f..4daa2787 100644
--- a/src/hb-ot-shape-complex-use.cc
+++ b/src/hb-ot-shape-complex-use.cc
@@ -432,7 +432,8 @@ record_pref (const hb_ot_shape_plan_t *plan HB_UNUSED,
 static inline bool
 is_halant (const hb_glyph_info_t &info)
 {
-  return info.use_category() == USE_H && !_hb_glyph_info_ligated (&info);
+  return (info.use_category() == USE_H || info.use_category() == USE_HVM) &&
+	 !_hb_glyph_info_ligated (&info);
 }
 
 static void
@@ -449,19 +450,38 @@ reorder_syllable (hb_buffer_t *buffer, unsigned int start, unsigned int end)
 
   hb_glyph_info_t *info = buffer->info;
 
-#define BASE_FLAGS (FLAG (USE_B) | FLAG (USE_GB))
+#define POST_BASE_FLAGS (FLAG64 (USE_FM) | \
+			 FLAG64 (USE_FAbv) | \
+			 FLAG64 (USE_FBlw) | \
+			 FLAG64 (USE_FPst) | \
+			 FLAG64 (USE_MAbv) | \
+			 FLAG64 (USE_MBlw) | \
+			 FLAG64 (USE_MPst) | \
+			 FLAG64 (USE_MPre) | \
+			 FLAG64 (USE_VAbv) | \
+			 FLAG64 (USE_VBlw) | \
+			 FLAG64 (USE_VPst) | \
+			 FLAG64 (USE_VPre) | \
+			 FLAG64 (USE_VMAbv) | \
+			 FLAG64 (USE_VMBlw) | \
+			 FLAG64 (USE_VMPst) | \
+			 FLAG64 (USE_VMPre))
 
   /* Move things forward. */
   if (info[start].use_category() == USE_R && end - start > 1)
   {
-    /* Got a repha.  Reorder it to after first base, before first halant. */
+    /* Got a repha.  Reorder it towards the end, but before the first post-base
+     * glyph. */
     for (unsigned int i = start + 1; i < end; i++)
-      if ((FLAG_UNSAFE (info[i].use_category()) & (BASE_FLAGS)) || is_halant (info[i]))
+    {
+      bool is_post_base_glyph = (FLAG64_UNSAFE (info[i].use_category()) & POST_BASE_FLAGS) ||
+				is_halant (info[i]);
+      if (is_post_base_glyph || i == end - 1)
       {
-	/* If we hit a halant, move before it; otherwise it's a base: move to it's
-	 * place, and shift things in between backward. */
+	/* If we hit a post-base glyph, move before it; otherwise move to the
+	 * end. Shift things in between backward. */
 
-	if (is_halant (info[i]))
+	if (is_post_base_glyph)
 	  i--;
 
 	buffer->merge_clusters (start, i + 1);
@@ -471,21 +491,19 @@ reorder_syllable (hb_buffer_t *buffer, unsigned int start, unsigned int end)
 
 	break;
       }
+    }
   }
 
   /* Move things back. */
-  unsigned int j = end;
+  unsigned int j = start;
   for (unsigned int i = start; i < end; i++)
   {
     uint32_t flag = FLAG_UNSAFE (info[i].use_category());
-    if ((flag & (BASE_FLAGS)) || is_halant (info[i]))
+    if (is_halant (info[i]))
     {
-      /* If we hit a halant, move after it; otherwise it's a base: move to it's
-       * place, and shift things in between backward. */
-      if (is_halant (info[i]))
-	j = i + 1;
-      else
-	j = i;
+      /* If we hit a halant, move after it; otherwise move to the beginning, and
+       * shift things in between forward. */
+      j = i + 1;
     }
     else if (((flag) & (FLAG (USE_VPre) | FLAG (USE_VMPre))) &&
 	     /* Only move the first component of a MultipleSubst. */
diff --git a/src/hb.hh b/src/hb.hh
index 16ccf87c..ba857eda 100644
--- a/src/hb.hh
+++ b/src/hb.hh
@@ -446,6 +446,8 @@ typedef uint64_t hb_vector_size_impl_t;
 #define FLAG(x) (ASSERT_STATIC_EXPR_ZERO ((unsigned int)(x) < 32) + (1U << (unsigned int)(x)))
 #define FLAG_UNSAFE(x) ((unsigned int)(x) < 32 ? (1U << (unsigned int)(x)) : 0)
 #define FLAG_RANGE(x,y) (ASSERT_STATIC_EXPR_ZERO ((x) < (y)) + FLAG(y+1) - FLAG(x))
+#define FLAG64(x) (ASSERT_STATIC_EXPR_ZERO ((unsigned long long)(x) < 64) + (1ULL << (unsigned long long)(x)))
+#define FLAG64_UNSAFE(x) ((unsigned long long)(x) < 64 ? (1ULL << (unsigned long long)(x)) : 0)
 
 
 /* Size signifying variable-sized array */
diff --git a/test/shaping/data/in-house/fonts/4afb0e8b9a86bb9bd73a1247de4e33fbe3c1fd93.ttf b/test/shaping/data/in-house/fonts/4afb0e8b9a86bb9bd73a1247de4e33fbe3c1fd93.ttf
new file mode 100644
index 00000000..274fc081
Binary files /dev/null and b/test/shaping/data/in-house/fonts/4afb0e8b9a86bb9bd73a1247de4e33fbe3c1fd93.ttf differ
diff --git a/test/shaping/data/in-house/tests/use.tests b/test/shaping/data/in-house/tests/use.tests
index 18d1991e..dd2a3a27 100644
--- a/test/shaping/data/in-house/tests/use.tests
+++ b/test/shaping/data/in-house/tests/use.tests
@@ -9,3 +9,6 @@
 ../fonts/2a670df15b73a5dc75a5cc491bde5ac93c5077dc.ttf::U+11124,U+11131,U+11134:[u11124=0+514|u11131=0+0|uni25CC=0+547|u11134=0+0]
 ../fonts/573d3a3177c9a8646e94c8a0d7b224334340946a.ttf:--font-funcs=ft:U+11410,U+11442,U+11411,U+11440,U+11443,U+11410,U+11442,U+11411,U+11441,U+11443:[E_dv.alt=0+275|Ga.icd=0+367|Gha.diag=0 at 100,0+386|AA_dv.alt=0+208|Candrabindu=0 at 17,-8+0|E_dv.alt=5+275|Ga.icd=5+367|Gha.diag=5 at 100,0+386|AU_dv_part.alt=5+213|Candrabindu.sm=5 at -52,179+0]
 ../fonts/dcf774ca21062e7439f98658b18974ea8b956d0c.ttf::U+11328,U+1134D,U+1CF4:[gid1=0+793|gid2=0+0|gid3=0+0]
+../fonts/4afb0e8b9a86bb9bd73a1247de4e33fbe3c1fd93.ttf::U+1C00,U+1C27,U+1C28,U+1C34,U+1C35:[uni1C35=0+500|uni1C34=0+500|uni1C28=0+500|uni1C27=0+500|uni1C00=0+500]
+../fonts/4afb0e8b9a86bb9bd73a1247de4e33fbe3c1fd93.ttf::U+0D4E,U+0D15,U+0D4D,U+0D15,U+0D46:[uni0D15=0+500|uni0D4E=0+500|uni0D4D=0+500|uni0D46=3+500|uni0D15=3+500]
+../fonts/4afb0e8b9a86bb9bd73a1247de4e33fbe3c1fd93.ttf::U+1102D,U+11046,U+11013,U+11046,U+11013,U+11046:[u11013=0+500|u11046_u11013=0+500|u1102D_u11046=0+500|u11046=0+500]


More information about the HarfBuzz mailing list