[pango/harfbuzz-ng] [HB] Simplify MarkAttachmentType handling



commit 95c3fffa8a2b102a3d5f88f3940e7f93e2368fec
Author: Behdad Esfahbod <behdad behdad org>
Date:   Tue May 26 15:45:41 2009 -0400

    [HB] Simplify MarkAttachmentType handling
---
 pango/opentype/hb-ot-layout-gpos-private.h |    6 +++---
 pango/opentype/hb-ot-layout-gsub-private.h |    6 ++----
 pango/opentype/hb-ot-layout.cc             |   18 ++++++++----------
 3 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/pango/opentype/hb-ot-layout-gpos-private.h b/pango/opentype/hb-ot-layout-gpos-private.h
index ed61eef..c088456 100644
--- a/pango/opentype/hb-ot-layout-gpos-private.h
+++ b/pango/opentype/hb-ot-layout-gpos-private.h
@@ -784,7 +784,7 @@ struct MarkBasePosFormat1
     while (i <= count)
     {
       property = _hb_ot_layout_get_glyph_property (layout, IN_GLYPH (j));
-      if (!(property == HB_OT_LAYOUT_GLYPH_CLASS_MARK || property & LookupFlag::MarkAttachmentType))
+      if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK))
 	break;
       i++, j--;
     }
@@ -909,7 +909,7 @@ struct MarkLigPosFormat1
     while (i <= count)
     {
       property = _hb_ot_layout_get_glyph_property (layout, IN_GLYPH (j));
-      if (!(property == HB_OT_LAYOUT_GLYPH_CLASS_MARK || property & LookupFlag::MarkAttachmentType))
+      if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK))
 	break;
       i++, j--;
     }
@@ -1047,7 +1047,7 @@ struct MarkMarkPosFormat1
     while (i <= count)
     {
       property = _hb_ot_layout_get_glyph_property (layout, IN_GLYPH (j));
-      if (!(property == HB_OT_LAYOUT_GLYPH_CLASS_MARK || property & LookupFlag::MarkAttachmentType))
+      if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK))
         return false;
       if (!(lookup_flag & LookupFlag::MarkAttachmentType) ||
 	   (lookup_flag & LookupFlag::MarkAttachmentType) == property)
diff --git a/pango/opentype/hb-ot-layout-gsub-private.h b/pango/opentype/hb-ot-layout-gsub-private.h
index ec7b3b7..69d5465 100644
--- a/pango/opentype/hb-ot-layout-gsub-private.h
+++ b/pango/opentype/hb-ot-layout-gsub-private.h
@@ -310,8 +310,7 @@ struct Ligature
 	j++;
       }
 
-      if (!(property == HB_OT_LAYOUT_GLYPH_CLASS_MARK ||
-	    property &  LookupFlag::MarkAttachmentType))
+      if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK))
 	is_mark = FALSE;
 
       if (HB_LIKELY (IN_GLYPH(j) != component[i]))
@@ -402,8 +401,7 @@ struct LigatureSubstFormat1
   {
     hb_codepoint_t glyph_id = IN_CURGLYPH ();
 
-    bool first_is_mark = (property == HB_OT_LAYOUT_GLYPH_CLASS_MARK ||
-			  property &  LookupFlag::MarkAttachmentType);
+    bool first_is_mark = !!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK);
 
     unsigned int index = (this+coverage) (glyph_id);
     if (HB_LIKELY (index == NOT_COVERED))
diff --git a/pango/opentype/hb-ot-layout.cc b/pango/opentype/hb-ot-layout.cc
index a1adb2f..d0398c7 100644
--- a/pango/opentype/hb-ot-layout.cc
+++ b/pango/opentype/hb-ot-layout.cc
@@ -138,12 +138,6 @@ _hb_ot_layout_get_glyph_property (hb_ot_layout_t *layout,
 {
   hb_ot_layout_class_t klass;
 
-  /* TODO old harfbuzz doesn't always parse mark attachments as it says it was
-   * introduced without a version bump, so it may not be safe */
-  klass = layout->gdef->get_mark_attachment_type (glyph);
-  if (klass)
-    return klass << 8;
-
   klass = layout->gdef->get_glyph_class (glyph);
 
   if (!klass && glyph < layout->new_gdef.len)
@@ -154,8 +148,12 @@ _hb_ot_layout_get_glyph_property (hb_ot_layout_t *layout,
   case GDEF::UnclassifiedGlyph:	return HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED;
   case GDEF::BaseGlyph:		return HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH;
   case GDEF::LigatureGlyph:	return HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE;
-  case GDEF::MarkGlyph:		return HB_OT_LAYOUT_GLYPH_CLASS_MARK;
   case GDEF::ComponentGlyph:	return HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT;
+  case GDEF::MarkGlyph:
+	/* TODO old harfbuzz doesn't always parse mark attachments as it says it was
+	 * introduced without a version bump, so it may not be safe */
+	klass = layout->gdef->get_mark_attachment_type (glyph);
+	return HB_OT_LAYOUT_GLYPH_CLASS_MARK + klass << 8;
   }
 }
 
@@ -178,9 +176,9 @@ _hb_ot_layout_check_glyph_property (hb_ot_layout_t  *layout,
   *property = ginfo->gproperty;
 
   /* If the glyph was found in the MarkAttachmentClass table,
-   * then that class value is the high byte of the result,
-   * otherwise the low byte contains the basic type of the glyph
-   * as defined by the GlyphClassDef table.
+   * then that class value is stored in the high byte of the result.
+   * The low byte contains the basic type of the glyph as defined by
+   * the GlyphClassDef table.
    */
   if (*property & LookupFlag::MarkAttachmentType)
     basic_glyph_class = HB_OT_LAYOUT_GLYPH_CLASS_MARK;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]