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

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Jun 13 16:03:46 PDT 2013


 src/hb-ft.cc                 |    3 +--
 src/hb-ot-shape-normalize.cc |   20 ++++++++++++++++++--
 2 files changed, 19 insertions(+), 4 deletions(-)

New commits:
commit 79d1007a501fd63c0ba4d51038c513e6b8b94740
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Jun 13 19:01:07 2013 -0400

    If variation selector is not consumed by cmap, pass it on to GSUB
    
    This changes the semantics of get_glyph() callback and expect that
    callbacks return false if the requested variant is not available, and
    then we will call them back with variation_selector=0 and will retain
    the glyph for the selector in the glyph stream.
    
    Apparently most Mongolian fonts implement the Mongolian Variation
    Selectors using GSUB, not cmap.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=65258
    
    Note that this doesn't fix the Mongolian shaping yet, because the way
    that's implemented is that the, say, 'init' feature ligates the letter
    and the variation-selector.  However, since currently the variation
    selector doesn't have the 'init' mask on, it will not be matched...

diff --git a/src/hb-ft.cc b/src/hb-ft.cc
index 978230c..d63eba2 100644
--- a/src/hb-ft.cc
+++ b/src/hb-ft.cc
@@ -73,8 +73,7 @@ hb_ft_get_glyph (hb_font_t *font HB_UNUSED,
 #ifdef HAVE_FT_FACE_GETCHARVARIANTINDEX
   if (unlikely (variation_selector)) {
     *glyph = FT_Face_GetCharVariantIndex (ft_face, unicode, variation_selector);
-    if (*glyph)
-      return true;
+    return *glyph != 0;
   }
 #endif
 
diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc
index 51ef77b..3fee809 100644
--- a/src/hb-ot-shape-normalize.cc
+++ b/src/hb-ot-shape-normalize.cc
@@ -217,8 +217,18 @@ handle_variation_selector_cluster (const hb_ot_shape_normalize_context_t *c, uns
   for (; buffer->idx < end - 1;) {
     if (unlikely (buffer->unicode->is_variation_selector (buffer->cur(+1).codepoint))) {
       /* The next two lines are some ugly lines... But work. */
-      c->font->get_glyph (buffer->cur().codepoint, buffer->cur(+1).codepoint, &buffer->cur().glyph_index());
-      buffer->replace_glyphs (2, 1, &buffer->cur().codepoint);
+      if (c->font->get_glyph (buffer->cur().codepoint, buffer->cur(+1).codepoint, &buffer->cur().glyph_index()))
+      {
+	buffer->replace_glyphs (2, 1, &buffer->cur().codepoint);
+      }
+      else
+      {
+        /* Just pass on the two characters separately, let GSUB do its magic. */
+	set_glyph (buffer->cur(), c->font);
+	buffer->next_glyph ();
+	set_glyph (buffer->cur(), c->font);
+	buffer->next_glyph ();
+      }
       /* Skip any further variation selectors. */
       while (buffer->idx < end && unlikely (buffer->unicode->is_variation_selector (buffer->cur().codepoint)))
       {
commit c7a84917208528040aaf9ad0a9a0b26aabeabc9c
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Jun 6 20:17:32 2013 -0400

    Skip over multiple variation selectors in a row

diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc
index 7f83d9d..51ef77b 100644
--- a/src/hb-ot-shape-normalize.cc
+++ b/src/hb-ot-shape-normalize.cc
@@ -219,6 +219,12 @@ handle_variation_selector_cluster (const hb_ot_shape_normalize_context_t *c, uns
       /* The next two lines are some ugly lines... But work. */
       c->font->get_glyph (buffer->cur().codepoint, buffer->cur(+1).codepoint, &buffer->cur().glyph_index());
       buffer->replace_glyphs (2, 1, &buffer->cur().codepoint);
+      /* Skip any further variation selectors. */
+      while (buffer->idx < end && unlikely (buffer->unicode->is_variation_selector (buffer->cur().codepoint)))
+      {
+	set_glyph (buffer->cur(), c->font);
+	buffer->next_glyph ();
+      }
     } else {
       set_glyph (buffer->cur(), c->font);
       buffer->next_glyph ();



More information about the HarfBuzz mailing list