gdi32: Use Windows paths to read Wine font directories.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
da604dce34
commit
0a12f25869
|
@ -100,7 +100,6 @@
|
||||||
#include "winreg.h"
|
#include "winreg.h"
|
||||||
#include "wingdi.h"
|
#include "wingdi.h"
|
||||||
#include "gdi_private.h"
|
#include "gdi_private.h"
|
||||||
#include "wine/library.h"
|
|
||||||
#include "wine/unicode.h"
|
#include "wine/unicode.h"
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
#include "wine/list.h"
|
#include "wine/list.h"
|
||||||
|
@ -2775,6 +2774,16 @@ static BOOL ReadFontDir(const char *dirname, BOOL external_fonts)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void read_font_dir( const WCHAR *dirname, BOOL external_fonts )
|
||||||
|
{
|
||||||
|
char *unixname = wine_get_unix_file_name( dirname );
|
||||||
|
if (unixname)
|
||||||
|
{
|
||||||
|
ReadFontDir( unixname, external_fonts );
|
||||||
|
HeapFree( GetProcessHeap(), 0, unixname );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef SONAME_LIBFONTCONFIG
|
#ifdef SONAME_LIBFONTCONFIG
|
||||||
|
|
||||||
static BOOL fontconfig_enabled;
|
static BOOL fontconfig_enabled;
|
||||||
|
@ -3024,43 +3033,33 @@ static void load_mac_fonts(void)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char *get_font_dir(void)
|
static void get_font_dir( WCHAR *path )
|
||||||
{
|
{
|
||||||
const char *build_dir, *data_dir;
|
static const WCHAR slashW[] = {'\\',0};
|
||||||
char *name = NULL;
|
static const WCHAR fontsW[] = {'\\','f','o','n','t','s',0};
|
||||||
|
static const WCHAR winedatadirW[] = {'W','I','N','E','D','A','T','A','D','I','R',0};
|
||||||
|
static const WCHAR winebuilddirW[] = {'W','I','N','E','B','U','I','L','D','D','I','R',0};
|
||||||
|
|
||||||
if ((data_dir = wine_get_data_dir()))
|
if (GetEnvironmentVariableW( winedatadirW, path, MAX_PATH ))
|
||||||
{
|
{
|
||||||
if (!(name = HeapAlloc( GetProcessHeap(), 0, strlen(data_dir) + 1 + sizeof(WINE_FONT_DIR) )))
|
const char fontdir[] = WINE_FONT_DIR;
|
||||||
return NULL;
|
strcatW( path, slashW );
|
||||||
strcpy( name, data_dir );
|
MultiByteToWideChar( CP_ACP, 0, fontdir, -1, path + strlenW(path), MAX_PATH - strlenW(path) );
|
||||||
strcat( name, "/" );
|
|
||||||
strcat( name, WINE_FONT_DIR );
|
|
||||||
}
|
}
|
||||||
else if ((build_dir = wine_get_build_dir()))
|
else if (GetEnvironmentVariableW( winebuilddirW, path, MAX_PATH ))
|
||||||
{
|
{
|
||||||
if (!(name = HeapAlloc( GetProcessHeap(), 0, strlen(build_dir) + sizeof("/fonts") )))
|
strcatW( path, fontsW );
|
||||||
return NULL;
|
|
||||||
strcpy( name, build_dir );
|
|
||||||
strcat( name, "/fonts" );
|
|
||||||
}
|
}
|
||||||
return name;
|
path[1] = '\\'; /* change \??\ to \\?\ */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_data_dir_path( LPCWSTR file, WCHAR *path )
|
static void get_data_dir_path( LPCWSTR file, WCHAR *path )
|
||||||
{
|
{
|
||||||
static const WCHAR slashW[] = {'\\','\0'};
|
static const WCHAR slashW[] = {'\\','\0'};
|
||||||
char *font_dir = get_font_dir();
|
|
||||||
|
|
||||||
if (font_dir)
|
get_font_dir( path );
|
||||||
{
|
|
||||||
WCHAR *dirW = wine_get_dos_file_name( font_dir );
|
|
||||||
strcpyW( path, dirW );
|
|
||||||
strcatW( path, slashW );
|
strcatW( path, slashW );
|
||||||
strcatW( path, file );
|
strcatW( path, file );
|
||||||
HeapFree( GetProcessHeap(), 0, dirW );
|
|
||||||
HeapFree( GetProcessHeap(), 0, font_dir );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_winfonts_dir_path(LPCWSTR file, WCHAR *path)
|
static void get_winfonts_dir_path(LPCWSTR file, WCHAR *path)
|
||||||
|
@ -4216,7 +4215,7 @@ static void init_font_list(void)
|
||||||
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;
|
DWORD valuelen, datalen, i = 0, type, dlen, vlen;
|
||||||
WCHAR windowsdir[MAX_PATH];
|
WCHAR path[MAX_PATH];
|
||||||
char *unixname;
|
char *unixname;
|
||||||
|
|
||||||
delete_external_font_keys();
|
delete_external_font_keys();
|
||||||
|
@ -4225,20 +4224,13 @@ static void init_font_list(void)
|
||||||
load_system_fonts();
|
load_system_fonts();
|
||||||
|
|
||||||
/* load in the fonts from %WINDOWSDIR%\\Fonts first of all */
|
/* load in the fonts from %WINDOWSDIR%\\Fonts first of all */
|
||||||
GetWindowsDirectoryW(windowsdir, ARRAY_SIZE(windowsdir));
|
GetWindowsDirectoryW(path, ARRAY_SIZE(path));
|
||||||
strcatW(windowsdir, fontsW);
|
strcatW(path, fontsW);
|
||||||
if((unixname = wine_get_unix_file_name(windowsdir)))
|
read_font_dir( path, FALSE );
|
||||||
{
|
|
||||||
ReadFontDir(unixname, FALSE);
|
|
||||||
HeapFree(GetProcessHeap(), 0, unixname);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* load the wine fonts */
|
/* load the wine fonts */
|
||||||
if ((unixname = get_font_dir()))
|
get_font_dir( path );
|
||||||
{
|
read_font_dir( path, TRUE );
|
||||||
ReadFontDir(unixname, TRUE);
|
|
||||||
HeapFree(GetProcessHeap(), 0, unixname);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* now look under HKLM\Software\Microsoft\Windows[ NT]\CurrentVersion\Fonts
|
/* now look under HKLM\Software\Microsoft\Windows[ NT]\CurrentVersion\Fonts
|
||||||
for any fonts not installed in %WINDOWSDIR%\Fonts. They will have their
|
for any fonts not installed in %WINDOWSDIR%\Fonts. They will have their
|
||||||
|
|
Loading…
Reference in New Issue