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

Behdad Esfahbod behdad at kemper.freedesktop.org
Wed Nov 14 15:08:26 PST 2012


 src/hb-ot-shape-complex-arabic.cc        |    1 +
 src/hb-ot-shape-complex-indic-private.hh |    6 +++---
 src/hb-ot-shape-complex-indic.cc         |    8 +++++---
 src/hb-ot-shape-complex-misc.cc          |    2 ++
 src/hb-ot-shape-complex-private.hh       |   24 +++++++++++++++++++-----
 src/hb-ot-shape-fallback.cc              |    4 ++--
 src/hb-ot-shape.cc                       |   20 +++++---------------
 7 files changed, 37 insertions(+), 28 deletions(-)

New commits:
commit d469fadce8290c7dda559c5927dd19df65f91c1a
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Nov 14 15:07:36 2012 -0800

    [Indic] Exchange abort() for assert()

diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 130a632..a7f9b60 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -486,6 +486,10 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
 
     switch (indic_plan->config->base_pos)
     {
+      default:
+        assert (false);
+	/* fallthrough */
+
       case BASE_POS_LAST:
       {
 	/* -> starting from the end of the syllable, move backwards */
@@ -559,9 +563,6 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
 	    info[i].indic_position() = POS_BELOW_C;
       }
       break;
-
-      default:
-      abort ();
     }
 
     /* -> If the syllable starts with Ra + Halant (in a script that has Reph)
commit 0f80a89de99293ddbf0b8b815fe360677d057e38
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Nov 14 15:05:19 2012 -0800

    Don't route Kharoshthi through the Indic shaper
    
    It's a simple, right-to-left, script.

diff --git a/src/hb-ot-shape-complex-private.hh b/src/hb-ot-shape-complex-private.hh
index d916f63..043e8e3 100644
--- a/src/hb-ot-shape-complex-private.hh
+++ b/src/hb-ot-shape-complex-private.hh
@@ -226,6 +226,7 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner)
     case HB_SCRIPT_TAI_LE:
 
     /* Unicode-4.1 additions */
+    case HB_SCRIPT_KHAROSHTHI:
     case HB_SCRIPT_SYLOTI_NAGRI:
 
     /* Unicode-5.1 additions */
@@ -253,7 +254,6 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner)
 
     /* Unicode-4.1 additions */
     case HB_SCRIPT_BUGINESE:
-    case HB_SCRIPT_KHAROSHTHI:
     case HB_SCRIPT_NEW_TAI_LUE:
 
     /* Unicode-5.0 additions */
commit e67072bb179a5c17db04075de74215597fb43c82
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Nov 14 15:00:53 2012 -0800

    [Indic] Handle overstruck matra position

diff --git a/src/hb-ot-shape-complex-indic-private.hh b/src/hb-ot-shape-complex-indic-private.hh
index de7264a..e36090e 100644
--- a/src/hb-ot-shape-complex-indic-private.hh
+++ b/src/hb-ot-shape-complex-indic-private.hh
@@ -139,8 +139,8 @@ enum indic_matra_category_t {
   INDIC_MATRA_CATEGORY_TOP_AND_RIGHT		= INDIC_MATRA_CATEGORY_RIGHT,
 
   INDIC_MATRA_CATEGORY_INVISIBLE		= INDIC_MATRA_CATEGORY_NOT_APPLICABLE,
-  INDIC_MATRA_CATEGORY_OVERSTRUCK		= INDIC_MATRA_CATEGORY_NOT_APPLICABLE,
-  INDIC_MATRA_CATEGORY_VISUAL_ORDER_LEFT	= INDIC_MATRA_CATEGORY_NOT_APPLICABLE
+  INDIC_MATRA_CATEGORY_OVERSTRUCK		= POS_AFTER_MAIN,
+  INDIC_MATRA_CATEGORY_VISUAL_ORDER_LEFT	= POS_PRE_M
 };
 
 /* Note: We use ASSERT_STATIC_EXPR_ZERO() instead of ASSERT_STATIC_EXPR() and the comma operation
@@ -222,7 +222,7 @@ matra_position (hb_codepoint_t u, indic_position_t side)
     case POS_ABOVE_C:	return MATRA_POS_TOP (u);
     case POS_BELOW_C:	return MATRA_POS_BOTTOM (u);
   };
-  abort ();
+  return side;
 }
 
 
commit 7e99e4f0740e47efda5882604954cb7d12700a4b
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Nov 14 14:09:46 2012 -0800

    Reposition Lao marks
    
    Lao marks are center-aligned, unlike Thai ones.

diff --git a/src/hb-ot-shape-fallback.cc b/src/hb-ot-shape-fallback.cc
index 5dc554c..f4463e4 100644
--- a/src/hb-ot-shape-fallback.cc
+++ b/src/hb-ot-shape-fallback.cc
@@ -138,10 +138,10 @@ recategorize_combining_class (hb_codepoint_t u,
     /* Lao */
 
     case HB_MODIFIED_COMBINING_CLASS_CCC118: /* sign u / sign uu */
-      return HB_UNICODE_COMBINING_CLASS_BELOW_RIGHT;
+      return HB_UNICODE_COMBINING_CLASS_BELOW;
 
     case HB_MODIFIED_COMBINING_CLASS_CCC122: /* mai */
-      return HB_UNICODE_COMBINING_CLASS_ABOVE_RIGHT;
+      return HB_UNICODE_COMBINING_CLASS_ABOVE;
 
 
     /* Tibetan */
commit 865745b5b87236651f5663cae3461db9cb505eed
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Nov 14 13:48:26 2012 -0800

    Don't do fallback positioning for Indic and Thai shapers

diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc
index 591c743..ea2a68f 100644
--- a/src/hb-ot-shape-complex-arabic.cc
+++ b/src/hb-ot-shape-complex-arabic.cc
@@ -354,4 +354,5 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_arabic =
   NULL, /* compose */
   setup_masks_arabic,
   true, /* zero_width_attached_marks */
+  true, /* fallback_position */
 };
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 1c7de0d..130a632 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -1360,4 +1360,5 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_indic =
   compose_indic,
   setup_masks_indic,
   false, /* zero_width_attached_marks */
+  false, /* fallback_position */
 };
diff --git a/src/hb-ot-shape-complex-misc.cc b/src/hb-ot-shape-complex-misc.cc
index a65de2f..afe5f70 100644
--- a/src/hb-ot-shape-complex-misc.cc
+++ b/src/hb-ot-shape-complex-misc.cc
@@ -221,6 +221,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_default =
   compose_default,
   NULL, /* setup_masks */
   true, /* zero_width_attached_marks */
+  true, /* fallback_position */
 };
 
 
@@ -334,4 +335,5 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_thai =
   NULL, /* compose */
   NULL, /* setup_masks */
   true, /* zero_width_attached_marks */
+  false,/* fallback_position */
 };
diff --git a/src/hb-ot-shape-complex-private.hh b/src/hb-ot-shape-complex-private.hh
index 7cc1452..d916f63 100644
--- a/src/hb-ot-shape-complex-private.hh
+++ b/src/hb-ot-shape-complex-private.hh
@@ -131,6 +131,7 @@ struct hb_ot_complex_shaper_t
 		       hb_font_t                *font);
 
   bool zero_width_attached_marks;
+  bool fallback_position;
 };
 
 #define HB_COMPLEX_SHAPER_IMPLEMENT(name) extern HB_INTERNAL const hb_ot_complex_shaper_t _hb_ot_complex_shaper_##name;
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 634fe6f..ee0796e 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -452,12 +452,6 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
 }
 
 static inline void
-hb_ot_position_complex_fallback (hb_ot_shape_context_t *c)
-{
-  _hb_ot_shape_fallback_position (c->plan, c->font, c->buffer);
-}
-
-static inline void
 hb_ot_truetype_kern (hb_ot_shape_context_t *c)
 {
   /* TODO Check for kern=0 */
@@ -483,26 +477,22 @@ hb_ot_truetype_kern (hb_ot_shape_context_t *c)
 }
 
 static inline void
-hb_position_complex_fallback_visual (hb_ot_shape_context_t *c)
-{
-  hb_ot_truetype_kern (c);
-}
-
-static inline void
 hb_ot_position (hb_ot_shape_context_t *c)
 {
   hb_ot_position_default (c);
 
   hb_bool_t fallback = !hb_ot_position_complex (c);
 
-  if (fallback)
-    hb_ot_position_complex_fallback (c);
+  if (fallback && c->plan->shaper->fallback_position)
+    _hb_ot_shape_fallback_position (c->plan, c->font, c->buffer);
 
   if (HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction))
     hb_buffer_reverse (c->buffer);
 
+  /* Visual fallback goes here. */
+
   if (fallback)
-    hb_position_complex_fallback_visual (c);
+    hb_ot_truetype_kern (c);
 }
 
 
commit 981748cb2e9b48b77177b19ec1f972cab7afda89
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Nov 14 13:38:16 2012 -0800

    [Indic] If Khmer fonts have a 'liga' feature, use generic shaper
    
    Seems to produce more coherent results than trying the Indic shaper on
    them.  I'm looking at you, Kh-* fonts...

diff --git a/src/hb-ot-shape-complex-private.hh b/src/hb-ot-shape-complex-private.hh
index 477a250..7cc1452 100644
--- a/src/hb-ot-shape-complex-private.hh
+++ b/src/hb-ot-shape-complex-private.hh
@@ -248,8 +248,6 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner)
     case HB_SCRIPT_TELUGU:
 
     /* Unicode-3.0 additions */
-    case HB_SCRIPT_KHMER:
-    case HB_SCRIPT_MYANMAR:
     case HB_SCRIPT_SINHALA:
 
     /* Unicode-4.1 additions */
@@ -278,10 +276,25 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner)
     case HB_SCRIPT_SHARADA:
     case HB_SCRIPT_TAKRI:
 
+      /* Only use Indic shaper if the font has Indic tables. */
+      if (planner->map.chosen_script[0] == HB_OT_TAG_DEFAULT_SCRIPT)
+	return &_hb_ot_complex_shaper_default;
+      else
+	return &_hb_ot_complex_shaper_indic;
+
+    case HB_SCRIPT_KHMER:
+      /* If the font has 'liga', let the generic shaper do it. */
+      if (planner->map.chosen_script[0] == HB_OT_TAG_DEFAULT_SCRIPT ||
+	  hb_ot_layout_language_find_feature (planner->face, HB_OT_TAG_GSUB, planner->map.script_index[0], planner->map.language_index[0], HB_TAG ('l','i','g','a'), NULL))
+	return &_hb_ot_complex_shaper_default;
+      else
+	return &_hb_ot_complex_shaper_indic;
+
+
+    case HB_SCRIPT_MYANMAR:
       /* For Myanmar, we only want to use the Indic shaper if the "new" script
        * tag is found.  For "old" script tag we want to use the default shaper. */
-      if (planner->map.chosen_script[0] != HB_OT_TAG_DEFAULT_SCRIPT &&
-	  planner->map.chosen_script[0] != HB_TAG ('m','y','m','r'))
+      if (planner->map.chosen_script[0] == HB_TAG ('m','y','m','2'))
 	return &_hb_ot_complex_shaper_indic;
       else
 	return &_hb_ot_complex_shaper_default;



More information about the HarfBuzz mailing list