Henri Verbeet : usp10: Return the logical offset in GPOS_apply_PairAdjustment().

Alexandre Julliard julliard at winehq.org
Tue Feb 21 16:56:13 CST 2017


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Sun Feb 19 19:02:30 2017 +0100

usp10: Return the logical offset in GPOS_apply_PairAdjustment().

The base index is redundant, and actually makes it harder to iterate in
logical order in GPOS_apply_feature().

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Aric Stewart <aric at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/usp10/opentype.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/dlls/usp10/opentype.c b/dlls/usp10/opentype.c
index a67bba7..07066f6 100644
--- a/dlls/usp10/opentype.c
+++ b/dlls/usp10/opentype.c
@@ -1695,7 +1695,8 @@ static INT GPOS_apply_PairAdjustment(const OT_LookupTable *look, const SCRIPT_AN
     int j;
     int write_dir = (analysis->fRTL && !analysis->fLogicalOrder) ? -1 : 1;
 
-    if (glyph_index + write_dir < 0 || glyph_index + write_dir >= glyph_count) return glyph_index + 1;
+    if (glyph_index + write_dir < 0 || glyph_index + write_dir >= glyph_count)
+        return 1;
 
     TRACE("Pair Adjustment Positioning Subtable\n");
 
@@ -1731,7 +1732,7 @@ static INT GPOS_apply_PairAdjustment(const OT_LookupTable *look, const SCRIPT_AN
                         TRACE("Format 1: Found Pair %x,%x\n",glyphs[glyph_index],glyphs[glyph_index+write_dir]);
                         apply_pair_value( ppf1, ValueFormat1, ValueFormat2, pair_val_rec->Value1, ppem, ptAdjust, ptAdvance );
                         if (ValueFormat2) next++;
-                        return glyph_index + next;
+                        return next;
                     }
                     pair_val_rec = (const GPOS_PairValueRecord *)(pair_val_rec->Value1 + val_fmt1_size + val_fmt2_size);
                 }
@@ -1764,14 +1765,14 @@ static INT GPOS_apply_PairAdjustment(const OT_LookupTable *look, const SCRIPT_AN
 
                     apply_pair_value( ppf2, ValueFormat1, ValueFormat2, pair_val, ppem, ptAdjust, ptAdvance );
                     if (ValueFormat2) next++;
-                    return glyph_index + next;
+                    return next;
                 }
             }
         }
         else
             FIXME("Pair Adjustment Positioning: Format %i Unhandled\n",GET_BE_WORD(ppf1->PosFormat));
     }
-    return glyph_index+1;
+    return 1;
 }
 
 static VOID GPOS_apply_CursiveAttachment(const OT_LookupTable *look, const SCRIPT_ANALYSIS *analysis, const WORD *glyphs, INT glyph_index,
@@ -2320,11 +2321,12 @@ static INT GPOS_apply_lookup(ScriptCache *psc, LPOUTLINETEXTMETRICW lpotm, LPLOG
             POINT advance[2]= {{0,0},{0,0}};
             POINT adjust[2]= {{0,0},{0,0}};
             double devX, devY;
-            int index;
+            int index_offset;
             int write_dir = (analysis->fRTL && !analysis->fLogicalOrder) ? -1 : 1;
             int offset_sign = (analysis->fRTL && analysis->fLogicalOrder) ? -1 : 1;
 
-            index = GPOS_apply_PairAdjustment(look, analysis, glyphs, glyph_index, glyph_count, ppem, adjust, advance);
+            index_offset = GPOS_apply_PairAdjustment(look, analysis, glyphs,
+                    glyph_index, glyph_count, ppem, adjust, advance);
             if (adjust[0].x || adjust[0].y)
             {
                 GPOS_convert_design_units_to_device(lpotm, lplogfont, adjust[0].x, adjust[0].y, &devX, &devY);
@@ -2347,7 +2349,7 @@ static INT GPOS_apply_lookup(ScriptCache *psc, LPOUTLINETEXTMETRICW lpotm, LPLOG
                 GPOS_convert_design_units_to_device(lpotm, lplogfont, advance[1].x, advance[1].y, &devX, &devY);
                 piAdvance[glyph_index + write_dir] += round(devX);
             }
-            return index;
+            return glyph_index + index_offset;
         }
 
         case GPOS_LOOKUP_ATTACH_CURSIVE:




More information about the wine-cvs mailing list