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
3f7ad460
Commit
3f7ad460
authored
Mar 11, 2011
by
Aric Stewart
Committed by
Alexandre Julliard
Mar 14, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
usp10: Update ScriptCPtoX to handle RTL runs.
parent
4bacb3f2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
146 additions
and
2 deletions
+146
-2
usp10.c
dlls/usp10/tests/usp10.c
+111
-0
usp10.c
dlls/usp10/usp10.c
+35
-2
No files found.
dlls/usp10/tests/usp10.c
View file @
3f7ad460
...
...
@@ -1076,6 +1076,7 @@ static void test_ScriptXtoX(void)
int
cGlyphs
;
WORD
pwLogClustXtoCP
[
10
]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
WORD
pwLogClustCPtoX
[
10
]
=
{
0
,
0
,
0
,
1
,
1
,
2
,
2
,
3
,
3
,
3
};
WORD
pwLogClustCPtoX_RTL
[
10
]
=
{
3
,
3
,
3
,
2
,
2
,
1
,
1
,
0
,
0
,
0
};
SCRIPT_VISATTR
psva
[
10
];
int
piAdvance
[
10
]
=
{
200
,
190
,
210
,
180
,
170
,
204
,
189
,
195
,
212
,
203
};
int
piCP
,
piX
;
...
...
@@ -1276,6 +1277,116 @@ static void test_ScriptXtoX(void)
ok
(
hr
==
S_OK
,
"ScriptCPtoX should return S_OK not %08x
\n
"
,
hr
);
ok
(
piX
==
1953
,
"iCP=%d should return piX=1953 not %d
\n
"
,
iCP
,
piX
);
items
[
0
].
a
.
fRTL
=
TRUE
;
iCP
=
0
;
fTrailing
=
FALSE
;
cChars
=
10
;
cGlyphs
=
10
;
hr
=
ScriptCPtoX
(
iCP
,
fTrailing
,
cChars
,
cGlyphs
,
pwLogClustCPtoX_RTL
,
psva
,
piAdvance
,
&
items
[
0
].
a
,
&
piX
);
ok
(
hr
==
S_OK
,
"ScriptCPtoX should return S_OK not %08x
\n
"
,
hr
);
ok
(
piX
==
780
,
"iCP=%d should return piX=780 not %d
\n
"
,
iCP
,
piX
);
iCP
=
1
;
fTrailing
=
FALSE
;
cChars
=
10
;
cGlyphs
=
10
;
hr
=
ScriptCPtoX
(
iCP
,
fTrailing
,
cChars
,
cGlyphs
,
pwLogClustCPtoX_RTL
,
psva
,
piAdvance
,
&
items
[
0
].
a
,
&
piX
);
ok
(
hr
==
S_OK
,
"ScriptCPtoX should return S_OK not %08x
\n
"
,
hr
);
ok
(
piX
==
720
,
"iCP=%d should return piX=720 not %d
\n
"
,
iCP
,
piX
);
iCP
=
2
;
fTrailing
=
FALSE
;
cChars
=
10
;
cGlyphs
=
10
;
hr
=
ScriptCPtoX
(
iCP
,
fTrailing
,
cChars
,
cGlyphs
,
pwLogClustCPtoX_RTL
,
psva
,
piAdvance
,
&
items
[
0
].
a
,
&
piX
);
ok
(
hr
==
S_OK
,
"ScriptCPtoX should return S_OK not %08x
\n
"
,
hr
);
ok
(
piX
==
660
,
"iCP=%d should return piX=660 not %d
\n
"
,
iCP
,
piX
);
iCP
=
3
;
fTrailing
=
FALSE
;
cChars
=
10
;
cGlyphs
=
10
;
hr
=
ScriptCPtoX
(
iCP
,
fTrailing
,
cChars
,
cGlyphs
,
pwLogClustCPtoX_RTL
,
psva
,
piAdvance
,
&
items
[
0
].
a
,
&
piX
);
ok
(
hr
==
S_OK
,
"ScriptCPtoX should return S_OK not %08x
\n
"
,
hr
);
ok
(
piX
==
600
,
"iCP=%d should return piX=600 not %d
\n
"
,
iCP
,
piX
);
iCP
=
4
;
fTrailing
=
FALSE
;
cChars
=
10
;
cGlyphs
=
10
;
hr
=
ScriptCPtoX
(
iCP
,
fTrailing
,
cChars
,
cGlyphs
,
pwLogClustCPtoX_RTL
,
psva
,
piAdvance
,
&
items
[
0
].
a
,
&
piX
);
ok
(
hr
==
S_OK
,
"ScriptCPtoX should return S_OK not %08x
\n
"
,
hr
);
ok
(
piX
==
495
,
"iCP=%d should return piX=495 not %d
\n
"
,
iCP
,
piX
);
iCP
=
5
;
fTrailing
=
FALSE
;
cChars
=
10
;
cGlyphs
=
10
;
hr
=
ScriptCPtoX
(
iCP
,
fTrailing
,
cChars
,
cGlyphs
,
pwLogClustCPtoX_RTL
,
psva
,
piAdvance
,
&
items
[
0
].
a
,
&
piX
);
ok
(
hr
==
S_OK
,
"ScriptCPtoX should return S_OK not %08x
\n
"
,
hr
);
ok
(
piX
==
390
,
"iCP=%d should return piX=390 not %d
\n
"
,
iCP
,
piX
);
iCP
=
6
;
fTrailing
=
FALSE
;
cChars
=
10
;
cGlyphs
=
10
;
hr
=
ScriptCPtoX
(
iCP
,
fTrailing
,
cChars
,
cGlyphs
,
pwLogClustCPtoX_RTL
,
psva
,
piAdvance
,
&
items
[
0
].
a
,
&
piX
);
ok
(
hr
==
S_OK
,
"ScriptCPtoX should return S_OK not %08x
\n
"
,
hr
);
ok
(
piX
==
295
,
"iCP=%d should return piX=295 not %d
\n
"
,
iCP
,
piX
);
iCP
=
7
;
fTrailing
=
FALSE
;
cChars
=
10
;
cGlyphs
=
10
;
hr
=
ScriptCPtoX
(
iCP
,
fTrailing
,
cChars
,
cGlyphs
,
pwLogClustCPtoX_RTL
,
psva
,
piAdvance
,
&
items
[
0
].
a
,
&
piX
);
ok
(
hr
==
S_OK
,
"ScriptCPtoX should return S_OK not %08x
\n
"
,
hr
);
ok
(
piX
==
200
,
"iCP=%d should return piX=200 not %d
\n
"
,
iCP
,
piX
);
iCP
=
8
;
fTrailing
=
FALSE
;
cChars
=
10
;
cGlyphs
=
10
;
hr
=
ScriptCPtoX
(
iCP
,
fTrailing
,
cChars
,
cGlyphs
,
pwLogClustCPtoX_RTL
,
psva
,
piAdvance
,
&
items
[
0
].
a
,
&
piX
);
ok
(
hr
==
S_OK
,
"ScriptCPtoX should return S_OK not %08x
\n
"
,
hr
);
ok
(
piX
==
133
,
"iCP=%d should return piX=133 not %d
\n
"
,
iCP
,
piX
);
iCP
=
9
;
fTrailing
=
FALSE
;
cChars
=
10
;
cGlyphs
=
10
;
hr
=
ScriptCPtoX
(
iCP
,
fTrailing
,
cChars
,
cGlyphs
,
pwLogClustCPtoX_RTL
,
psva
,
piAdvance
,
&
items
[
0
].
a
,
&
piX
);
ok
(
hr
==
S_OK
,
"ScriptCPtoX should return S_OK not %08x
\n
"
,
hr
);
ok
(
piX
==
66
,
"iCP=%d should return piX=66 not %d
\n
"
,
iCP
,
piX
);
iCP
=
10
;
fTrailing
=
FALSE
;
cChars
=
10
;
cGlyphs
=
10
;
hr
=
ScriptCPtoX
(
iCP
,
fTrailing
,
cChars
,
cGlyphs
,
pwLogClustCPtoX_RTL
,
psva
,
piAdvance
,
&
items
[
0
].
a
,
&
piX
);
ok
(
hr
==
S_OK
,
"ScriptCPtoX should return S_OK not %08x
\n
"
,
hr
);
ok
(
piX
==
0
,
"iCP=%d should return piX=0 not %d
\n
"
,
iCP
,
piX
);
iCP
=
11
;
fTrailing
=
FALSE
;
cChars
=
10
;
cGlyphs
=
10
;
hr
=
ScriptCPtoX
(
iCP
,
fTrailing
,
cChars
,
cGlyphs
,
pwLogClustCPtoX_RTL
,
psva
,
piAdvance
,
&
items
[
0
].
a
,
&
piX
);
ok
(
hr
==
S_OK
,
"ScriptCPtoX should return S_OK not %08x
\n
"
,
hr
);
ok
(
piX
==
0
,
"iCP=%d should return piX=0 %d
\n
"
,
iCP
,
piX
);
}
static
void
test_ScriptString
(
HDC
hdc
)
...
...
dlls/usp10/usp10.c
View file @
3f7ad460
...
...
@@ -1106,13 +1106,39 @@ HRESULT WINAPI ScriptCPtoX(int iCP,
int
iCluster
=
-
1
;
int
clust_size
=
1
;
float
special_size
=
0
.
0
;
int
iMaxPos
=
0
;
BOOL
rtl
=
FALSE
;
TRACE
(
"(%d,%d,%d,%d,%p,%p,%p,%p,%p)
\n
"
,
iCP
,
fTrailing
,
cChars
,
cGlyphs
,
pwLogClust
,
psva
,
piAdvance
,
psa
,
piX
);
if
(
psa
->
fRTL
&&
!
psa
->
fLogicalOrder
)
rtl
=
TRUE
;
if
(
fTrailing
)
iCP
++
;
{
if
(
rtl
)
iCP
--
;
else
iCP
++
;
}
if
(
rtl
)
{
int
max_clust
=
pwLogClust
[
0
];
for
(
item
=
0
;
item
<
cGlyphs
;
item
++
)
if
(
pwLogClust
[
item
]
>
max_clust
)
{
ERR
(
"We do not handle non reversed clusters properly
\n
"
);
break
;
}
iMaxPos
=
0
;
for
(
item
=
max_clust
;
item
>=
0
;
item
--
)
iMaxPos
+=
piAdvance
[
item
];
}
iPosX
=
0
.
0
;
for
(
item
=
0
;
item
<
iCP
&&
item
<
cGlyphs
;
item
++
)
...
...
@@ -1136,7 +1162,7 @@ HRESULT WINAPI ScriptCPtoX(int iCP,
else
break
;
}
if
(
check
>=
cGlyphs
)
if
(
check
>=
cGlyphs
&&
!
iMaxPos
)
{
for
(
check
=
clust
;
check
<
cGlyphs
;
check
++
)
special_size
+=
piAdvance
[
check
];
...
...
@@ -1153,6 +1179,13 @@ HRESULT WINAPI ScriptCPtoX(int iCP,
iPosX
+=
piAdvance
[
pwLogClust
[
iCluster
]]
/
(
float
)
clust_size
;
}
if
(
iMaxPos
>
0
)
{
iPosX
=
iMaxPos
-
iPosX
;
if
(
iPosX
<
0
)
iPosX
=
0
;
}
*
piX
=
iPosX
;
TRACE
(
"*piX=%d
\n
"
,
*
piX
);
return
S_OK
;
...
...
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