gdi32: Take into account the fontdir directory specified at build time.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e8c8ddcbfc
commit
1eac54ef7d
|
@ -49,3 +49,5 @@ C_SRCS = \
|
||||||
vertical.c
|
vertical.c
|
||||||
|
|
||||||
RC_SRCS = gdi32.rc
|
RC_SRCS = gdi32.rc
|
||||||
|
|
||||||
|
freetype_EXTRADEFS = -DWINE_FONT_DIR=\"`$(MAKEDEP) -R ${datadir}/wine ${fontdir}`\"
|
||||||
|
|
|
@ -214,6 +214,10 @@ MAKE_FUNCPTR(FcPatternGetString);
|
||||||
#define GET_BE_WORD(x) RtlUshortByteSwap(x)
|
#define GET_BE_WORD(x) RtlUshortByteSwap(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef WINE_FONT_DIR
|
||||||
|
#define WINE_FONT_DIR "fonts"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This is basically a copy of FT_Bitmap_Size with an extra element added */
|
/* This is basically a copy of FT_Bitmap_Size with an extra element added */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
FT_Short height;
|
FT_Short height;
|
||||||
|
@ -2969,22 +2973,44 @@ static void load_mac_fonts(void)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static char *get_font_dir(void)
|
||||||
|
{
|
||||||
|
const char *build_dir, *data_dir;
|
||||||
|
char *name = NULL;
|
||||||
|
|
||||||
|
if ((data_dir = wine_get_data_dir()))
|
||||||
|
{
|
||||||
|
if (!(name = HeapAlloc( GetProcessHeap(), 0, strlen(data_dir) + 1 + sizeof(WINE_FONT_DIR) )))
|
||||||
|
return NULL;
|
||||||
|
strcpy( name, data_dir );
|
||||||
|
strcat( name, "/" );
|
||||||
|
strcat( name, WINE_FONT_DIR );
|
||||||
|
}
|
||||||
|
else if ((build_dir = wine_get_build_dir()))
|
||||||
|
{
|
||||||
|
if (!(name = HeapAlloc( GetProcessHeap(), 0, strlen(build_dir) + sizeof("/fonts") )))
|
||||||
|
return NULL;
|
||||||
|
strcpy( name, build_dir );
|
||||||
|
strcat( name, "/fonts" );
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
static char *get_data_dir_path( LPCWSTR file )
|
static char *get_data_dir_path( LPCWSTR file )
|
||||||
{
|
{
|
||||||
char *unix_name = NULL;
|
char *unix_name = NULL;
|
||||||
const char *data_dir = wine_get_data_dir();
|
char *font_dir = get_font_dir();
|
||||||
|
|
||||||
if (!data_dir) data_dir = wine_get_build_dir();
|
if (font_dir)
|
||||||
|
|
||||||
if (data_dir)
|
|
||||||
{
|
{
|
||||||
INT len = WideCharToMultiByte(CP_UNIXCP, 0, file, -1, NULL, 0, NULL, NULL);
|
INT len = WideCharToMultiByte(CP_UNIXCP, 0, file, -1, NULL, 0, NULL, NULL);
|
||||||
|
|
||||||
unix_name = HeapAlloc(GetProcessHeap(), 0, strlen(data_dir) + len + sizeof("/fonts/"));
|
unix_name = HeapAlloc(GetProcessHeap(), 0, strlen(font_dir) + len + 1 );
|
||||||
strcpy(unix_name, data_dir);
|
strcpy(unix_name, font_dir);
|
||||||
strcat(unix_name, "/fonts/");
|
strcat(unix_name, "/");
|
||||||
|
|
||||||
WideCharToMultiByte(CP_UNIXCP, 0, file, -1, unix_name + strlen(unix_name), len, NULL, NULL);
|
WideCharToMultiByte(CP_UNIXCP, 0, file, -1, unix_name + strlen(unix_name), len, NULL, NULL);
|
||||||
|
HeapFree( GetProcessHeap(), 0, font_dir );
|
||||||
}
|
}
|
||||||
return unix_name;
|
return unix_name;
|
||||||
}
|
}
|
||||||
|
@ -4131,7 +4157,6 @@ static void init_font_list(void)
|
||||||
DWORD valuelen, datalen, i = 0, type, dlen, vlen;
|
DWORD valuelen, datalen, i = 0, type, dlen, vlen;
|
||||||
WCHAR windowsdir[MAX_PATH];
|
WCHAR windowsdir[MAX_PATH];
|
||||||
char *unixname;
|
char *unixname;
|
||||||
const char *data_dir;
|
|
||||||
|
|
||||||
delete_external_font_keys();
|
delete_external_font_keys();
|
||||||
|
|
||||||
|
@ -4147,13 +4172,9 @@ static void init_font_list(void)
|
||||||
HeapFree(GetProcessHeap(), 0, unixname);
|
HeapFree(GetProcessHeap(), 0, unixname);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* load the system truetype fonts */
|
/* load the wine fonts */
|
||||||
data_dir = wine_get_data_dir();
|
if ((unixname = get_font_dir()))
|
||||||
if (!data_dir) data_dir = wine_get_build_dir();
|
|
||||||
if (data_dir && (unixname = HeapAlloc(GetProcessHeap(), 0, strlen(data_dir) + sizeof("/fonts/"))))
|
|
||||||
{
|
{
|
||||||
strcpy(unixname, data_dir);
|
|
||||||
strcat(unixname, "/fonts/");
|
|
||||||
ReadFontDir(unixname, TRUE);
|
ReadFontDir(unixname, TRUE);
|
||||||
HeapFree(GetProcessHeap(), 0, unixname);
|
HeapFree(GetProcessHeap(), 0, unixname);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue