Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
4459c5b6
Commit
4459c5b6
authored
Apr 19, 2010
by
Aric Stewart
Committed by
Alexandre Julliard
Apr 19, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
usp10: Improve Hebrew support in ScriptItemize.
parent
7c90c1a0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
138 additions
and
3 deletions
+138
-3
usp10.c
dlls/usp10/tests/usp10.c
+124
-1
usp10.c
dlls/usp10/usp10.c
+14
-2
No files found.
dlls/usp10/tests/usp10.c
View file @
4459c5b6
...
...
@@ -34,19 +34,28 @@
static
void
test_ScriptItemize
(
void
)
{
static
const
WCHAR
test1
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
};
/* Arabic, English*/
static
const
WCHAR
test2
[]
=
{
'1'
,
'2'
,
'3'
,
'-'
,
'5'
,
'2'
,
0x064a
,
0x064f
,
0x0633
,
0x0627
,
0x0648
,
0x0650
,
0x064a
,
'7'
,
'1'
,
'.'
,
0
};
/* Thai */
static
const
WCHAR
test3
[]
=
{
0x0e04
,
0x0e27
,
0x0e32
,
0x0e21
,
0x0e1e
,
0x0e22
,
0x0e32
,
0x0e22
,
0x0e32
,
0x0e21
,
0x0e2d
,
0x0e22
,
0x0e39
,
0x0e48
,
0x0e17
,
0x0e35
,
0x0e48
,
0x0e44
,
0x0e2b
,
0x0e19
,
0x0e04
,
0x0e27
,
0x0e32
,
0x0e21
,
0x0e2a
,
0x0e33
,
0x0e40
,
0x0e23
,
0x0e47
,
0x0e08
,
0x0e2d
,
0x0e22
,
0x0e39
,
0x0e48
,
0x0e17
,
0x0e35
,
0x0e48
,
0x0e19
,
0x0e31
,
0x0e48
,
0x0e19
,
0
};
static
const
WCHAR
test4
[]
=
{
'1'
,
'2'
,
'3'
,
'-'
,
'5'
,
'2'
,
' '
,
'i'
,
's'
,
' '
,
'7'
,
'1'
,
'.'
,
0
};
/* Arabic */
static
const
WCHAR
test5
[]
=
{
0x0627
,
0x0644
,
0x0635
,
0x0651
,
0x0650
,
0x062d
,
0x0629
,
0x064f
,
' '
,
0x062a
,
0x064e
,
0x0627
,
0x062c
,
0x064c
,
' '
,
0x0639
,
0x064e
,
0x0644
,
0x0649
,
' '
,
0x0631
,
0x064f
,
0x0624
,
0x0648
,
0x0633
,
0x0650
,
' '
,
0x0627
,
0x0644
,
0x0623
,
0x0635
,
0x0650
,
0x062d
,
0x0651
,
0x064e
,
0x0627
,
0x0621
,
0x0650
,
0
};
SCRIPT_ITEM
items
[
10
];
/* Hebrew */
static
const
WCHAR
test6
[]
=
{
0x05e9
,
0x05dc
,
0x05d5
,
0x05dd
,
'.'
,
0
};
static
const
WCHAR
test7
[]
=
{
'p'
,
'a'
,
'r'
,
't'
,
' '
,
'o'
,
'n'
,
'e'
,
' '
,
0x05d7
,
0x05dc
,
0x05e7
,
' '
,
0x05e9
,
0x05ea
,
0x05d9
,
0x05d9
,
0x05dd
,
' '
,
'p'
,
'a'
,
'r'
,
't'
,
' '
,
't'
,
'h'
,
'r'
,
'e'
,
'e'
,
0
};
static
const
WCHAR
test8
[]
=
{
0x0633
,
0x0644
,
0x0627
,
0x0645
,
0
};
SCRIPT_ITEM
items
[
15
];
SCRIPT_CONTROL
Control
;
SCRIPT_STATE
State
;
HRESULT
hr
;
...
...
@@ -284,6 +293,120 @@ static void test_ScriptItemize( void )
ok
(
items
[
0
].
a
.
fRTL
==
1
,
"Wrong fRTL
\n
"
);
ok
(
items
[
0
].
a
.
fLayoutRTL
==
1
,
"Wrong fLayoutRTL
\n
"
);
ok
(
items
[
0
].
a
.
s
.
uBidiLevel
==
1
,
"Wrong BidiLevel
\n
"
);
hr
=
ScriptItemize
(
test6
,
5
,
10
,
NULL
,
NULL
,
items
,
&
nItems
);
ok
(
!
hr
,
"ScriptItemize should return S_OK not %08x
\n
"
,
hr
);
ok
(
nItems
==
2
,
"Wrong number of items
\n
"
);
ok
(
items
[
0
].
iCharPos
==
0
,
"Wrong CharPos
\n
"
);
ok
(
items
[
0
].
a
.
fRTL
==
1
,
"Wrong fRTL
\n
"
);
ok
(
items
[
0
].
a
.
fLayoutRTL
==
1
,
"Wrong fLayoutRTL
\n
"
);
ok
(
items
[
0
].
a
.
s
.
uBidiLevel
==
1
,
"Wrong BidiLevel
\n
"
);
ok
(
items
[
1
].
iCharPos
==
4
,
"Wrong CharPos
\n
"
);
ok
(
items
[
1
].
a
.
fRTL
==
0
,
"Wrong fRTL
\n
"
);
ok
(
items
[
1
].
a
.
fLayoutRTL
==
0
,
"Wrong fLayoutRTL
\n
"
);
ok
(
items
[
1
].
a
.
s
.
uBidiLevel
==
0
,
"Wrong BidiLevel
\n
"
);
State
.
uBidiLevel
=
0
;
hr
=
ScriptItemize
(
test6
,
5
,
10
,
&
Control
,
&
State
,
items
,
&
nItems
);
ok
(
!
hr
,
"ScriptItemize should return S_OK not %08x
\n
"
,
hr
);
ok
(
nItems
==
2
,
"Wrong number of items
\n
"
);
ok
(
items
[
0
].
iCharPos
==
0
,
"Wrong CharPos
\n
"
);
ok
(
items
[
0
].
a
.
fRTL
==
1
,
"Wrong fRTL
\n
"
);
ok
(
items
[
0
].
a
.
fLayoutRTL
==
1
,
"Wrong fLayoutRTL
\n
"
);
ok
(
items
[
0
].
a
.
s
.
uBidiLevel
==
1
,
"Wrong BidiLevel
\n
"
);
ok
(
items
[
1
].
iCharPos
==
4
,
"Wrong CharPos
\n
"
);
ok
(
items
[
1
].
a
.
fRTL
==
0
,
"Wrong fRTL
\n
"
);
ok
(
items
[
1
].
a
.
fLayoutRTL
==
0
,
"Wrong fLayoutRTL
\n
"
);
ok
(
items
[
1
].
a
.
s
.
uBidiLevel
==
0
,
"Wrong BidiLevel
\n
"
);
State
.
uBidiLevel
=
1
;
hr
=
ScriptItemize
(
test6
,
5
,
10
,
&
Control
,
&
State
,
items
,
&
nItems
);
ok
(
!
hr
,
"ScriptItemize should return S_OK not %08x
\n
"
,
hr
);
ok
(
nItems
==
2
,
"Wrong number of items
\n
"
);
ok
(
items
[
0
].
iCharPos
==
0
,
"Wrong CharPos
\n
"
);
ok
(
items
[
0
].
a
.
fRTL
==
1
,
"Wrong fRTL
\n
"
);
ok
(
items
[
0
].
a
.
fLayoutRTL
==
1
,
"Wrong fLayoutRTL
\n
"
);
ok
(
items
[
0
].
a
.
s
.
uBidiLevel
==
1
,
"Wrong BidiLevel
\n
"
);
ok
(
items
[
1
].
iCharPos
==
4
,
"Wrong CharPos
\n
"
);
todo_wine
ok
(
items
[
1
].
a
.
fRTL
==
1
,
"Wrong fRTL
\n
"
);
todo_wine
ok
(
items
[
1
].
a
.
fLayoutRTL
==
1
,
"Wrong fLayoutRTL
\n
"
);
todo_wine
ok
(
items
[
1
].
a
.
s
.
uBidiLevel
==
1
,
"Wrong BidiLevel
\n
"
);
hr
=
ScriptItemize
(
test7
,
29
,
15
,
NULL
,
NULL
,
items
,
&
nItems
);
ok
(
!
hr
,
"ScriptItemize should return S_OK not %08x
\n
"
,
hr
);
ok
(
nItems
==
3
,
"Wrong number of items
\n
"
);
ok
(
items
[
0
].
iCharPos
==
0
,
"Wrong CharPos
\n
"
);
ok
(
items
[
0
].
a
.
fRTL
==
0
,
"Wrong fRTL
\n
"
);
ok
(
items
[
0
].
a
.
fLayoutRTL
==
0
,
"Wrong fLayoutRTL
\n
"
);
ok
(
items
[
0
].
a
.
s
.
uBidiLevel
==
0
,
"Wrong BidiLevel
\n
"
);
ok
(
items
[
1
].
iCharPos
==
9
,
"Wrong CharPos
\n
"
);
ok
(
items
[
1
].
a
.
fRTL
==
1
,
"Wrong fRTL
\n
"
);
ok
(
items
[
1
].
a
.
fLayoutRTL
==
1
,
"Wrong fLayoutRTL
\n
"
);
ok
(
items
[
1
].
a
.
s
.
uBidiLevel
==
1
,
"Wrong BidiLevel
\n
"
);
ok
(
items
[
2
].
iCharPos
==
19
,
"Wrong CharPos
\n
"
);
ok
(
items
[
2
].
a
.
fRTL
==
0
,
"Wrong fRTL
\n
"
);
ok
(
items
[
2
].
a
.
fLayoutRTL
==
0
,
"Wrong fLayoutRTL
\n
"
);
ok
(
items
[
2
].
a
.
s
.
uBidiLevel
==
0
,
"Wrong BidiLevel
\n
"
);
State
.
uBidiLevel
=
0
;
hr
=
ScriptItemize
(
test7
,
29
,
15
,
&
Control
,
&
State
,
items
,
&
nItems
);
ok
(
!
hr
,
"ScriptItemize should return S_OK not %08x
\n
"
,
hr
);
ok
(
nItems
==
3
,
"Wrong number of items
\n
"
);
ok
(
items
[
0
].
iCharPos
==
0
,
"Wrong CharPos
\n
"
);
ok
(
items
[
0
].
a
.
fRTL
==
0
,
"Wrong fRTL
\n
"
);
ok
(
items
[
0
].
a
.
fLayoutRTL
==
0
,
"Wrong fLayoutRTL
\n
"
);
ok
(
items
[
0
].
a
.
s
.
uBidiLevel
==
0
,
"Wrong BidiLevel
\n
"
);
ok
(
items
[
1
].
iCharPos
==
9
,
"Wrong CharPos
\n
"
);
ok
(
items
[
1
].
a
.
fRTL
==
1
,
"Wrong fRTL
\n
"
);
ok
(
items
[
1
].
a
.
fLayoutRTL
==
1
,
"Wrong fLayoutRTL
\n
"
);
ok
(
items
[
1
].
a
.
s
.
uBidiLevel
==
1
,
"Wrong BidiLevel
\n
"
);
ok
(
items
[
2
].
iCharPos
==
18
,
"Wrong CharPos
\n
"
);
ok
(
items
[
2
].
a
.
fRTL
==
0
,
"Wrong fRTL
\n
"
);
ok
(
items
[
2
].
a
.
fLayoutRTL
==
0
,
"Wrong fLayoutRTL
\n
"
);
ok
(
items
[
2
].
a
.
s
.
uBidiLevel
==
0
,
"Wrong BidiLevel
\n
"
);
State
.
uBidiLevel
=
1
;
hr
=
ScriptItemize
(
test7
,
29
,
15
,
&
Control
,
&
State
,
items
,
&
nItems
);
ok
(
!
hr
,
"ScriptItemize should return S_OK not %08x
\n
"
,
hr
);
ok
(
nItems
==
3
,
"Wrong number of items
\n
"
);
ok
(
items
[
0
].
iCharPos
==
0
,
"Wrong CharPos
\n
"
);
ok
(
items
[
0
].
a
.
fRTL
==
0
,
"Wrong fRTL
\n
"
);
ok
(
items
[
0
].
a
.
fLayoutRTL
==
0
,
"Wrong fLayoutRTL
\n
"
);
ok
(
items
[
0
].
a
.
s
.
uBidiLevel
==
2
,
"Wrong BidiLevel
\n
"
);
ok
(
items
[
1
].
iCharPos
==
8
,
"Wrong CharPos
\n
"
);
ok
(
items
[
1
].
a
.
fRTL
==
1
,
"Wrong fRTL
\n
"
);
ok
(
items
[
1
].
a
.
fLayoutRTL
==
1
,
"Wrong fLayoutRTL
\n
"
);
ok
(
items
[
1
].
a
.
s
.
uBidiLevel
==
1
,
"Wrong BidiLevel
\n
"
);
ok
(
items
[
2
].
iCharPos
==
19
,
"Wrong CharPos
\n
"
);
ok
(
items
[
2
].
a
.
fRTL
==
0
,
"Wrong fRTL
\n
"
);
ok
(
items
[
2
].
a
.
fLayoutRTL
==
0
,
"Wrong fLayoutRTL
\n
"
);
ok
(
items
[
2
].
a
.
s
.
uBidiLevel
==
2
,
"Wrong BidiLevel
\n
"
);
hr
=
ScriptItemize
(
test8
,
4
,
10
,
NULL
,
NULL
,
items
,
&
nItems
);
ok
(
!
hr
,
"ScriptItemize should return S_OK not %08x
\n
"
,
hr
);
ok
(
nItems
==
1
,
"Wrong number of items
\n
"
);
ok
(
items
[
0
].
iCharPos
==
0
,
"Wrong CharPos
\n
"
);
ok
(
items
[
0
].
a
.
fRTL
==
1
,
"Wrong fRTL
\n
"
);
ok
(
items
[
0
].
a
.
fLayoutRTL
==
1
,
"Wrong fLayoutRTL
\n
"
);
ok
(
items
[
0
].
a
.
s
.
uBidiLevel
==
1
,
"Wrong BidiLevel
\n
"
);
State
.
uBidiLevel
=
0
;
hr
=
ScriptItemize
(
test8
,
4
,
10
,
&
Control
,
&
State
,
items
,
&
nItems
);
ok
(
!
hr
,
"ScriptItemize should return S_OK not %08x
\n
"
,
hr
);
ok
(
nItems
==
1
,
"Wrong number of items
\n
"
);
ok
(
items
[
0
].
iCharPos
==
0
,
"Wrong CharPos
\n
"
);
ok
(
items
[
0
].
a
.
fRTL
==
1
,
"Wrong fRTL
\n
"
);
ok
(
items
[
0
].
a
.
fLayoutRTL
==
1
,
"Wrong fLayoutRTL
\n
"
);
ok
(
items
[
0
].
a
.
s
.
uBidiLevel
==
1
,
"Wrong BidiLevel
\n
"
);
State
.
uBidiLevel
=
1
;
hr
=
ScriptItemize
(
test8
,
4
,
10
,
&
Control
,
&
State
,
items
,
&
nItems
);
ok
(
!
hr
,
"ScriptItemize should return S_OK not %08x
\n
"
,
hr
);
ok
(
nItems
==
1
,
"Wrong number of items
\n
"
);
ok
(
items
[
0
].
iCharPos
==
0
,
"Wrong CharPos
\n
"
);
ok
(
items
[
0
].
a
.
fRTL
==
1
,
"Wrong fRTL
\n
"
);
ok
(
items
[
0
].
a
.
fLayoutRTL
==
1
,
"Wrong fLayoutRTL
\n
"
);
ok
(
items
[
0
].
a
.
s
.
uBidiLevel
==
1
,
"Wrong BidiLevel
\n
"
);
}
...
...
dlls/usp10/usp10.c
View file @
4459c5b6
...
...
@@ -517,8 +517,11 @@ HRESULT WINAPI ScriptItemize(const WCHAR *pwcInChars, int cInChars, int cMaxItem
#define Numeric_space 0x0020
#define Arabic_start 0x0600
#define Arabic_stop 0x06ff
#define Hebrew_start 0x0590
#define Hebrew_stop 0x05ff
#define Latin_start 0x0001
#define Latin_stop 0x024f
#define Script_Hebrew 7
#define Script_Arabic 6
#define Script_Latin 1
#define Script_Numeric 5
...
...
@@ -568,6 +571,9 @@ HRESULT WINAPI ScriptItemize(const WCHAR *pwcInChars, int cInChars, int cMaxItem
if
(
pwcInChars
[
cnt
]
>=
Arabic_start
&&
pwcInChars
[
cnt
]
<=
Arabic_stop
)
pItems
[
index
].
a
.
eScript
=
Script_Arabic
;
else
if
(
pwcInChars
[
cnt
]
>=
Hebrew_start
&&
pwcInChars
[
cnt
]
<=
Hebrew_stop
)
pItems
[
index
].
a
.
eScript
=
Script_Hebrew
;
else
if
(
pwcInChars
[
cnt
]
>=
Latin_start
&&
pwcInChars
[
cnt
]
<=
Latin_stop
)
pItems
[
index
].
a
.
eScript
=
Script_Latin
;
...
...
@@ -577,7 +583,8 @@ HRESULT WINAPI ScriptItemize(const WCHAR *pwcInChars, int cInChars, int cMaxItem
pItems
[
index
].
a
.
fLayoutRTL
=
odd
(
levels
[
cnt
]);
pItems
[
index
].
a
.
s
.
uBidiLevel
=
levels
[
cnt
];
}
else
if
(
pItems
[
index
].
a
.
eScript
==
Script_Arabic
)
else
if
((
pItems
[
index
].
a
.
eScript
==
Script_Arabic
)
||
(
pItems
[
index
].
a
.
eScript
==
Script_Hebrew
))
{
pItems
[
index
].
a
.
s
.
uBidiLevel
=
1
;
pItems
[
index
].
a
.
fRTL
=
1
;
...
...
@@ -608,6 +615,10 @@ HRESULT WINAPI ScriptItemize(const WCHAR *pwcInChars, int cInChars, int cMaxItem
||
(
New_Script
==
Script_Arabic
&&
pwcInChars
[
cnt
]
==
Numeric_space
))
New_Script
=
Script_Arabic
;
else
if
((
pwcInChars
[
cnt
]
>=
Hebrew_start
&&
pwcInChars
[
cnt
]
<=
Hebrew_stop
)
||
(
New_Script
==
Script_Hebrew
&&
pwcInChars
[
cnt
]
==
Numeric_space
))
New_Script
=
Script_Hebrew
;
else
if
((
pwcInChars
[
cnt
]
>=
Latin_start
&&
pwcInChars
[
cnt
]
<=
Latin_stop
)
||
(
New_Script
==
Script_Latin
&&
pwcInChars
[
cnt
]
==
Numeric_space
))
New_Script
=
Script_Latin
;
...
...
@@ -630,7 +641,8 @@ HRESULT WINAPI ScriptItemize(const WCHAR *pwcInChars, int cInChars, int cMaxItem
pItems
[
index
].
a
.
fLayoutRTL
=
odd
(
levels
[
cnt
]);
pItems
[
index
].
a
.
s
.
uBidiLevel
=
levels
[
cnt
];
}
else
if
(
New_Script
==
Script_Arabic
)
else
if
((
New_Script
==
Script_Arabic
)
||
(
New_Script
==
Script_Hebrew
))
{
pItems
[
index
].
a
.
s
.
uBidiLevel
=
1
;
pItems
[
index
].
a
.
fRTL
=
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment