[pango/harfbuzz-ng] [HB] Tweak some constants and fix Coverage



commit 29f0ff90f687a82a630ca0212bbbac1aa3412f59
Author: Behdad Esfahbod <behdad behdad org>
Date:   Mon May 18 04:37:37 2009 -0400

    [HB] Tweak some constants and fix Coverage
---
 pango/opentype/hb-ot-layout-common-private.h   |   11 ++++++-----
 pango/opentype/hb-ot-layout-gsubgpos-private.h |    2 ++
 pango/opentype/hb-ot-layout-open-private.h     |    6 +++---
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/pango/opentype/hb-ot-layout-common-private.h b/pango/opentype/hb-ot-layout-common-private.h
index 9eabb1e..074b26a 100644
--- a/pango/opentype/hb-ot-layout-common-private.h
+++ b/pango/opentype/hb-ot-layout-common-private.h
@@ -36,6 +36,7 @@
  *
  */
 
+
 /*
  * Script, ScriptList, LangSys, Feature, FeatureList, Lookup, LookupList
  */
@@ -226,9 +227,9 @@ struct CoverageFormat1 {
 
   private:
   inline unsigned int get_coverage (hb_codepoint_t glyph_id) const {
-    GlyphID gid;
-    if (HB_UNLIKELY (glyph_id > 65535))
+    if (HB_UNLIKELY (glyph_id > 0xFFFF))
       return NOT_COVERED;
+    GlyphID gid;
     gid = glyph_id;
     // TODO: bsearch
     unsigned int num_glyphs = glyphArray.len;
@@ -251,7 +252,7 @@ struct CoverageRangeRecord {
   private:
   inline unsigned int get_coverage (hb_codepoint_t glyph_id) const {
     if (glyph_id >= start && glyph_id <= end)
-      return startCoverageIndex + (glyph_id - start);
+      return (unsigned int) startCoverageIndex + (glyph_id - start);
     return NOT_COVERED;
   }
 
@@ -272,8 +273,8 @@ struct CoverageFormat2 {
     // TODO: bsearch
     unsigned int count = rangeRecord.len;
     for (unsigned int i = 0; i < count; i++) {
-      int coverage = rangeRecord[i].get_coverage (glyph_id);
-      if (coverage >= 0)
+      unsigned int coverage = rangeRecord[i].get_coverage (glyph_id);
+      if (coverage != NOT_COVERED)
         return coverage;
     }
     return NOT_COVERED;
diff --git a/pango/opentype/hb-ot-layout-gsubgpos-private.h b/pango/opentype/hb-ot-layout-gsubgpos-private.h
index f9a1f6b..01b7fae 100644
--- a/pango/opentype/hb-ot-layout-gsubgpos-private.h
+++ b/pango/opentype/hb-ot-layout-gsubgpos-private.h
@@ -188,6 +188,8 @@ static inline bool apply_lookup (LOOKUP_ARGS_DEF,
       lookupRecord++;
       lookupCount--;
       i += buffer->in_pos - old_pos;
+      if (HB_UNLIKELY (buffer->in_pos == end))
+	return true;
 
       if (!done)
 	goto not_applied;
diff --git a/pango/opentype/hb-ot-layout-open-private.h b/pango/opentype/hb-ot-layout-open-private.h
index 0dd291a..98a2499 100644
--- a/pango/opentype/hb-ot-layout-open-private.h
+++ b/pango/opentype/hb-ot-layout-open-private.h
@@ -35,9 +35,9 @@
 
 
 #define NO_INDEX		((unsigned int) 0xFFFF)
-#define NO_CONTEXT		((unsigned int) -0x20000)
-#define NOT_COVERED		((unsigned int) -1)
-#define MAX_NESTING_LEVEL	32
+#define NO_CONTEXT		((unsigned int) 0x110000)
+#define NOT_COVERED		((unsigned int) 0x110000)
+#define MAX_NESTING_LEVEL	8
 
 
 /*



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