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
2c1a42bc
Commit
2c1a42bc
authored
Oct 27, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Move the loading of registry fonts out of freetype.c.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
131d3b1f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
56 deletions
+49
-56
font.c
dlls/gdi32/font.c
+47
-2
freetype.c
dlls/gdi32/freetype.c
+1
-52
gdi_private.h
dlls/gdi32/gdi_private.h
+1
-2
No files found.
dlls/gdi32/font.c
View file @
2c1a42bc
...
@@ -109,6 +109,11 @@ static inline INT INTERNAL_YWSTODS(DC *dc, INT height)
...
@@ -109,6 +109,11 @@ static inline INT INTERNAL_YWSTODS(DC *dc, INT height)
return
pt
[
1
].
y
-
pt
[
0
].
y
;
return
pt
[
1
].
y
-
pt
[
0
].
y
;
}
}
static
inline
BOOL
is_win9x
(
void
)
{
return
GetVersion
()
&
0x80000000
;
}
static
inline
WCHAR
*
strdupW
(
const
WCHAR
*
p
)
static
inline
WCHAR
*
strdupW
(
const
WCHAR
*
p
)
{
{
WCHAR
*
ret
;
WCHAR
*
ret
;
...
@@ -375,7 +380,7 @@ void get_font_dir( WCHAR *path )
...
@@ -375,7 +380,7 @@ void get_font_dir( WCHAR *path )
else
path
[
1
]
=
'\\'
;
/* change \??\ to \\?\ */
else
path
[
1
]
=
'\\'
;
/* change \??\ to \\?\ */
}
}
void
get_fonts_data_dir_path
(
const
WCHAR
*
file
,
WCHAR
*
path
)
static
void
get_fonts_data_dir_path
(
const
WCHAR
*
file
,
WCHAR
*
path
)
{
{
static
const
WCHAR
slashW
[]
=
{
'\\'
,
0
};
static
const
WCHAR
slashW
[]
=
{
'\\'
,
0
};
...
@@ -384,7 +389,7 @@ void get_fonts_data_dir_path( const WCHAR *file, WCHAR *path )
...
@@ -384,7 +389,7 @@ void get_fonts_data_dir_path( const WCHAR *file, WCHAR *path )
strcatW
(
path
,
file
);
strcatW
(
path
,
file
);
}
}
void
get_fonts_win_dir_path
(
const
WCHAR
*
file
,
WCHAR
*
path
)
static
void
get_fonts_win_dir_path
(
const
WCHAR
*
file
,
WCHAR
*
path
)
{
{
static
const
WCHAR
fontsW
[]
=
{
'\\'
,
'f'
,
'o'
,
'n'
,
't'
,
's'
,
'\\'
,
0
};
static
const
WCHAR
fontsW
[]
=
{
'\\'
,
'f'
,
'o'
,
'n'
,
't'
,
's'
,
'\\'
,
0
};
...
@@ -5397,6 +5402,46 @@ void load_system_bitmap_fonts(void)
...
@@ -5397,6 +5402,46 @@ void load_system_bitmap_fonts(void)
RegCloseKey
(
hkey
);
RegCloseKey
(
hkey
);
}
}
void
load_registry_fonts
(
void
)
{
static
const
WCHAR
dot_fonW
[]
=
{
'.'
,
'f'
,
'o'
,
'n'
,
0
};
static
const
WCHAR
win9x_key
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
'\\'
,
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'V'
,
'e'
,
'r'
,
's'
,
'i'
,
'o'
,
'n'
,
'\\'
,
'F'
,
'o'
,
'n'
,
't'
,
's'
,
0
};
static
const
WCHAR
winnt_key
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
' '
,
'N'
,
'T'
,
'\\'
,
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'V'
,
'e'
,
'r'
,
's'
,
'i'
,
'o'
,
'n'
,
'\\'
,
'F'
,
'o'
,
'n'
,
't'
,
's'
,
0
};
WCHAR
value
[
MAX_PATH
],
data
[
MAX_PATH
];
DWORD
i
=
0
,
type
,
dlen
,
vlen
;
HKEY
hkey
;
/* Look under HKLM\Software\Microsoft\Windows[ NT]\CurrentVersion\Fonts
for any fonts not installed in %WINDOWSDIR%\Fonts. They will have their
full path as the entry. Also look for any .fon fonts, since ReadFontDir
will skip these. */
if
(
RegOpenKeyW
(
HKEY_LOCAL_MACHINE
,
is_win9x
()
?
win9x_key
:
winnt_key
,
&
hkey
))
return
;
vlen
=
ARRAY_SIZE
(
value
);
dlen
=
sizeof
(
data
);
while
(
!
RegEnumValueW
(
hkey
,
i
++
,
value
,
&
vlen
,
NULL
,
&
type
,
(
LPBYTE
)
data
,
&
dlen
))
{
dlen
/=
sizeof
(
WCHAR
);
if
(
data
[
0
]
&&
data
[
1
]
==
':'
)
add_font_resource
(
data
,
ADDFONT_ALLOW_BITMAP
|
ADDFONT_ADD_TO_CACHE
);
else
if
(
dlen
>=
6
&&
!
strcmpiW
(
data
+
dlen
-
5
,
dot_fonW
))
add_system_font_resource
(
data
,
ADDFONT_ALLOW_BITMAP
|
ADDFONT_ADD_TO_CACHE
);
vlen
=
ARRAY_SIZE
(
value
);
dlen
=
sizeof
(
data
);
}
RegCloseKey
(
hkey
);
}
/***********************************************************************
/***********************************************************************
* AddFontResourceExW (GDI32.@)
* AddFontResourceExW (GDI32.@)
*/
*/
...
...
dlls/gdi32/freetype.c
View file @
2c1a42bc
...
@@ -768,10 +768,6 @@ static char **expand_mac_font(const char *path)
...
@@ -768,10 +768,6 @@ static char **expand_mac_font(const char *path)
#endif
/* HAVE_CARBON_CARBON_H */
#endif
/* HAVE_CARBON_CARBON_H */
static
inline
BOOL
is_win9x
(
void
)
{
return
GetVersion
()
&
0x80000000
;
}
/*
/*
This function builds an FT_Fixed from a double. It fails if the absolute
This function builds an FT_Fixed from a double. It fails if the absolute
value of the float number is greater than 32768.
value of the float number is greater than 32768.
...
@@ -3411,10 +3407,8 @@ sym_not_found:
...
@@ -3411,10 +3407,8 @@ sym_not_found:
static
void
init_font_list
(
void
)
static
void
init_font_list
(
void
)
{
{
static
const
WCHAR
dot_fonW
[]
=
{
'.'
,
'f'
,
'o'
,
'n'
,
'\0'
};
static
const
WCHAR
pathW
[]
=
{
'P'
,
'a'
,
't'
,
'h'
,
0
};
static
const
WCHAR
pathW
[]
=
{
'P'
,
'a'
,
't'
,
'h'
,
0
};
HKEY
hkey
;
HKEY
hkey
;
DWORD
valuelen
,
datalen
,
i
=
0
,
type
,
dlen
,
vlen
;
WCHAR
path
[
MAX_PATH
];
WCHAR
path
[
MAX_PATH
];
char
*
unixname
;
char
*
unixname
;
...
@@ -3431,52 +3425,7 @@ static void init_font_list(void)
...
@@ -3431,52 +3425,7 @@ static void init_font_list(void)
get_font_dir
(
path
);
get_font_dir
(
path
);
read_font_dir
(
path
,
TRUE
);
read_font_dir
(
path
,
TRUE
);
/* now look under HKLM\Software\Microsoft\Windows[ NT]\CurrentVersion\Fonts
load_registry_fonts
();
for any fonts not installed in %WINDOWSDIR%\Fonts. They will have their
full path as the entry. Also look for any .fon fonts, since ReadFontDir
will skip these. */
if
(
RegOpenKeyW
(
HKEY_LOCAL_MACHINE
,
is_win9x
()
?
win9x_font_reg_key
:
winnt_font_reg_key
,
&
hkey
)
==
ERROR_SUCCESS
)
{
LPWSTR
data
,
valueW
;
RegQueryInfoKeyW
(
hkey
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
&
valuelen
,
&
datalen
,
NULL
,
NULL
);
valuelen
++
;
/* returned value doesn't include room for '\0' */
valueW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
valuelen
*
sizeof
(
WCHAR
));
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
datalen
*
sizeof
(
WCHAR
));
if
(
valueW
&&
data
)
{
dlen
=
datalen
*
sizeof
(
WCHAR
);
vlen
=
valuelen
;
while
(
RegEnumValueW
(
hkey
,
i
++
,
valueW
,
&
vlen
,
NULL
,
&
type
,
(
LPBYTE
)
data
,
&
dlen
)
==
ERROR_SUCCESS
)
{
if
(
data
[
0
]
&&
(
data
[
1
]
==
':'
))
{
freetype_add_font
(
data
,
ADDFONT_ALLOW_BITMAP
|
ADDFONT_ADD_TO_CACHE
);
}
else
if
(
dlen
/
2
>=
6
&&
!
strcmpiW
(
data
+
dlen
/
2
-
5
,
dot_fonW
))
{
WCHAR
pathW
[
MAX_PATH
];
get_fonts_win_dir_path
(
data
,
pathW
);
if
(
!
freetype_add_font
(
pathW
,
ADDFONT_ALLOW_BITMAP
|
ADDFONT_ADD_TO_CACHE
))
{
get_fonts_data_dir_path
(
data
,
pathW
);
freetype_add_font
(
pathW
,
ADDFONT_ALLOW_BITMAP
|
ADDFONT_ADD_TO_CACHE
);
}
}
/* reset dlen and vlen */
dlen
=
datalen
;
vlen
=
valuelen
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
data
);
HeapFree
(
GetProcessHeap
(),
0
,
valueW
);
RegCloseKey
(
hkey
);
}
#ifdef SONAME_LIBFONTCONFIG
#ifdef SONAME_LIBFONTCONFIG
load_fontconfig_fonts
();
load_fontconfig_fonts
();
...
...
dlls/gdi32/gdi_private.h
View file @
2c1a42bc
...
@@ -390,9 +390,8 @@ struct font_backend_funcs
...
@@ -390,9 +390,8 @@ struct font_backend_funcs
};
};
extern
void
get_font_dir
(
WCHAR
*
path
)
DECLSPEC_HIDDEN
;
extern
void
get_font_dir
(
WCHAR
*
path
)
DECLSPEC_HIDDEN
;
extern
void
get_fonts_data_dir_path
(
const
WCHAR
*
file
,
WCHAR
*
path
)
DECLSPEC_HIDDEN
;
extern
void
get_fonts_win_dir_path
(
const
WCHAR
*
file
,
WCHAR
*
path
)
DECLSPEC_HIDDEN
;
extern
void
load_system_bitmap_fonts
(
void
)
DECLSPEC_HIDDEN
;
extern
void
load_system_bitmap_fonts
(
void
)
DECLSPEC_HIDDEN
;
extern
void
load_registry_fonts
(
void
)
DECLSPEC_HIDDEN
;
extern
struct
gdi_font
*
alloc_gdi_font
(
const
WCHAR
*
file
,
void
*
data_ptr
,
SIZE_T
data_size
)
DECLSPEC_HIDDEN
;
extern
struct
gdi_font
*
alloc_gdi_font
(
const
WCHAR
*
file
,
void
*
data_ptr
,
SIZE_T
data_size
)
DECLSPEC_HIDDEN
;
extern
void
free_gdi_font
(
struct
gdi_font
*
font
)
DECLSPEC_HIDDEN
;
extern
void
free_gdi_font
(
struct
gdi_font
*
font
)
DECLSPEC_HIDDEN
;
...
...
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