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

Behdad Esfahbod behdad at kemper.freedesktop.org
Mon May 27 11:53:15 PDT 2013


 src/hb-icu-le.cc                     |   35 ++++++++++++++++++++++++++++-------
 src/hb-ot-layout-gsubgpos-private.hh |    4 ++++
 src/hb-ot-layout-private.hh          |    6 ++++++
 3 files changed, 38 insertions(+), 7 deletions(-)

New commits:
commit 7e08f1258da229dfaf7e1c4b5c41e5bb83906cb0
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon May 27 14:48:34 2013 -0400

    Don't zero advance of mark-non-mark ligatures
    
    If there's a mark ligating forward with non-mark, they were
    inheriting the GC of the mark and later get advance-zeroed.
    Don't do that if there's any non-mark glyph in the ligature.
    
    Sample test: U+1780,U+17D2,U+179F with Kh-Metal-Chrieng.ttf
    
    Also:
    Bug 58922 - Issue with mark advance zeroing in generic shaper

diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 9fc638b..32c4a6d 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -872,7 +872,11 @@ static inline void ligate_input (hb_apply_context_t *c,
   unsigned int components_so_far = last_num_components;
 
   if (!is_mark_ligature)
+  {
     set_lig_props_for_ligature (c->buffer->cur(), lig_id, total_component_count);
+    if (_hb_glyph_info_get_general_category (&c->buffer->cur()) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
+      _hb_glyph_info_set_general_category (&c->buffer->cur(), HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER);
+  }
   c->replace_glyph (lig_glyph, klass);
 
   for (unsigned int i = 1; i < count; i++)
diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh
index a9de356..c5ba8b4 100644
--- a/src/hb-ot-layout-private.hh
+++ b/src/hb-ot-layout-private.hh
@@ -58,6 +58,12 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *uni
   info->unicode_props1() = unicode->modified_combining_class (info->codepoint);
 }
 
+inline void
+_hb_glyph_info_set_general_category (hb_glyph_info_t *info, hb_unicode_general_category_t gen_cat)
+{
+  info->unicode_props0() = (unsigned int) gen_cat | ((info->unicode_props0()) & ~0x1F);
+}
+
 inline hb_unicode_general_category_t
 _hb_glyph_info_get_general_category (const hb_glyph_info_t *info)
 {
commit cf059ac69d10d9eb09f0d2a29b1bd989647bd800
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri May 24 15:28:11 2013 -0400

    [icu_le] Support non-BMP text

diff --git a/src/hb-icu-le.cc b/src/hb-icu-le.cc
index 7efee7b..114b427 100644
--- a/src/hb-icu-le.cc
+++ b/src/hb-icu-le.cc
@@ -134,25 +134,46 @@ retry:
   unsigned int scratch_size;
   char *scratch = (char *) buffer->get_scratch_buffer (&scratch_size);
 
+  LEUnicode *pchars = (LEUnicode *) scratch;
+  unsigned int chars_len = 0;
+  for (unsigned int i = 0; i < buffer->len; i++) {
+    hb_codepoint_t c = buffer->info[i].codepoint;
+    if (likely (c < 0x10000))
+      pchars[chars_len++] = c;
+    else if (unlikely (c >= 0x110000))
+      pchars[chars_len++] = 0xFFFD;
+    else {
+      pchars[chars_len++] = 0xD800 + ((c - 0x10000) >> 10);
+      pchars[chars_len++] = 0xDC00 + ((c - 0x10000) & ((1 << 10) - 1));
+    }
+  }
+
 #define ALLOCATE_ARRAY(Type, name, len) \
   Type *name = (Type *) scratch; \
   scratch += (len) * sizeof ((name)[0]); \
   scratch_size -= (len) * sizeof ((name)[0]);
 
-  ALLOCATE_ARRAY (LEUnicode, chars, buffer->len);
-  ALLOCATE_ARRAY (unsigned int, clusters, buffer->len);
+  ALLOCATE_ARRAY (LEUnicode, chars, chars_len);
+  ALLOCATE_ARRAY (unsigned int, clusters, chars_len);
 
-  /* XXX Use UTF-16 decoder! */
+  chars_len = 0;
   for (unsigned int i = 0; i < buffer->len; i++) {
-    chars[i] = buffer->info[i].codepoint;
-    clusters[i] = buffer->info[i].cluster;
+    hb_codepoint_t c = buffer->info[i].codepoint;
+    if (likely (c < 0x10000))
+      clusters[chars_len++] = buffer->info[i].cluster;
+    else if (unlikely (c >= 0x110000))
+      clusters[chars_len++] = buffer->info[i].cluster;
+    else {
+      clusters[chars_len++] = buffer->info[i].cluster;
+      clusters[chars_len++] = buffer->info[i].cluster;
+    }
   }
 
   unsigned int glyph_count = le_layoutChars (le,
 					     chars,
 					     0,
-					     buffer->len,
-					     buffer->len,
+					     chars_len,
+					     chars_len,
 					     HB_DIRECTION_IS_BACKWARD (buffer->props.direction),
 					     0., 0.,
 					     &status);



More information about the HarfBuzz mailing list