[pango/harfbuzz-ng] [GSUB] PairPosFormat2



commit da5b04ad92c37846ace5ecd9a91c18e836759a23
Author: Behdad Esfahbod <behdad behdad org>
Date:   Tue May 19 22:30:09 2009 -0400

    [GSUB] PairPosFormat2
---
 pango/opentype/hb-ot-layout-gpos-private.h |   43 ++++++++++++++++++++++++---
 1 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/pango/opentype/hb-ot-layout-gpos-private.h b/pango/opentype/hb-ot-layout-gpos-private.h
index 2239718..65a1a49 100644
--- a/pango/opentype/hb-ot-layout-gpos-private.h
+++ b/pango/opentype/hb-ot-layout-gpos-private.h
@@ -397,8 +397,8 @@ struct PairPosFormat1 {
 
     const PairSet &pair_set = this+pairSet[index];
 
-    unsigned int len1 = valueFormat1.get_len (),
-		 len2 = valueFormat2.get_len ();
+    unsigned int len1 = valueFormat1.get_len ();
+    unsigned int len2 = valueFormat2.get_len ();
     unsigned int record_len = 1 + len1 + len2;
 
     unsigned int count = pair_set.len;
@@ -440,11 +440,44 @@ struct PairPosFormat2 {
   friend struct PairPos;
 
   private:
-  inline bool apply (APPLY_ARG_DEF) const {
-    /* TODO */
-    return false;
+  inline bool apply (APPLY_ARG_DEF) const
+  {
+    unsigned int end = MIN (buffer->in_length, buffer->in_pos + context_length);
+    if (HB_UNLIKELY (buffer->in_pos + 2 > end))
+      return false;
+
+    unsigned int index = (this+coverage) (IN_CURGLYPH ());
+    if (HB_LIKELY (index == NOT_COVERED))
+      return false;
+
+    unsigned int j = buffer->in_pos + 1;
+    while (!_hb_ot_layout_check_glyph_property (layout, IN_ITEM (j), lookup_flag, &property)) {
+      if (HB_UNLIKELY (j == end))
+	return false;
+      j++;
+    }
+
+    unsigned int len1 = valueFormat1.get_len ();
+    unsigned int len2 = valueFormat2.get_len ();
+    unsigned int record_len = len1 + len2;
+
+    unsigned int klass1 = (this+classDef1) (IN_CURGLYPH ());
+    unsigned int klass2 = (this+classDef2) (IN_GLYPH (j));
+    if (HB_UNLIKELY (klass1 >= class1Count || klass2 >= class2Count))
+      return false;
+
+    const Value *v = values + record_len * (klass1 * class2Count + klass2);
+    valueFormat1.apply_value (layout, (const char *) this, v, CURPOSITION ());
+    valueFormat2.apply_value (layout, (const char *) this, v + len1, POSITION (j));
+
+    if (len2)
+      j++;
+    buffer->in_pos = j;
+
+    return true;
   }
 
+
   private:
   USHORT	format;			/* Format identifier--format = 2 */
   OffsetTo<Coverage>



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