usp10: Take the script direction into account when applying OpenType features.

As opposed to just looking at the run direction.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2017-03-02 09:38:41 +01:00 committed by Alexandre Julliard
parent badb0a7530
commit c94a5fd28c
1 changed files with 7 additions and 6 deletions

View File

@ -751,6 +751,7 @@ static void UpdateClusters(int nextIndex, int changeCount, int write_dir, int ch
return; return;
else else
{ {
int cluster_dir = pwLogClust[0] < pwLogClust[chars-1] ? 1 : -1;
int i; int i;
int target_glyph = nextIndex - write_dir; int target_glyph = nextIndex - write_dir;
int target_index = -1; int target_index = -1;
@ -775,7 +776,7 @@ static void UpdateClusters(int nextIndex, int changeCount, int write_dir, int ch
if (changeCount < 0) if (changeCount < 0)
{ {
/* merge glyphs */ /* merge glyphs */
for(i = target_index; i < chars && i >= 0; i+=write_dir) for (i = target_index; i < chars && i >= 0; i += cluster_dir)
{ {
if (pwLogClust[i] == target_glyph) if (pwLogClust[i] == target_glyph)
continue; continue;
@ -794,8 +795,8 @@ static void UpdateClusters(int nextIndex, int changeCount, int write_dir, int ch
} }
} }
/* renumber trailing indexes*/ /* renumber trailing indexes */
for(i = target_index; i < chars && i >= 0; i+=write_dir) for (i = target_index; i < chars && i >= 0; i += cluster_dir)
{ {
if (pwLogClust[i] != target_glyph) if (pwLogClust[i] != target_glyph)
pwLogClust[i] += changeCount; pwLogClust[i] += changeCount;
@ -803,7 +804,7 @@ static void UpdateClusters(int nextIndex, int changeCount, int write_dir, int ch
} }
else else
{ {
for(i = target_index; i < chars && i >= 0; i+=write_dir) for (i = target_index; i < chars && i >= 0; i += cluster_dir)
pwLogClust[i] += changeCount; pwLogClust[i] += changeCount;
} }
} }
@ -3382,7 +3383,7 @@ static void SHAPE_ApplyOpenTypeFeatures(HDC hdc, ScriptCache *psc, SCRIPT_ANALYS
if (!psc->GSUB_Table) if (!psc->GSUB_Table)
return; return;
if (!psa->fLogicalOrder && psa->fRTL) if (scriptInformation[psa->eScript].a.fRTL && (!psa->fLogicalOrder || !psa->fRTL))
dirL = -1; dirL = -1;
else else
dirL = 1; dirL = 1;