[HarfBuzz] harfbuzz-ng: Branch 'master' - 5 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Sun Jul 29 18:35:24 PDT 2012


 src/hb-old.cc                                                                                  |   12 +-----
 src/hb-ot-layout-gsub-table.hh                                                                 |   18 +++++++---
 src/hb-shape-plan.cc                                                                           |    2 -
 src/test.cc                                                                                    |    2 -
 test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/MANIFEST                |    1 
 test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/ligature-components.txt |   18 ++++++++++
 6 files changed, 38 insertions(+), 15 deletions(-)

New commits:
commit ef6e9cec3399e4f63f4b662abd77cf6d4683e8a3
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Jul 29 21:35:22 2012 -0400

    Fixup bb0e4ba3e9c5a407fc5d73c914e429d24d336380

diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc
index f9f9f3d..a478ba5 100644
--- a/src/hb-shape-plan.cc
+++ b/src/hb-shape-plan.cc
@@ -115,7 +115,7 @@ hb_shape_plan_get_empty (void)
   static const hb_shape_plan_t _hb_shape_plan_nil = {
     HB_OBJECT_HEADER_STATIC,
 
-    false, /* default_shaper_list */
+    true, /* default_shaper_list */
     NULL, /* face */
     _HB_BUFFER_PROPS_DEFAULT, /* props */
 
commit cb3d34063154bf164c61eeba41c6166b0bd304fb
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Jul 29 20:37:38 2012 -0400

    [GSUB] Don't set new lig_id on mark ligatures
    
    If two marks form a ligature, retain their previous lig_id, such that
    the mark ligature can attach to ligature components...
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=676343
    
    In fact, I noticed that we should not let ligatures form between glyphs
    coming from different components of a previous ligature.  For example,
    if the sequence is: LAM,SHADDA,LAM,FATHA,HEH, the LAM,LAM,HEH form a
    ligature, putting SHADDA and FATHA next to eachother.  However, it would
    be wrong to ligate them.  Uniscribe has this bug also.

diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index 03244b5..a74f707 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -499,11 +499,20 @@ struct Ligature
       if (likely (c->buffer->info[skippy_iter.idx].codepoint != component[i])) return TRACE_RETURN (false);
     }
 
-    unsigned int klass = first_was_mark && found_non_mark ? HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE : 0;
+    bool is_a_mark_ligature = first_was_mark && !found_non_mark;
+
+    unsigned int klass = is_a_mark_ligature ? 0 : HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE;
+
+    /* If it's a mark ligature, we should leave the lig_id / lig_comp alone such that
+     * the resulting mark ligature has the opportunity to attach to ligature components
+     * of it's base later on.  See for example:
+     * https://bugzilla.gnome.org/show_bug.cgi?id=676343
+     */
 
     /* Allocate new ligature id */
-    unsigned int lig_id = allocate_lig_id (c->buffer);
-    set_lig_props (c->buffer->cur(), lig_id, 0);
+    unsigned int lig_id = is_a_mark_ligature ? 0 : allocate_lig_id (c->buffer);
+    if (!is_a_mark_ligature)
+      set_lig_props (c->buffer->cur(), lig_id, 0);
 
     if (skippy_iter.idx < c->buffer->idx + count) /* No input glyphs skipped */
     {
@@ -526,7 +535,8 @@ struct Ligature
       {
 	while (c->should_mark_skip_current_glyph ())
 	{
-	  set_lig_props (c->buffer->cur(),  lig_id, i);
+	  if (!is_a_mark_ligature)
+	    set_lig_props (c->buffer->cur(),  lig_id, i);
 	  c->buffer->next_glyph ();
 	}
 
commit 97a201becf936f62046914b568e5763e27ee936e
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Jul 29 20:31:36 2012 -0400

    Add Arabic tests for mark ligature component attachments

diff --git a/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/MANIFEST b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/MANIFEST
index 242b2a1..c71d035 100644
--- a/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/MANIFEST
+++ b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/MANIFEST
@@ -2,5 +2,6 @@ lam-alef.txt
 language-arabic.txt
 language-persian.txt
 language-urdu.txt
+ligature-components.txt
 ligature-diacritics.txt
 mark-skipping.txt
diff --git a/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/ligature-components.txt b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/ligature-components.txt
new file mode 100644
index 0000000..0d4d47f
--- /dev/null
+++ b/test/shaping/texts/in-tree/shaper-arabic/script-arabic/misc/diacritics/ligature-components.txt
@@ -0,0 +1,18 @@
+لّله
+لَّله
+لَّله
+للّه
+للَّه
+للَّه
+للهّ
+للهَّ
+للهَّ
+لّلَه
+لَلّه
+لّلهَ
+لَلهّ
+للّهَ
+للَهّ
+لّلّهَ
+لّلَّه
+لَّلّه
commit a15b70a81a609f024083cb04f9819483f4d5cab7
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Jul 29 20:09:22 2012 -0400

    [hb-old] Fix cluster formation in RTL
    
    Unlike Uniscribe, hb-old returns glyphs in logical order, so the logic
    does not need to duplicated for RTL.

diff --git a/src/hb-old.cc b/src/hb-old.cc
index f938a9b..5285b7f 100644
--- a/src/hb-old.cc
+++ b/src/hb-old.cc
@@ -345,15 +345,9 @@ retry:
     uint32_t *p = &vis_clusters[item.log_clusters[buffer->info[i].utf16_index()]];
     *p = MIN (*p, buffer->info[i].cluster);
   }
-  if (!backward) {
-    for (unsigned int i = 1; i < num_glyphs; i++)
-      if (vis_clusters[i] == -1)
-	vis_clusters[i] = vis_clusters[i - 1];
-  } else {
-    for (int i = num_glyphs - 2; i >= 0; i--)
-      if (vis_clusters[i] == -1)
-	vis_clusters[i] = vis_clusters[i + 1];
-  }
+  for (unsigned int i = 1; i < num_glyphs; i++)
+    if (vis_clusters[i] == -1)
+      vis_clusters[i] = vis_clusters[i - 1];
 
 #undef utf16_index
 
commit 8a7e70ef65952fc16b8c1d5f1126c94d9d81e755
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Jul 29 19:56:54 2012 -0400

    [Minor]

diff --git a/src/test.cc b/src/test.cc
index bdf017c..22108b8 100644
--- a/src/test.cc
+++ b/src/test.cc
@@ -59,7 +59,7 @@ main (int argc, char **argv)
     hb_memory_mode_t mm;
 
 #ifdef HAVE_GLIB
-    GMappedFile *mf = g_mapped_file_new (argv[1], FALSE, NULL);
+    GMappedFile *mf = g_mapped_file_new (argv[1], false, NULL);
     font_data = g_mapped_file_get_contents (mf);
     len = g_mapped_file_get_length (mf);
     destroy = (hb_destroy_func_t) g_mapped_file_unref;



More information about the HarfBuzz mailing list