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
25e836e8
Commit
25e836e8
authored
Dec 12, 2007
by
Hans Leidekker
Committed by
Alexandre Julliard
Dec 13, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
usp10: Do glyph translation for truetype fonts only.
parent
c7278c21
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
42 deletions
+43
-42
usp10.c
dlls/usp10/usp10.c
+43
-42
No files found.
dlls/usp10/usp10.c
View file @
25e836e8
...
...
@@ -145,9 +145,8 @@ static const SCRIPT_PROPERTIES *script_props[] =
typedef
struct
{
HDC
hdc
;
LONG
height
;
WCHAR
default_char
;
LOGFONTW
lf
;
TEXTMETRICW
tm
;
}
ScriptCache
;
typedef
struct
{
...
...
@@ -200,23 +199,23 @@ static HDC get_cache_hdc(SCRIPT_CACHE *psc)
static
WCHAR
get_cache_default_char
(
SCRIPT_CACHE
*
psc
)
{
return
((
ScriptCache
*
)
*
psc
)
->
default_c
har
;
return
((
ScriptCache
*
)
*
psc
)
->
tm
.
tmDefaultC
har
;
}
static
LONG
get_cache_height
(
SCRIPT_CACHE
*
psc
)
{
return
((
ScriptCache
*
)
*
psc
)
->
h
eight
;
return
((
ScriptCache
*
)
*
psc
)
->
tm
.
tmH
eight
;
}
static
HRESULT
init_script_cache
(
const
HDC
hdc
,
ScriptCache
*
sc
)
static
BYTE
get_cache_pitch_family
(
SCRIPT_CACHE
*
p
sc
)
{
TEXTMETRICW
metric
;
return
((
ScriptCache
*
)
*
psc
)
->
tm
.
tmPitchAndFamily
;
}
if
(
!
GetTextMetricsW
(
hdc
,
&
metric
))
return
E_INVALIDARG
;
static
HRESULT
init_script_cache
(
const
HDC
hdc
,
ScriptCache
*
sc
)
{
if
(
!
GetTextMetricsW
(
hdc
,
&
sc
->
tm
))
return
E_INVALIDARG
;
if
(
!
GetObjectW
(
GetCurrentObject
(
hdc
,
OBJ_FONT
),
sizeof
(
LOGFONTW
),
&
sc
->
lf
))
return
E_INVALIDARG
;
sc
->
height
=
metric
.
tmHeight
;
sc
->
default_char
=
metric
.
tmDefaultChar
;
sc
->
hdc
=
hdc
;
return
S_OK
;
}
...
...
@@ -1260,15 +1259,16 @@ HRESULT WINAPI ScriptShape(HDC hdc, SCRIPT_CACHE *psc, const WCHAR *pwcChars,
hfont
=
select_cached_font
(
psc
);
if
(
!
psa
->
fNoGlyphIndex
)
{
/* Glyph translate */
if
(
!
(
GetGlyphIndicesW
(
get_cache_hdc
(
psc
),
pwcChars
,
cChars
,
pwOutGlyphs
,
0
)))
return
S_FALSE
;
if
((
get_cache_pitch_family
(
psc
)
&
TMPF_TRUETYPE
)
&&
!
psa
->
fNoGlyphIndex
)
{
GetGlyphIndicesW
(
get_cache_hdc
(
psc
),
pwcChars
,
cChars
,
pwOutGlyphs
,
0
)
;
}
else
{
for
(
cnt
=
0
;
cnt
<
cChars
;
cnt
++
)
{
/* no translate so set up */
pwOutGlyphs
[
cnt
]
=
pwcChars
[
cnt
];
/* copy in to out and */
}
else
{
TRACE
(
"no glyph translation
\n
"
);
for
(
cnt
=
0
;
cnt
<
cChars
;
cnt
++
)
pwOutGlyphs
[
cnt
]
=
pwcChars
[
cnt
];
}
if
(
psva
)
{
/* set up a valid SCRIPT_VISATTR and LogClust for each char in this run */
...
...
@@ -1311,10 +1311,10 @@ HRESULT WINAPI ScriptPlace(HDC hdc, SCRIPT_CACHE *psc, const WORD *pwGlyphs,
int
cGlyphs
,
const
SCRIPT_VISATTR
*
psva
,
SCRIPT_ANALYSIS
*
psa
,
int
*
piAdvance
,
GOFFSET
*
pGoffset
,
ABC
*
pABC
)
{
int
wcnt
;
HRESULT
hr
;
LPABC
lpABC
;
HFONT
hfont
;
unsigned
int
i
;
TRACE
(
"(%p, %p, %p, %s, %d, %p, %p, %p)
\n
"
,
hdc
,
psc
,
pwGlyphs
,
debugstr_wn
(
pwGlyphs
,
cGlyphs
),
cGlyphs
,
psva
,
psa
,
piAdvance
);
...
...
@@ -1328,38 +1328,39 @@ HRESULT WINAPI ScriptPlace(HDC hdc, SCRIPT_CACHE *psc, const WORD *pwGlyphs,
* has been converted to glyphs and we still need to translate back to the original chars
* to get the correct ABC widths. */
if
(
!
(
lpABC
=
heap_alloc_zero
(
sizeof
(
ABC
)
*
cGlyphs
)))
return
E_OUTOFMEMORY
;
if
(
pABC
)
memset
(
pABC
,
0
,
sizeof
(
ABC
));
if
(
!
(
lpABC
=
heap_alloc_zero
(
sizeof
(
ABC
)
*
cGlyphs
)))
return
E_OUTOFMEMORY
;
if
(
pABC
)
memset
(
pABC
,
0
,
sizeof
(
ABC
));
/* FIXME: set pGoffset to more reasonable values */
if
(
!
GetCharABCWidthsI
(
get_cache_hdc
(
psc
),
0
,
cGlyphs
,
(
WORD
*
)
pwGlyphs
,
lpABC
))
if
((
get_cache_pitch_family
(
psc
)
&
TMPF_TRUETYPE
)
&&
!
psa
->
fNoGlyphIndex
)
{
WARN
(
"Could not get ABC values
\n
"
);
for
(
wcnt
=
0
;
wcnt
<
cGlyphs
;
wcnt
++
)
{
if
(
pGoffset
)
pGoffset
[
wcnt
].
du
=
pGoffset
[
wcnt
].
dv
=
0
;
if
(
piAdvance
)
piAdvance
[
wcnt
]
=
0
;
}
GetCharABCWidthsI
(
get_cache_hdc
(
psc
),
0
,
cGlyphs
,
(
WORD
*
)
pwGlyphs
,
lpABC
);
}
else
{
for
(
wcnt
=
0
;
wcnt
<
cGlyphs
;
wcnt
++
)
/* add up the char lengths */
INT
width
;
for
(
i
=
0
;
i
<
cGlyphs
;
i
++
)
{
TRACE
(
" Glyph=%04x, abcA=%d, abcB=%d, abcC=%d wcnt=%d
\n
"
,
pwGlyphs
[
wcnt
],
lpABC
[
wcnt
].
abcA
,
lpABC
[
wcnt
].
abcB
,
lpABC
[
wcnt
].
abcC
,
wcnt
);
GetCharWidth32W
(
get_cache_hdc
(
psc
),
pwGlyphs
[
i
],
pwGlyphs
[
i
],
&
width
);
lpABC
[
i
].
abcB
=
width
;
}
}
if
(
pABC
)
{
pABC
->
abcA
+=
lpABC
[
wcnt
].
abcA
;
pABC
->
abcB
+=
lpABC
[
wcnt
].
abcB
;
pABC
->
abcC
+=
lpABC
[
wcnt
].
abcC
;
}
if
(
pGoffset
)
pGoffset
[
wcnt
].
du
=
pGoffset
[
wcnt
].
dv
=
0
;
if
(
piAdvance
)
piAdvance
[
wcnt
]
=
lpABC
[
wcnt
].
abcA
+
lpABC
[
wcnt
].
abcB
+
lpABC
[
wcnt
].
abcC
;
for
(
i
=
0
;
i
<
cGlyphs
;
i
++
)
{
TRACE
(
" Glyph=%04x, abcA=%d, abcB=%d, abcC=%d index=%d
\n
"
,
pwGlyphs
[
i
],
lpABC
[
i
].
abcA
,
lpABC
[
i
].
abcB
,
lpABC
[
i
].
abcC
,
i
);
if
(
pABC
)
{
pABC
->
abcA
+=
lpABC
[
i
].
abcA
;
pABC
->
abcB
+=
lpABC
[
i
].
abcB
;
pABC
->
abcC
+=
lpABC
[
i
].
abcC
;
}
/* FIXME: set to more reasonable values */
if
(
pGoffset
)
pGoffset
[
i
].
du
=
pGoffset
[
i
].
dv
=
0
;
if
(
piAdvance
)
piAdvance
[
i
]
=
lpABC
[
i
].
abcA
+
lpABC
[
i
].
abcB
+
lpABC
[
i
].
abcC
;
}
if
(
pABC
)
TRACE
(
"Total for run:
abcA=%d, abcB=%d,
abcC=%d
\n
"
,
pABC
->
abcA
,
pABC
->
abcB
,
pABC
->
abcC
);
if
(
pABC
)
TRACE
(
"Total for run:
abcA=%d, abcB=%d,
abcC=%d
\n
"
,
pABC
->
abcA
,
pABC
->
abcB
,
pABC
->
abcC
);
heap_free
(
lpABC
);
unselect_cached_font
(
psc
,
hfont
);
...
...
@@ -1620,7 +1621,7 @@ const SIZE * WINAPI ScriptString_pSize(SCRIPT_STRING_ANALYSIS ssa)
if
(
!
analysis
->
sz
)
{
if
(
!
(
analysis
->
sz
=
heap_alloc
(
sizeof
(
SIZE
))))
return
NULL
;
analysis
->
sz
->
cy
=
analysis
->
sc
->
h
eight
;
analysis
->
sz
->
cy
=
analysis
->
sc
->
tm
.
tmH
eight
;
analysis
->
sz
->
cx
=
0
;
for
(
i
=
0
;
i
<
analysis
->
numItems
;
i
++
)
...
...
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