dwrite: Use enum members for class testing, simplify reseting to NI before applying Nx rules.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-02-10 13:10:48 +03:00 committed by Alexandre Julliard
parent 3d34f29b5c
commit e17e6e42d1
1 changed files with 9 additions and 7 deletions

View File

@ -759,16 +759,18 @@ static void bidi_resolve_neutrals(IsolatedRun *run)
/* Translate isolates into NI */ /* Translate isolates into NI */
for (i = 0; i < run->length; i++) { for (i = 0; i < run->length; i++) {
if (bidi_is_isolate(*run->item[i].class))
*run->item[i].class = NI;
switch (*run->item[i].class) { switch (*run->item[i].class) {
case B: case B:
case S: case S:
case WS: *run->item[i].class = NI; case WS:
case FSI:
case LRI:
case RLI:
case PDI: *run->item[i].class = NI;
} }
ASSERT(*run->item[i].class < 5 || *run->item[i].class == BN); /* "Only NI, L, R, AN, EN and BN are allowed" */ /* "Only NI, L, R, AN, EN and BN are allowed" */
ASSERT(*run->item[i].class <= EN || *run->item[i].class == BN);
} }
/* N0: Skipping bracketed pairs for now */ /* N0: Skipping bracketed pairs for now */
@ -900,8 +902,8 @@ static void bidi_resolve_implicit(const UINT8 *classes, UINT8 *levels, int sos,
if (classes[i] == BN) if (classes[i] == BN)
continue; continue;
ASSERT(classes[i] > 0); /* "No Neutrals allowed to survive here." */ ASSERT(classes[i] != ON); /* "No Neutrals allowed to survive here." */
ASSERT(classes[i] < 5); /* "Out of range." */ ASSERT(classes[i] <= EN); /* "Out of range." */
if (odd(levels[i]) && (classes[i] == L || classes[i] == EN || classes[i] == AN)) if (odd(levels[i]) && (classes[i] == L || classes[i] == EN || classes[i] == AN))
levels[i]++; levels[i]++;