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
9096368b
Commit
9096368b
authored
Apr 09, 2009
by
Patrick Gauthier
Committed by
Alexandre Julliard
Apr 10, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Handle magic font size 0x7fff in dialog templates correctly.
parent
2dc78e55
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
19 deletions
+51
-19
dialog.c
dlls/user32/dialog.c
+50
-18
dialog.c
dlls/user32/tests/dialog.c
+1
-1
No files found.
dlls/user32/dialog.c
View file @
9096368b
...
...
@@ -436,16 +436,33 @@ static LPCSTR DIALOG_ParseTemplate32( LPCSTR template, DLG_TEMPLATE * result )
{
result
->
pointSize
=
GET_WORD
(
p
);
p
++
;
if
(
result
->
dialogEx
)
/* If pointSize is 0x7fff, it means that we need to use the font
* in NONCLIENTMETRICSW.lfMessageFont, and NOT read the weight,
* italic, and facename from the dialog template.
*/
if
(
result
->
pointSize
==
0x7fff
)
{
/* We could call SystemParametersInfo here, but then we'd have
* to convert from pixel size to point size (which can be
* imprecise).
*/
TRACE
(
" FONT: Using message box font
\n
"
);
}
else
{
result
->
weight
=
GET_WORD
(
p
);
p
++
;
result
->
italic
=
LOBYTE
(
GET_WORD
(
p
));
p
++
;
if
(
result
->
dialogEx
)
{
result
->
weight
=
GET_WORD
(
p
);
p
++
;
result
->
italic
=
LOBYTE
(
GET_WORD
(
p
));
p
++
;
}
result
->
faceName
=
p
;
p
+=
strlenW
(
result
->
faceName
)
+
1
;
TRACE
(
" FONT %d, %s, %d, %s
\n
"
,
result
->
pointSize
,
debugstr_w
(
result
->
faceName
),
result
->
weight
,
result
->
italic
?
"TRUE"
:
"FALSE"
);
}
result
->
faceName
=
p
;
p
+=
strlenW
(
result
->
faceName
)
+
1
;
TRACE
(
" FONT %d, %s, %d, %s
\n
"
,
result
->
pointSize
,
debugstr_w
(
result
->
faceName
),
result
->
weight
,
result
->
italic
?
"TRUE"
:
"FALSE"
);
}
/* First control is on dword boundary */
...
...
@@ -492,16 +509,31 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
if
(
template
.
style
&
DS_SETFONT
)
{
/* We convert the size to pixels and then make it -ve. This works
* for both +ve and -ve template.pointSize */
HDC
dc
;
int
pixels
;
dc
=
GetDC
(
0
);
pixels
=
MulDiv
(
template
.
pointSize
,
GetDeviceCaps
(
dc
,
LOGPIXELSY
),
72
);
hUserFont
=
CreateFontW
(
-
pixels
,
0
,
0
,
0
,
template
.
weight
,
template
.
italic
,
FALSE
,
FALSE
,
DEFAULT_CHARSET
,
0
,
0
,
PROOF_QUALITY
,
FF_DONTCARE
,
template
.
faceName
);
HDC
dc
=
GetDC
(
0
);
if
(
template
.
pointSize
==
0x7fff
)
{
/* We get the message font from the non-client metrics */
NONCLIENTMETRICSW
ncMetrics
;
ncMetrics
.
cbSize
=
sizeof
(
NONCLIENTMETRICSW
);
if
(
SystemParametersInfoW
(
SPI_GETNONCLIENTMETRICS
,
sizeof
(
NONCLIENTMETRICSW
),
&
ncMetrics
,
0
))
{
hUserFont
=
CreateFontIndirectW
(
&
ncMetrics
.
lfMessageFont
);
}
}
else
{
/* We convert the size to pixels and then make it -ve. This works
* for both +ve and -ve template.pointSize */
int
pixels
=
MulDiv
(
template
.
pointSize
,
GetDeviceCaps
(
dc
,
LOGPIXELSY
),
72
);
hUserFont
=
CreateFontW
(
-
pixels
,
0
,
0
,
0
,
template
.
weight
,
template
.
italic
,
FALSE
,
FALSE
,
DEFAULT_CHARSET
,
0
,
0
,
PROOF_QUALITY
,
FF_DONTCARE
,
template
.
faceName
);
}
if
(
hUserFont
)
{
SIZE
charSize
;
...
...
dlls/user32/tests/dialog.c
View file @
9096368b
...
...
@@ -999,7 +999,7 @@ static void test_MessageBoxFontTest(void)
hDlg
=
CreateDialogIndirectParamW
(
g_hinst
,
(
LPCDLGTEMPLATE
)
dlgTemplate
,
NULL
,
messageBoxFontDlgWinProc
,
0
);
if
(
!
hDlg
)
{
todo_wine
win_skip
(
"dialog wasn't created
\n
"
);
win_skip
(
"dialog wasn't created
\n
"
);
return
;
}
...
...
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