Commit 1eac54ef authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Take into account the fontdir directory specified at build time.

parent e8c8ddcb
......@@ -49,3 +49,5 @@ C_SRCS = \
vertical.c
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)
#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 */
typedef struct {
FT_Short height;
......@@ -2969,22 +2973,44 @@ static void load_mac_fonts(void)
#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 )
{
char *unix_name = NULL;
const char *data_dir = wine_get_data_dir();
if (!data_dir) data_dir = wine_get_build_dir();
char *font_dir = get_font_dir();
if (data_dir)
if (font_dir)
{
INT len = WideCharToMultiByte(CP_UNIXCP, 0, file, -1, NULL, 0, NULL, NULL);
unix_name = HeapAlloc(GetProcessHeap(), 0, strlen(data_dir) + len + sizeof("/fonts/"));
strcpy(unix_name, data_dir);
strcat(unix_name, "/fonts/");
unix_name = HeapAlloc(GetProcessHeap(), 0, strlen(font_dir) + len + 1 );
strcpy(unix_name, font_dir);
strcat(unix_name, "/");
WideCharToMultiByte(CP_UNIXCP, 0, file, -1, unix_name + strlen(unix_name), len, NULL, NULL);
HeapFree( GetProcessHeap(), 0, font_dir );
}
return unix_name;
}
......@@ -4131,7 +4157,6 @@ static void init_font_list(void)
DWORD valuelen, datalen, i = 0, type, dlen, vlen;
WCHAR windowsdir[MAX_PATH];
char *unixname;
const char *data_dir;
delete_external_font_keys();
......@@ -4147,13 +4172,9 @@ static void init_font_list(void)
HeapFree(GetProcessHeap(), 0, unixname);
}
/* load the system truetype fonts */
data_dir = wine_get_data_dir();
if (!data_dir) data_dir = wine_get_build_dir();
if (data_dir && (unixname = HeapAlloc(GetProcessHeap(), 0, strlen(data_dir) + sizeof("/fonts/"))))
/* load the wine fonts */
if ((unixname = get_font_dir()))
{
strcpy(unixname, data_dir);
strcat(unixname, "/fonts/");
ReadFontDir(unixname, TRUE);
HeapFree(GetProcessHeap(), 0, unixname);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment