Huw Davies : usp10: Add support for format 2 pair adjustments.

Alexandre Julliard julliard at winehq.org
Thu Dec 20 12:39:56 CST 2012


Module: wine
Branch: master
Commit: 496898db510a3a38483d25ed3f1afbf76016500a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=496898db510a3a38483d25ed3f1afbf76016500a

Author: Huw Davies <huw at codeweavers.com>
Date:   Thu Dec 20 12:55:34 2012 +0000

usp10: Add support for format 2 pair adjustments.

---

 dlls/usp10/opentype.c |   43 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/dlls/usp10/opentype.c b/dlls/usp10/opentype.c
index 45d28ef..10edc23 100644
--- a/dlls/usp10/opentype.c
+++ b/dlls/usp10/opentype.c
@@ -352,6 +352,18 @@ typedef struct {
 } GPOS_PairPosFormat1;
 
 typedef struct {
+    WORD PosFormat;
+    WORD Coverage;
+    WORD ValueFormat1;
+    WORD ValueFormat2;
+    WORD ClassDef1;
+    WORD ClassDef2;
+    WORD Class1Count;
+    WORD Class2Count;
+    WORD Class1Record[1];
+} GPOS_PairPosFormat2;
+
+typedef struct {
     WORD SecondGlyph;
     WORD Value1[1];
     WORD Value2[1];
@@ -1255,6 +1267,37 @@ static INT GPOS_apply_PairAdjustment(const OT_LookupTable *look, const WORD *gly
                 }
             }
         }
+        else if (GET_BE_WORD(ppf1->PosFormat) == 2)
+        {
+            const GPOS_PairPosFormat2 *ppf2 = (const GPOS_PairPosFormat2*)((const BYTE*)look + offset);
+            int index;
+            WORD ValueFormat1 = GET_BE_WORD( ppf2->ValueFormat1 );
+            WORD ValueFormat2 = GET_BE_WORD( ppf2->ValueFormat2 );
+            INT val_fmt1_size = GPOS_get_value_record( ValueFormat1, NULL, NULL );
+            INT val_fmt2_size = GPOS_get_value_record( ValueFormat2, NULL, NULL );
+            WORD class1_count = GET_BE_WORD( ppf2->Class1Count );
+            WORD class2_count = GET_BE_WORD( ppf2->Class2Count );
+
+            offset = GET_BE_WORD( ppf2->Coverage );
+            index = GSUB_is_glyph_covered( (const BYTE*)ppf2 + offset, glyphs[glyph_index] );
+            if (index != -1)
+            {
+                WORD class1, class2;
+                class1 = OT_get_glyph_class( (const BYTE *)ppf2 + GET_BE_WORD(ppf2->ClassDef1), glyphs[glyph_index] );
+                class2 = OT_get_glyph_class( (const BYTE *)ppf2 + GET_BE_WORD(ppf2->ClassDef2), glyphs[glyph_index + write_dir] );
+                if (class1 < class1_count && class2 < class2_count)
+                {
+                    const WORD *pair_val = ppf2->Class1Record + (class1 * class2_count + class2) * (val_fmt1_size + val_fmt2_size);
+                    int next = 1;
+
+                    TRACE( "Format 2: Found Pair %x,%x\n", glyphs[glyph_index], glyphs[glyph_index + write_dir] );
+
+                    apply_pair_value( ppf2, ValueFormat1, ValueFormat2, pair_val, ppem, ptAdjust, ptAdvance );
+                    if (ValueFormat2) next++;
+                    return glyph_index + next;
+                }
+            }
+        }
         else
             FIXME("Pair Adjustment Positioning: Format %i Unhandled\n",GET_BE_WORD(ppf1->PosFormat));
     }




More information about the wine-cvs mailing list