Commit 6e12807b authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

Load any TrueType fonts that fontconfig knows about.

parent fc58ef81
......@@ -13086,6 +13086,71 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
fi
echo "$as_me:$LINENO: checking for -lfontconfig soname" >&5
echo $ECHO_N "checking for -lfontconfig soname... $ECHO_C" >&6
if test "${ac_cv_lib_soname_fontconfig+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_get_soname_save_LIBS=$LIBS
LIBS="-lfontconfig $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char FcInit ();
int
main ()
{
FcInit ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_soname_fontconfig=`$ac_cv_path_LDD conftest$ac_exeext | grep libfontconfig\\.so | sed 's/^.*\(libfontconfig\.so[^ ]*\).*$/\1/'`
if test "x$ac_cv_lib_soname_fontconfig" = "x"
then
ac_cv_lib_soname_fontconfig="libfontconfig.so"
fi
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_soname_fontconfig="libfontconfig.so"
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_get_soname_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_soname_fontconfig" >&5
echo "${ECHO_T}$ac_cv_lib_soname_fontconfig" >&6
if test "x$ac_cv_lib_soname_fontconfig" != xNONE
then
cat >>confdefs.h <<_ACEOF
#define SONAME_LIBFONTCONFIG "$ac_cv_lib_soname_fontconfig"
_ACEOF
fi;
echo "$as_me:$LINENO: checking for -lssl soname" >&5
echo $ECHO_N "checking for -lssl soname... $ECHO_C" >&6
if test "${ac_cv_lib_soname_ssl+set}" = set; then
......@@ -13939,6 +14004,7 @@ done
for ac_header in \
arpa/inet.h \
arpa/nameser.h \
......@@ -13946,6 +14012,7 @@ for ac_header in \
direct.h \
elf.h \
float.h \
fontconfig/fontconfig.h \
getopt.h \
ieeefp.h \
io.h \
......
......@@ -935,6 +935,7 @@ then
WINE_GET_SONAME(GL,glXQueryExtension,[$X_LIBS $X_EXTRA_LIBS])
WINE_GET_SONAME(cups,cupsGetDefault)
WINE_GET_SONAME(jack,jack_client_new)
WINE_GET_SONAME(fontconfig, FcInit);
WINE_GET_SONAME(ssl,SSL_library_init)
WINE_GET_SONAME(crypto,BIO_new_socket)
WINE_GET_SONAME(ncurses,waddch)
......@@ -1008,6 +1009,7 @@ AC_CHECK_HEADERS(\
direct.h \
elf.h \
float.h \
fontconfig/fontconfig.h \
getopt.h \
ieeefp.h \
io.h \
......
......@@ -105,10 +105,29 @@ MAKE_FUNCPTR(FT_Outline_Translate);
MAKE_FUNCPTR(FT_Select_Charmap);
MAKE_FUNCPTR(FT_Set_Pixel_Sizes);
MAKE_FUNCPTR(FT_Vector_Transform);
#undef MAKE_FUNCPTR
static void (*pFT_Library_Version)(FT_Library,FT_Int*,FT_Int*,FT_Int*);
static FT_Error (*pFT_Load_Sfnt_Table)(FT_Face,FT_ULong,FT_Long,FT_Byte*,FT_ULong*);
#ifdef HAVE_FONTCONFIG_FONTCONFIG_H
#include <fontconfig/fontconfig.h>
MAKE_FUNCPTR(FcConfigGetCurrent);
MAKE_FUNCPTR(FcFontList);
MAKE_FUNCPTR(FcFontSetDestroy);
MAKE_FUNCPTR(FcInit);
MAKE_FUNCPTR(FcObjectSetAdd);
MAKE_FUNCPTR(FcObjectSetCreate);
MAKE_FUNCPTR(FcObjectSetDestroy);
MAKE_FUNCPTR(FcPatternCreate);
MAKE_FUNCPTR(FcPatternDestroy);
MAKE_FUNCPTR(FcPatternGet);
#ifndef SONAME_LIBFONTCONFIG
#define SONAME_LIBFONTCONFIG "libfontconfig.so"
#endif
#endif
#undef MAKE_FUNCPTR
#define GET_BE_WORD(ptr) MAKEWORD( ((BYTE *)(ptr))[1], ((BYTE *)(ptr))[0] )
typedef struct tagFace {
......@@ -248,7 +267,7 @@ static inline FT_Fixed FT_FixedFromFIXED(FIXED f)
return (FT_Fixed)((long)f.value << 16 | (unsigned long)f.fract);
}
static BOOL AddFontFileToList(char *file, char *fake_family)
static BOOL AddFontFileToList(const char *file, char *fake_family)
{
FT_Face ft_face;
TT_OS2 *pOS2;
......@@ -622,6 +641,67 @@ static BOOL ReadFontDir(char *dirname)
return TRUE;
}
static void load_fontconfig_fonts(void)
{
#ifdef HAVE_FONTCONFIG_FONTCONFIG_H
void *fc_handle = NULL;
FcConfig *config;
FcPattern *pat;
FcObjectSet *os;
FcFontSet *fontset;
FcValue v;
int i, len;
const char *ext;
fc_handle = wine_dlopen(SONAME_LIBFONTCONFIG, RTLD_NOW, NULL, 0);
if(!fc_handle) {
TRACE("Wine cannot find the fontconfig library (%s).\n",
SONAME_LIBFONTCONFIG);
return;
}
#define LOAD_FUNCPTR(f) if((p##f = wine_dlsym(fc_handle, #f, NULL, 0)) == NULL){WARN("Can't find symbol %s\n", #f); goto sym_not_found;}
LOAD_FUNCPTR(FcConfigGetCurrent);
LOAD_FUNCPTR(FcFontList);
LOAD_FUNCPTR(FcFontSetDestroy);
LOAD_FUNCPTR(FcInit);
LOAD_FUNCPTR(FcObjectSetAdd);
LOAD_FUNCPTR(FcObjectSetCreate);
LOAD_FUNCPTR(FcObjectSetDestroy);
LOAD_FUNCPTR(FcPatternCreate);
LOAD_FUNCPTR(FcPatternDestroy);
LOAD_FUNCPTR(FcPatternGet);
#undef LOAD_FUNCPTR
if(!pFcInit()) return;
config = pFcConfigGetCurrent();
pat = pFcPatternCreate();
os = pFcObjectSetCreate();
pFcObjectSetAdd(os, FC_FILE);
fontset = pFcFontList(config, pat, os);
if(!fontset) return;
for(i = 0; i < fontset->nfont; i++) {
if(pFcPatternGet(fontset->fonts[i], FC_FILE, 0, &v) != FcResultMatch)
continue;
if(v.type != FcTypeString) continue;
TRACE("fontconfig: %s\n", v.u.s);
/* We're just interested in OT/TT fonts for now, so this hack just
picks up the standard extensions to save time loading every other
font */
len = strlen(v.u.s);
if(len < 4) continue;
ext = v.u.s + len - 3;
if(!strcasecmp(ext, "ttf") || !strcasecmp(ext, "ttc") || !strcasecmp(ext, "otf"))
AddFontFileToList(v.u.s, NULL);
}
pFcFontSetDestroy(fontset);
pFcObjectSetDestroy(os);
pFcPatternDestroy(pat);
sym_not_found:
#endif
return;
}
/*************************************************************
* WineEngAddFontResourceEx
*
......@@ -766,6 +846,7 @@ BOOL WineEngInit(void)
RegCloseKey(hkey);
}
load_fontconfig_fonts();
/* then look in any directories that we've specified in the config file */
if(RegOpenKeyA(HKEY_LOCAL_MACHINE,
......
......@@ -80,6 +80,9 @@
/* Define to 1 if you have the <float.h> header file. */
#undef HAVE_FLOAT_H
/* Define to 1 if you have the <fontconfig/fontconfig.h> header file. */
#undef HAVE_FONTCONFIG_FONTCONFIG_H
/* Define to 1 if you have the `fpclass' function. */
#undef HAVE_FPCLASS
......@@ -791,6 +794,9 @@
/* Define to the soname of the libcurses library. */
#undef SONAME_LIBCURSES
/* Define to the soname of the libfontconfig library. */
#undef SONAME_LIBFONTCONFIG
/* Define to the soname of the libfreetype library. */
#undef SONAME_LIBFREETYPE
......
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