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
2dfb0989
Commit
2dfb0989
authored
Apr 27, 2017
by
Huw Davies
Committed by
Alexandre Julliard
Apr 27, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Try to read the dpi from the user key first.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d74348f9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
29 deletions
+44
-29
freetype.c
dlls/gdi32/freetype.c
+3
-8
gdi_private.h
dlls/gdi32/gdi_private.h
+1
-0
gdiobj.c
dlls/gdi32/gdiobj.c
+40
-21
No files found.
dlls/gdi32/freetype.c
View file @
2dfb0989
...
...
@@ -3993,16 +3993,11 @@ static void update_font_info(void)
DWORD
len
,
type
;
HKEY
hkey
=
0
;
UINT
i
,
ansi_cp
=
0
,
oem_cp
=
0
;
DWORD
screen_dpi
=
96
,
font_dpi
=
0
;
DWORD
screen_dpi
,
font_dpi
=
0
;
BOOL
done
=
FALSE
;
if
(
RegOpenKeyA
(
HKEY_LOCAL_MACHINE
,
"System
\\
CurrentControlSet
\\
Hardware Profiles
\\
Current
\\
Software
\\
Fonts"
,
&
hkey
)
==
ERROR_SUCCESS
)
{
reg_load_dword
(
hkey
,
logpixels
,
&
screen_dpi
);
RegCloseKey
(
hkey
);
}
screen_dpi
=
get_dpi
();
if
(
!
screen_dpi
)
screen_dpi
=
96
;
if
(
RegCreateKeyExA
(
HKEY_CURRENT_USER
,
"Software
\\
Wine
\\
Fonts"
,
0
,
NULL
,
0
,
KEY_ALL_ACCESS
,
NULL
,
&
hkey
,
NULL
)
!=
ERROR_SUCCESS
)
return
;
...
...
dlls/gdi32/gdi_private.h
View file @
2dfb0989
...
...
@@ -303,6 +303,7 @@ extern HGDIOBJ GDI_inc_ref_count( HGDIOBJ handle ) DECLSPEC_HIDDEN;
extern
BOOL
GDI_dec_ref_count
(
HGDIOBJ
handle
)
DECLSPEC_HIDDEN
;
extern
void
GDI_hdc_using_object
(
HGDIOBJ
obj
,
HDC
hdc
)
DECLSPEC_HIDDEN
;
extern
void
GDI_hdc_not_using_object
(
HGDIOBJ
obj
,
HDC
hdc
)
DECLSPEC_HIDDEN
;
extern
DWORD
get_dpi
(
void
)
DECLSPEC_HIDDEN
;
/* mapping.c */
extern
BOOL
dp_to_lp
(
DC
*
dc
,
POINT
*
points
,
INT
count
)
DECLSPEC_HIDDEN
;
...
...
dlls/gdi32/gdiobj.c
View file @
2dfb0989
...
...
@@ -597,45 +597,64 @@ BOOL GDI_dec_ref_count( HGDIOBJ handle )
return
entry
!=
NULL
;
}
static
const
WCHAR
dpi_key_name
[]
=
{
'C'
,
'o'
,
'n'
,
't'
,
'r'
,
'o'
,
'l'
,
' '
,
'P'
,
'a'
,
'n'
,
'e'
,
'l'
,
'\\'
,
'D'
,
'e'
,
's'
,
'k'
,
't'
,
'o'
,
'p'
,
'\0'
};
static
const
WCHAR
def_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'
};
/******************************************************************************
*
get_dpi (internal)
*
get_reg_dword
*
*
get the dpi
from the registry
*
Read a DWORD value
from the registry
*/
static
int
get_dpi
(
void
)
static
BOOL
get_reg_dword
(
HKEY
base
,
const
WCHAR
*
key_name
,
const
WCHAR
*
value_name
,
DWORD
*
value
)
{
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
;
HKEY
key
;
DWORD
type
,
data
,
size
=
sizeof
(
data
);
BOOL
ret
=
FALSE
;
if
(
RegOpenKeyW
(
HKEY_CURRENT_CONFIG
,
dpi_key_name
,
&
h
key
)
==
ERROR_SUCCESS
)
if
(
RegOpenKeyW
(
base
,
key_name
,
&
key
)
==
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
(
RegQueryValueExW
(
key
,
value_name
,
NULL
,
&
type
,
(
void
*
)
&
data
,
&
size
)
==
ERROR_SUCCESS
&&
type
==
REG_DWORD
)
{
if
(
type
==
REG_DWORD
&&
new_dpi
!=
0
)
dpi
=
new_dpi
;
*
value
=
data
;
ret
=
TRUE
;
}
RegCloseKey
(
h
key
);
RegCloseKey
(
key
);
}
if
(
dpi
<=
0
)
dpi
=
96
;
return
dpi
;
return
ret
;
}
/******************************************************************************
* get_dpi
*
* get the dpi from the registry
*/
DWORD
get_dpi
(
void
)
{
DWORD
dpi
;
if
(
get_reg_dword
(
HKEY_CURRENT_USER
,
dpi_key_name
,
dpi_value_name
,
&
dpi
))
return
dpi
;
if
(
get_reg_dword
(
HKEY_CURRENT_CONFIG
,
def_dpi_key_name
,
dpi_value_name
,
&
dpi
))
return
dpi
;
return
0
;
}
static
HFONT
create_scaled_font
(
const
LOGFONTW
*
deffont
)
{
LOGFONTW
lf
;
LONG
height
;
static
DWORD
dpi
;
if
(
!
dpi
)
{
dpi
=
get_dpi
();
if
(
!
dpi
)
dpi
=
96
;
}
lf
=
*
deffont
;
height
=
abs
(
lf
.
lfHeight
)
*
get_dpi
()
/
96
;
height
=
abs
(
lf
.
lfHeight
)
*
dpi
/
96
;
lf
.
lfHeight
=
deffont
->
lfHeight
<
0
?
-
height
:
height
;
return
CreateFontIndirectW
(
&
lf
);
...
...
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