[PATCH 1/5] usp10: Resolve BNs and explicit formatting characters to the preceding level in resolveResolved().

Aric Stewart aric at codeweavers.com
Thu May 19 07:10:17 CDT 2016


Signed-off-by: Aric Stewart <aric at codeweavers.com>

On 5/18/16 11:43 AM, Henri Verbeet wrote:
> As in section 5.2 of the Unicode Bidirectional Algorithm.
> 
> Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
> ---
>   dlls/usp10/bidi.c        |  5 +++++
>   dlls/usp10/tests/usp10.c | 10 ++++++++++
>   2 files changed, 15 insertions(+)
> 
> diff --git a/dlls/usp10/bidi.c b/dlls/usp10/bidi.c
> index caa266b..5adce9d 100644
> --- a/dlls/usp10/bidi.c
> +++ b/dlls/usp10/bidi.c
> @@ -969,6 +969,11 @@ static void resolveResolved(unsigned baselevel, const WORD * pcls, WORD *plevel,
>                   plevel[j--] = baselevel;
>               plevel[i] = baselevel;
>           }
> +        else if (pcls[i] == LRE || pcls[i] == RLE || pcls[i] == LRO || pcls[i] == RLO ||
> +                 pcls[i] == PDF || pcls[i] == BN)
> +        {
> +            plevel[i] = i ? plevel[i - 1] : baselevel;
> +        }
>           if (i == eos &&
>               (pcls[i] == WS || pcls[i] == FSI || pcls[i] == LRI || pcls[i] == RLI ||
>                pcls[i] == PDI || pcls[i] == LRE || pcls[i] == RLE || pcls[i] == LRO ||
> diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c
> index 7881667..d0c698f 100644
> --- a/dlls/usp10/tests/usp10.c
> +++ b/dlls/usp10/tests/usp10.c
> @@ -563,6 +563,11 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
>                                   {{0,0,0,0,0,0},2,0,1,0,1,0,FALSE},
>                                   {{0,0,0,0,0,0},8,0,0,0,0,-1,FALSE}};
>   
> +    /* ZWNJ */
> +    static const WCHAR test56[] = {0x0645, 0x06cc, 0x200c, 0x06a9, 0x0646, 0x0645}; /* می‌کنم */
> +    static const itemTest t561[] = {{{0,0,0,0,0,0},0,1,1,1,0,arab_tag,FALSE},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE}};
> +    static const itemTest t562[] = {{{0,0,0,0,0,0},0,0,0,0,1,arab_tag,FALSE},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE}};
> +
>       SCRIPT_ITEM items[15];
>       SCRIPT_CONTROL  Control;
>       SCRIPT_STATE    State;
> @@ -643,6 +648,7 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
>       test_items_ok(test45,24,NULL,NULL,1,t451,FALSE,0);
>       test_items_ok(test46,16,NULL,NULL,1,t461,FALSE,0);
>       test_items_ok(test47,26,NULL,NULL,1,t471,FALSE,0);
> +    test_items_ok(test56,6,NULL,NULL,1,t561,FALSE,0);
>   
>       State.uBidiLevel = 0;
>       test_items_ok(test1,4,&Control,&State,1,t11,FALSE,0);
> @@ -705,6 +711,7 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
>       test_items_ok(test53,8,&Control,&State,4,t531,FALSE,0);
>       test_items_ok(test54,7,&Control,&State,2,t541,FALSE,0);
>       test_items_ok(test55,8,&Control,&State,2,t551,FALSE,0);
> +    test_items_ok(test56,6,&Control,&State,1,t561,FALSE,0);
>   
>       State.uBidiLevel = 1;
>       test_items_ok(test1,4,&Control,&State,1,t12,FALSE,0);
> @@ -759,6 +766,7 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
>       test_items_ok(test45,24,&Control,&State,1,t452,FALSE,0);
>       test_items_ok(test46,16,&Control,&State,1,t462,FALSE,0);
>       test_items_ok(test47,26,&Control,&State,1,t472,FALSE,0);
> +    test_items_ok(test56,6,&Control,&State,1,t561,FALSE,0);
>   
>       State.uBidiLevel = 1;
>       Control.fMergeNeutralItems = TRUE;
> @@ -814,6 +822,7 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
>       test_items_ok(test45,24,&Control,&State,1,t452,FALSE,0);
>       test_items_ok(test46,16,&Control,&State,1,t462,FALSE,0);
>       test_items_ok(test47,26,&Control,&State,1,t472,FALSE,0);
> +    test_items_ok(test56,6,&Control,&State,1,t561,FALSE,0);
>   
>       State.uBidiLevel = 0;
>       Control.fMergeNeutralItems = FALSE;
> @@ -878,6 +887,7 @@ static const itemTest t74[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
>       test_items_ok(test53,8,&Control,&State,4,t532,FALSE,0);
>       test_items_ok(test54,7,&Control,&State,2,t542,FALSE,0);
>       test_items_ok(test55,8,&Control,&State,2,t552,FALSE,0);
> +    test_items_ok(test56,6,&Control,&State,1,t562,FALSE,0);
>   }
>   
>   static inline void _test_shape_ok(int valid, HDC hdc, LPCWSTR string,
> 



More information about the wine-patches mailing list