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

Behdad Esfahbod behdad at kemper.freedesktop.org
Sun Aug 10 23:45:10 PDT 2014


 src/hb-coretext.cc |   43 ++++++++++++++++++-------------------------
 1 file changed, 18 insertions(+), 25 deletions(-)

New commits:
commit 9ce067c77524a9ffc77ceabcba5e7dab36fd39de
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Aug 11 02:04:38 2014 -0400

    [coretext] Simplify cluster mapping

diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index fbda2e3..6b3a168 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -819,33 +819,26 @@ _hb_coretext_shape (hb_shape_plan_t    *shape_plan,
    * This does *not* mean we'll form the same clusters as Uniscribe
    * or the native OT backend, only that the cluster indices will be
    * monotonic in the output buffer. */
-  if (HB_DIRECTION_IS_FORWARD (buffer->props.direction)) {
-    unsigned int prev_cluster = 0;
-    for (unsigned int i = 0; i < count; i++) {
-      unsigned int curr_cluster = buffer->info[i].cluster;
-      if (curr_cluster < prev_cluster) {
-        for (unsigned int j = i; j > 0; j--) {
-          if (buffer->info[j - 1].cluster > curr_cluster)
-            buffer->info[j - 1].cluster = curr_cluster;
-          else
-            break;
-        }
+  if (count > 1)
+  {
+    hb_glyph_info_t *info = buffer->info;
+    if (HB_DIRECTION_IS_FORWARD (buffer->props.direction))
+    {
+      unsigned int cluster = info[count - 1].cluster;
+      for (unsigned int i = count - 1; i > 0; i--)
+      {
+	cluster = MIN (cluster, info[i - 1].cluster);
+	info[i - 1].cluster = cluster;
       }
-      prev_cluster = curr_cluster;
     }
-  } else {
-    unsigned int prev_cluster = (unsigned int)-1;
-    for (unsigned int i = 0; i < count; i++) {
-      unsigned int curr_cluster = buffer->info[i].cluster;
-      if (curr_cluster > prev_cluster) {
-        for (unsigned int j = i; j > 0; j--) {
-          if (buffer->info[j - 1].cluster < curr_cluster)
-            buffer->info[j - 1].cluster = curr_cluster;
-          else
-            break;
-        }
+    else
+    {
+      unsigned int cluster = info[0].cluster;
+      for (unsigned int i = 1; i < count; i++)
+      {
+	cluster = MIN (cluster, info[i].cluster);
+	info[i].cluster = cluster;
       }
-      prev_cluster = curr_cluster;
     }
   }
 
commit 49f7fb63761e4ca9936990fb90a77fd3600f5ad2
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Aug 10 19:19:38 2014 -0400

    [coretext] Minor

diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 9c7425b..fbda2e3 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -675,7 +675,7 @@ _hb_coretext_shape (hb_shape_plan_t    *shape_plan,
 
   for (unsigned int i = 0; i < num_runs; i++)
   {
-    CTRunRef run = (CTRunRef) CFArrayGetValueAtIndex (glyph_runs, i);
+    CTRunRef run = static_cast<CTRunRef>(CFArrayGetValueAtIndex (glyph_runs, i));
 
     /* CoreText does automatic font fallback (AKA "cascading") for  characters
      * not supported by the requested font, and provides no way to turn it off,


More information about the HarfBuzz mailing list