Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
c7b4964b
Commit
c7b4964b
authored
Mar 17, 2011
by
Aric Stewart
Committed by
Alexandre Julliard
Mar 18, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
usp10: Rewrite of ScriptXtoCP to handle pwLogClust for LTR and RTL runs.
parent
7acd2ba2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
105 additions
and
19 deletions
+105
-19
usp10.c
dlls/usp10/tests/usp10.c
+0
-0
usp10.c
dlls/usp10/usp10.c
+105
-19
No files found.
dlls/usp10/tests/usp10.c
View file @
c7b4964b
This diff is collapsed.
Click to expand it.
dlls/usp10/usp10.c
View file @
c7b4964b
...
...
@@ -1201,40 +1201,126 @@ HRESULT WINAPI ScriptXtoCP(int iX,
int
*
piTrailing
)
{
int
item
;
int
iPosX
;
float
fMaxPosX
=
1
;
float
fAvePosX
;
float
iPosX
;
float
iLastPosX
;
int
iSpecial
=
-
1
;
int
iCluster
=
-
1
;
int
clust_size
=
1
;
float
special_size
=
0
.
0
;
int
direction
=
1
;
TRACE
(
"(%d,%d,%d,%p,%p,%p,%p,%p,%p)
\n
"
,
iX
,
cChars
,
cGlyphs
,
pwLogClust
,
psva
,
piAdvance
,
psa
,
piCP
,
piTrailing
);
if
(
iX
<
0
)
/* iX is before start of run */
if
(
psa
->
fRTL
&&
!
psa
->
fLogicalOrder
)
direction
=
-
1
;
if
(
direction
<
0
)
{
*
piCP
=
-
1
;
*
piTrailing
=
TRUE
;
int
max_clust
=
pwLogClust
[
0
];
if
(
iX
<
0
)
{
*
piCP
=
cGlyphs
;
*
piTrailing
=
0
;
return
S_OK
;
}
for
(
item
=
0
;
item
<
cGlyphs
;
item
++
)
/* total piAdvance */
fMaxPosX
+=
piAdvance
[
item
];
for
(
item
=
0
;
item
<
cGlyphs
;
item
++
)
if
(
pwLogClust
[
item
]
>
max_clust
)
{
ERR
(
"We do not handle non reversed clusters properly
\n
"
);
break
;
}
}
if
(
iX
>=
fMaxPosX
)
/* iX too large */
if
(
iX
<
0
)
{
*
piCP
=
cChars
;
*
piTrailing
=
FALSE
;
*
piCP
=
-
1
;
*
piTrailing
=
1
;
return
S_OK
;
}
fAvePosX
=
fMaxPosX
/
cGlyphs
;
iPosX
=
fAvePosX
;
for
(
item
=
1
;
item
<
cGlyphs
&&
iPosX
<
iX
;
item
++
)
iPosX
+=
fAvePosX
;
if
(
iPosX
-
iX
>
fAvePosX
/
2
)
iPosX
=
iLastPosX
=
0
;
if
(
direction
>
0
)
item
=
0
;
else
item
=
cGlyphs
-
1
;
for
(;
iPosX
<=
iX
&&
item
<
cGlyphs
&&
item
>=
0
;
item
+=
direction
)
{
iLastPosX
=
iPosX
;
if
(
iSpecial
==
-
1
&&
(
iCluster
==
-
1
||
(
iCluster
!=
-
1
&&
((
direction
>
0
&&
iCluster
+
clust_size
<=
item
)
||
(
direction
<
0
&&
iCluster
-
clust_size
>=
item
))
)
)
)
{
int
check
;
int
clust
=
pwLogClust
[
item
];
clust_size
=
1
;
iCluster
=
-
1
;
for
(
check
=
item
+
direction
;
check
<
cGlyphs
&&
check
>=
0
;
check
+=
direction
)
{
if
(
pwLogClust
[
check
]
==
clust
)
{
clust_size
++
;
if
(
iCluster
==
-
1
)
iCluster
=
item
;
}
else
break
;
}
if
(
check
>=
cGlyphs
&&
direction
>
0
)
{
for
(
check
=
clust
;
check
<
cGlyphs
;
check
++
)
special_size
+=
piAdvance
[
check
];
iSpecial
=
item
;
special_size
/=
(
cChars
-
item
);
iPosX
+=
special_size
;
}
else
iPosX
+=
piAdvance
[
clust
]
/
(
float
)
clust_size
;
}
else
if
(
iSpecial
!=
-
1
)
iPosX
+=
special_size
;
else
/* (iCluster != -1) */
iPosX
+=
piAdvance
[
pwLogClust
[
iCluster
]]
/
(
float
)
clust_size
;
}
if
(
direction
>
0
)
{
if
(
iPosX
>
iX
)
item
--
;
if
(
item
<
cGlyphs
&&
((
iPosX
-
iLastPosX
)
/
2
.
0
)
+
iX
>
iPosX
)
*
piTrailing
=
1
;
else
*
piTrailing
=
0
;
}
else
{
if
(
iX
==
iLastPosX
)
item
++
;
if
(
iX
>=
iLastPosX
&&
iX
<=
iPosX
)
item
++
;
if
(
iLastPosX
==
iX
)
*
piTrailing
=
0
;
else
if
(
item
<
0
||
((
iLastPosX
-
iPosX
)
/
2
.
0
)
+
iX
<=
iLastPosX
)
*
piTrailing
=
1
;
else
*
piTrailing
=
1
;
/* yep we are over halfway */
*
piTrailing
=
0
;
}
*
piCP
=
item
;
*
piCP
=
item
-
1
;
/* Return character position */
TRACE
(
"*pi
CP=%d iPposX=%d
\n
"
,
*
piCP
,
iPosX
);
TRACE
(
"*piCP=%d
\n
"
,
*
piCP
);
TRACE
(
"*pi
Trailing=%d
\n
"
,
*
piTrailing
);
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