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
4a300d24
Commit
4a300d24
authored
Sep 11, 2013
by
Aric Stewart
Committed by
Alexandre Julliard
Sep 11, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: GetCharWidth32A/W return positive widths for all layouts and various DC transforms.
parent
b4d8b52f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
1 deletion
+113
-1
font.c
dlls/gdi32/font.c
+5
-1
font.c
dlls/gdi32/tests/font.c
+108
-0
No files found.
dlls/gdi32/font.c
View file @
4a300d24
...
...
@@ -1748,9 +1748,13 @@ BOOL WINAPI GetCharWidth32W( HDC hdc, UINT firstChar, UINT lastChar,
if
(
ret
)
{
#define WDPTOLP(x) ((x<0)? \
(-abs(INTERNAL_XDSTOWS(dc, (x)))): \
(abs(INTERNAL_XDSTOWS(dc, (x)))))
/* convert device units to logical */
for
(
i
=
firstChar
;
i
<=
lastChar
;
i
++
,
buffer
++
)
*
buffer
=
INTERNAL_XDSTOWS
(
dc
,
*
buffer
);
*
buffer
=
WDPTOLP
(
*
buffer
);
#undef WDPTOLP
}
release_dc_ptr
(
dc
);
return
ret
;
...
...
dlls/gdi32/tests/font.c
View file @
4a300d24
...
...
@@ -42,6 +42,8 @@ static BOOL (WINAPI *pGetCharABCWidthsI)(HDC hdc, UINT first, UINT count, LPWOR
static
BOOL
(
WINAPI
*
pGetCharABCWidthsA
)(
HDC
hdc
,
UINT
first
,
UINT
last
,
LPABC
abc
);
static
BOOL
(
WINAPI
*
pGetCharABCWidthsW
)(
HDC
hdc
,
UINT
first
,
UINT
last
,
LPABC
abc
);
static
BOOL
(
WINAPI
*
pGetCharABCWidthsFloatW
)(
HDC
hdc
,
UINT
first
,
UINT
last
,
LPABCFLOAT
abc
);
static
BOOL
(
WINAPI
*
pGetCharWidth32A
)(
HDC
hdc
,
UINT
first
,
UINT
last
,
LPINT
buffer
);
static
BOOL
(
WINAPI
*
pGetCharWidth32W
)(
HDC
hdc
,
UINT
first
,
UINT
last
,
LPINT
buffer
);
static
DWORD
(
WINAPI
*
pGetFontUnicodeRanges
)(
HDC
hdc
,
LPGLYPHSET
lpgs
);
static
DWORD
(
WINAPI
*
pGetGlyphIndicesA
)(
HDC
hdc
,
LPCSTR
lpstr
,
INT
count
,
LPWORD
pgi
,
DWORD
flags
);
static
DWORD
(
WINAPI
*
pGetGlyphIndicesW
)(
HDC
hdc
,
LPCWSTR
lpstr
,
INT
count
,
LPWORD
pgi
,
DWORD
flags
);
...
...
@@ -83,6 +85,8 @@ static void init(void)
pGetCharABCWidthsA
=
(
void
*
)
GetProcAddress
(
hgdi32
,
"GetCharABCWidthsA"
);
pGetCharABCWidthsW
=
(
void
*
)
GetProcAddress
(
hgdi32
,
"GetCharABCWidthsW"
);
pGetCharABCWidthsFloatW
=
(
void
*
)
GetProcAddress
(
hgdi32
,
"GetCharABCWidthsFloatW"
);
pGetCharWidth32A
=
(
void
*
)
GetProcAddress
(
hgdi32
,
"GetCharWidth32A"
);
pGetCharWidth32W
=
(
void
*
)
GetProcAddress
(
hgdi32
,
"GetCharWidth32W"
);
pGetFontUnicodeRanges
=
(
void
*
)
GetProcAddress
(
hgdi32
,
"GetFontUnicodeRanges"
);
pGetGlyphIndicesA
=
(
void
*
)
GetProcAddress
(
hgdi32
,
"GetGlyphIndicesA"
);
pGetGlyphIndicesW
=
(
void
*
)
GetProcAddress
(
hgdi32
,
"GetGlyphIndicesW"
);
...
...
@@ -5348,6 +5352,109 @@ static void test_vertical_order(void)
DeleteDC
(
hdc
);
}
static
void
test_GetCharWidth32
(
void
)
{
BOOL
ret
;
HDC
hdc
;
LOGFONTA
lf
;
HFONT
hfont
;
INT
bufferA
;
INT
bufferW
;
HWND
hwnd
;
if
(
!
pGetCharWidth32A
||
!
pGetCharWidth32W
)
{
win_skip
(
"GetCharWidth32A/W not available on this platform
\n
"
);
return
;
}
memset
(
&
lf
,
0
,
sizeof
(
lf
));
strcpy
(
lf
.
lfFaceName
,
"System"
);
lf
.
lfHeight
=
20
;
hfont
=
CreateFontIndirectA
(
&
lf
);
hdc
=
GetDC
(
0
);
hfont
=
SelectObject
(
hdc
,
hfont
);
ret
=
pGetCharWidth32W
(
hdc
,
'a'
,
'a'
,
&
bufferW
);
ok
(
ret
,
"GetCharWidth32W should have succeeded
\n
"
);
ret
=
pGetCharWidth32A
(
hdc
,
'a'
,
'a'
,
&
bufferA
);
ok
(
ret
,
"GetCharWidth32A should have succeeded
\n
"
);
ok
(
bufferA
==
bufferW
,
"Widths should be the same
\n
"
);
ok
(
bufferA
>
0
,
" Width should be greater than zero
\n
"
);
hfont
=
SelectObject
(
hdc
,
hfont
);
DeleteObject
(
hfont
);
ReleaseDC
(
NULL
,
hdc
);
memset
(
&
lf
,
0
,
sizeof
(
lf
));
strcpy
(
lf
.
lfFaceName
,
"Tahoma"
);
lf
.
lfHeight
=
20
;
hfont
=
CreateFontIndirectA
(
&
lf
);
hwnd
=
CreateWindowEx
(
0
,
"static"
,
""
,
WS_POPUP
,
0
,
0
,
100
,
100
,
0
,
0
,
0
,
NULL
);
hdc
=
GetDC
(
hwnd
);
SetMapMode
(
hdc
,
MM_ANISOTROPIC
);
SelectObject
(
hdc
,
hfont
);
ret
=
pGetCharWidth32W
(
hdc
,
'a'
,
'a'
,
&
bufferW
);
ok
(
ret
,
"GetCharWidth32W should have succeeded
\n
"
);
ok
(
bufferW
>
0
,
" Width should be greater than zero
\n
"
);
SetWindowExtEx
(
hdc
,
-
1
,
-
1
,
NULL
);
SetGraphicsMode
(
hdc
,
GM_COMPATIBLE
);
ret
=
pGetCharWidth32W
(
hdc
,
'a'
,
'a'
,
&
bufferW
);
ok
(
ret
,
"GetCharWidth32W should have succeeded
\n
"
);
ok
(
bufferW
>
0
,
" Width should be greater than zero
\n
"
);
SetGraphicsMode
(
hdc
,
GM_ADVANCED
);
ret
=
pGetCharWidth32W
(
hdc
,
'a'
,
'a'
,
&
bufferW
);
ok
(
ret
,
"GetCharWidth32W should have succeeded
\n
"
);
todo_wine
ok
(
bufferW
>
0
,
" Width should be greater than zero
\n
"
);
SetWindowExtEx
(
hdc
,
1
,
1
,
NULL
);
SetGraphicsMode
(
hdc
,
GM_COMPATIBLE
);
ret
=
pGetCharWidth32W
(
hdc
,
'a'
,
'a'
,
&
bufferW
);
ok
(
ret
,
"GetCharWidth32W should have succeeded
\n
"
);
ok
(
bufferW
>
0
,
" Width should be greater than zero
\n
"
);
SetGraphicsMode
(
hdc
,
GM_ADVANCED
);
ret
=
pGetCharWidth32W
(
hdc
,
'a'
,
'a'
,
&
bufferW
);
ok
(
ret
,
"GetCharWidth32W should have succeeded
\n
"
);
ok
(
bufferW
>
0
,
" Width should be greater than zero
\n
"
);
ReleaseDC
(
hwnd
,
hdc
);
DestroyWindow
(
hwnd
);
hwnd
=
CreateWindowEx
(
WS_EX_LAYOUTRTL
,
"static"
,
""
,
WS_POPUP
,
0
,
0
,
100
,
100
,
0
,
0
,
0
,
NULL
);
hdc
=
GetDC
(
hwnd
);
SetMapMode
(
hdc
,
MM_ANISOTROPIC
);
SelectObject
(
hdc
,
hfont
);
ret
=
pGetCharWidth32W
(
hdc
,
'a'
,
'a'
,
&
bufferW
);
ok
(
ret
,
"GetCharWidth32W should have succeeded
\n
"
);
ok
(
bufferW
>
0
,
" Width should be greater than zero
\n
"
);
SetWindowExtEx
(
hdc
,
-
1
,
-
1
,
NULL
);
SetGraphicsMode
(
hdc
,
GM_COMPATIBLE
);
ret
=
pGetCharWidth32W
(
hdc
,
'a'
,
'a'
,
&
bufferW
);
ok
(
ret
,
"GetCharWidth32W should have succeeded
\n
"
);
ok
(
bufferW
>
0
,
" Width should be greater than zero
\n
"
);
SetGraphicsMode
(
hdc
,
GM_ADVANCED
);
ret
=
pGetCharWidth32W
(
hdc
,
'a'
,
'a'
,
&
bufferW
);
ok
(
ret
,
"GetCharWidth32W should have succeeded
\n
"
);
ok
(
bufferW
>
0
,
" Width should be greater than zero
\n
"
);
SetWindowExtEx
(
hdc
,
1
,
1
,
NULL
);
SetGraphicsMode
(
hdc
,
GM_COMPATIBLE
);
ret
=
pGetCharWidth32W
(
hdc
,
'a'
,
'a'
,
&
bufferW
);
ok
(
ret
,
"GetCharWidth32W should have succeeded
\n
"
);
ok
(
bufferW
>
0
,
" Width should be greater than zero
\n
"
);
SetGraphicsMode
(
hdc
,
GM_ADVANCED
);
ret
=
pGetCharWidth32W
(
hdc
,
'a'
,
'a'
,
&
bufferW
);
ok
(
ret
,
"GetCharWidth32W should have succeeded
\n
"
);
todo_wine
ok
(
bufferW
>
0
,
" Width should be greater than zero
\n
"
);
ReleaseDC
(
hwnd
,
hdc
);
DestroyWindow
(
hwnd
);
DeleteObject
(
hfont
);
}
START_TEST
(
font
)
{
...
...
@@ -5407,6 +5514,7 @@ START_TEST(font)
test_east_asian_font_selection
();
test_max_height
();
test_vertical_order
();
test_GetCharWidth32
();
/* These tests should be last test until RemoveFontResource
* is properly implemented.
...
...
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