usp10: Correct implementation of Pair Positioning Adjustment: Format 1.

This commit is contained in:
Aric Stewart 2012-08-14 09:32:02 -05:00 committed by Alexandre Julliard
parent fa7a34b907
commit e2250ce6cb
1 changed files with 35 additions and 32 deletions

View File

@ -1174,23 +1174,23 @@ static INT GPOS_apply_PairAdjustment(const OT_LookupTable *look, const WORD *gly
ppf1 = (const GPOS_PairPosFormat1*)((const BYTE*)look+offset); ppf1 = (const GPOS_PairPosFormat1*)((const BYTE*)look+offset);
if (GET_BE_WORD(ppf1->PosFormat) == 1) if (GET_BE_WORD(ppf1->PosFormat) == 1)
{ {
int index;
offset = GET_BE_WORD(ppf1->Coverage); offset = GET_BE_WORD(ppf1->Coverage);
if (GSUB_is_glyph_covered((const BYTE*)ppf1+offset, glyphs[glyph_index]) != -1) index = GSUB_is_glyph_covered((const BYTE*)ppf1+offset, glyphs[glyph_index]);
{ if (index != -1 && index < GET_BE_WORD(ppf1->PairSetCount))
int i;
int count = GET_BE_WORD(ppf1->PairSetCount);
for (i = 0; i < count; i++)
{ {
int k; int k;
int pair_count; int pair_count;
const GPOS_PairSet *ps; const GPOS_PairSet *ps;
offset = GET_BE_WORD(ppf1->PairSetOffset[i]); offset = GET_BE_WORD(ppf1->PairSetOffset[index]);
ps = (const GPOS_PairSet*)((const BYTE*)ppf1+offset); ps = (const GPOS_PairSet*)((const BYTE*)ppf1+offset);
pair_count = GET_BE_WORD(ps->PairValueCount); pair_count = GET_BE_WORD(ps->PairValueCount);
for (k = 0; k < pair_count; k++) for (k = 0; k < pair_count; k++)
{ {
if (glyphs[glyph_index+write_dir] == GET_BE_WORD(ps->PairValueRecord[k].SecondGlyph)) WORD second_glyph = GET_BE_WORD(ps->PairValueRecord[k].SecondGlyph);
if (glyphs[glyph_index+write_dir] == second_glyph)
{ {
int next = 1;
GPOS_ValueRecord ValueRecord1 = {0,0,0,0,0,0,0,0}; GPOS_ValueRecord ValueRecord1 = {0,0,0,0,0,0,0,0};
GPOS_ValueRecord ValueRecord2 = {0,0,0,0,0,0,0,0}; GPOS_ValueRecord ValueRecord2 = {0,0,0,0,0,0,0,0};
WORD ValueFormat1 = GET_BE_WORD(ppf1->ValueFormat1); WORD ValueFormat1 = GET_BE_WORD(ppf1->ValueFormat1);
@ -1204,14 +1204,17 @@ static INT GPOS_apply_PairAdjustment(const OT_LookupTable *look, const WORD *gly
{ {
GPOS_get_value_record_offsets((const BYTE*)ppf1, &ValueRecord1, ValueFormat1, ppem, &ptAdjust[0], &ptAdvance[0]); GPOS_get_value_record_offsets((const BYTE*)ppf1, &ValueRecord1, ValueFormat1, ppem, &ptAdjust[0], &ptAdvance[0]);
TRACE("Glyph 1 resulting cumulative offset is %i,%i design units\n",ptAdjust[0].x,ptAdjust[0].y); TRACE("Glyph 1 resulting cumulative offset is %i,%i design units\n",ptAdjust[0].x,ptAdjust[0].y);
TRACE("Glyph 1 resulting cumulative advance is %i,%i design units\n",ptAdvance[0].x,ptAdvance[0].y);
} }
if (ValueFormat2) if (ValueFormat2)
{ {
GPOS_get_value_record_offsets((const BYTE*)ppf1, &ValueRecord2, ValueFormat2, ppem, &ptAdjust[1], &ptAdvance[1]); GPOS_get_value_record_offsets((const BYTE*)ppf1, &ValueRecord2, ValueFormat2, ppem, &ptAdjust[1], &ptAdvance[1]);
TRACE("Glyph 2 resulting cumulative offset is %i,%i design units\n",ptAdjust[1].x,ptAdjust[1].y); TRACE("Glyph 2 resulting cumulative offset is %i,%i design units\n",ptAdjust[1].x,ptAdjust[1].y);
return glyph_index+2; TRACE("Glyph 2 resulting cumulative advance is %i,%i design units\n",ptAdvance[1].x,ptAdvance[1].y);
} next++;
} }
if (next)
return glyph_index + next;
} }
} }
} }