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
705a0f02
Commit
705a0f02
authored
Jun 17, 2013
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jun 17, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Scale default GUI fonts to match screen resolution changes.
parent
6834a44d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
4 deletions
+52
-4
gdiobj.c
dlls/gdi32/gdiobj.c
+46
-3
font.c
dlls/gdi32/tests/font.c
+6
-1
No files found.
dlls/gdi32/gdiobj.c
View file @
705a0f02
...
...
@@ -597,6 +597,49 @@ BOOL GDI_dec_ref_count( HGDIOBJ handle )
return
entry
!=
NULL
;
}
/******************************************************************************
* get_dpi (internal)
*
* get the dpi from the registry
*/
static
int
get_dpi
(
void
)
{
static
const
WCHAR
dpi_key_name
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'F'
,
'o'
,
'n'
,
't'
,
's'
,
'\0'
};
static
const
WCHAR
dpi_value_name
[]
=
{
'L'
,
'o'
,
'g'
,
'P'
,
'i'
,
'x'
,
'e'
,
'l'
,
's'
,
'\0'
};
static
int
dpi
=
-
1
;
HKEY
hkey
;
if
(
dpi
!=
-
1
)
return
dpi
;
if
(
RegOpenKeyW
(
HKEY_CURRENT_CONFIG
,
dpi_key_name
,
&
hkey
)
==
ERROR_SUCCESS
)
{
DWORD
type
,
size
;
int
new_dpi
;
size
=
sizeof
(
new_dpi
);
if
(
RegQueryValueExW
(
hkey
,
dpi_value_name
,
NULL
,
&
type
,
(
void
*
)
&
new_dpi
,
&
size
)
==
ERROR_SUCCESS
)
{
if
(
type
==
REG_DWORD
&&
new_dpi
!=
0
)
dpi
=
new_dpi
;
}
RegCloseKey
(
hkey
);
}
if
(
dpi
<=
0
)
dpi
=
96
;
return
dpi
;
}
static
HFONT
create_scaled_font
(
const
LOGFONTW
*
deffont
)
{
LOGFONTW
lf
;
LONG
height
;
lf
=
*
deffont
;
height
=
abs
(
lf
.
lfHeight
)
*
get_dpi
()
/
96
;
lf
.
lfHeight
=
deffont
->
lfHeight
<
0
?
-
height
:
height
;
return
CreateFontIndirectW
(
&
lf
);
}
/***********************************************************************
* DllMain
...
...
@@ -636,10 +679,10 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
/* language-dependent stock fonts */
deffonts
=
get_default_fonts
(
get_default_charset
());
stock_objects
[
SYSTEM_FONT
]
=
CreateFontIndirectW
(
&
deffonts
->
SystemFont
);
stock_objects
[
DEVICE_DEFAULT_FONT
]
=
CreateFontIndirectW
(
&
deffonts
->
DeviceDefaultFont
);
stock_objects
[
SYSTEM_FONT
]
=
create_scaled_font
(
&
deffonts
->
SystemFont
);
stock_objects
[
DEVICE_DEFAULT_FONT
]
=
create_scaled_font
(
&
deffonts
->
DeviceDefaultFont
);
stock_objects
[
SYSTEM_FIXED_FONT
]
=
CreateFontIndirectW
(
&
deffonts
->
SystemFixedFont
);
stock_objects
[
DEFAULT_GUI_FONT
]
=
CreateFontIndirectW
(
&
deffonts
->
DefaultGuiFont
);
stock_objects
[
DEFAULT_GUI_FONT
]
=
create_scaled_font
(
&
deffonts
->
DefaultGuiFont
);
stock_objects
[
DC_BRUSH
]
=
CreateBrushIndirect
(
&
DCBrush
);
stock_objects
[
DC_PEN
]
=
CreatePenIndirect
(
&
DCPen
);
...
...
dlls/gdi32/tests/font.c
View file @
705a0f02
...
...
@@ -5012,7 +5012,12 @@ static void test_stock_fonts(void)
}
/* FIXME: Remove once Wine is fixed */
if
(
td
[
i
][
j
].
dpi
!=
96
)
todo_wine
if
(
td
[
i
][
j
].
dpi
!=
96
&&
/* MS Sans Serif for 120 dpi and higher should include 12 pixel bitmap set */
((
!
strcmp
(
td
[
i
][
j
].
face_name
,
"MS Sans Serif"
)
&&
td
[
i
][
j
].
height
==
12
)
||
/* System for 120 dpi and higher should include 20 pixel bitmap set */
(
!
strcmp
(
td
[
i
][
j
].
face_name
,
"System"
)
&&
td
[
i
][
j
].
height
>
16
)))
todo_wine
ok
(
height
==
td
[
i
][
j
].
height_pixels
,
"%d(%d): expected height %d, got %d
\n
"
,
i
,
j
,
td
[
i
][
j
].
height_pixels
,
height
);
else
ok
(
height
==
td
[
i
][
j
].
height_pixels
,
"%d(%d): expected height %d, got %d
\n
"
,
i
,
j
,
td
[
i
][
j
].
height_pixels
,
height
);
...
...
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