gdi32: On Mac OS X, find fonts using Core Text rather than FontConfig, by default.
This commit is contained in:
parent
272cf2a973
commit
9cb7a97981
|
@ -2561,7 +2561,7 @@ fi
|
|||
|
||||
# Check whether --with-fontconfig was given.
|
||||
if test "${with_fontconfig+set}" = set; then :
|
||||
withval=$with_fontconfig; if test "x$withval" = "xno"; then ac_cv_header_fontconfig_fontconfig_h=no; fi
|
||||
withval=$with_fontconfig;
|
||||
fi
|
||||
|
||||
|
||||
|
@ -4058,6 +4058,7 @@ case $host in
|
|||
|
||||
enable_win16=${enable_win16:-yes}
|
||||
fi
|
||||
with_fontconfig=${with_fontconfig:-no}
|
||||
;;
|
||||
x86_64*)
|
||||
if test "x$enable_win64" != "xyes" -a "$cross_compiling" != "yes"
|
||||
|
@ -5278,6 +5279,8 @@ OPENGL_LIBS=""
|
|||
|
||||
|
||||
|
||||
test "x$with_fontconfig" != "xno" || ac_cv_header_fontconfig_fontconfig_h=no
|
||||
|
||||
# Check whether --enable-largefile was given.
|
||||
if test "${enable_largefile+set}" = set; then :
|
||||
enableval=$enable_largefile;
|
||||
|
|
|
@ -43,8 +43,7 @@ AC_ARG_WITH(cups, AS_HELP_STRING([--without-cups],[do not use CUPS]))
|
|||
AC_ARG_WITH(curses, AS_HELP_STRING([--without-curses],[do not use (n)curses]),
|
||||
[if test "x$withval" = "xno"; then ac_cv_header_ncurses_h=no; ac_cv_header_curses_h=no; fi])
|
||||
AC_ARG_WITH(dbus, AS_HELP_STRING([--without-dbus],[do not use DBus (dynamic device support)]))
|
||||
AC_ARG_WITH(fontconfig,AS_HELP_STRING([--without-fontconfig],[do not use fontconfig]),
|
||||
[if test "x$withval" = "xno"; then ac_cv_header_fontconfig_fontconfig_h=no; fi])
|
||||
AC_ARG_WITH(fontconfig,AS_HELP_STRING([--without-fontconfig],[do not use fontconfig]))
|
||||
AC_ARG_WITH(freetype, AS_HELP_STRING([--without-freetype],[do not use the FreeType library]))
|
||||
AC_ARG_WITH(gettext, AS_HELP_STRING([--without-gettext],[do not use gettext]))
|
||||
AC_ARG_WITH(gettextpo, AS_HELP_STRING([--with-gettextpo],[use the GetTextPO library to rebuild po files]),
|
||||
|
@ -142,6 +141,7 @@ case $host in
|
|||
AC_SUBST(TARGETFLAGS,"-m32")
|
||||
enable_win16=${enable_win16:-yes}
|
||||
fi
|
||||
with_fontconfig=${with_fontconfig:-no}
|
||||
;;
|
||||
x86_64*)
|
||||
if test "x$enable_win64" != "xyes" -a "$cross_compiling" != "yes"
|
||||
|
@ -381,6 +381,8 @@ AC_SUBST(OPENGL_LIBS,"")
|
|||
|
||||
dnl **** Check for header files ****
|
||||
|
||||
test "x$with_fontconfig" != "xno" || ac_cv_header_fontconfig_fontconfig_h=no
|
||||
|
||||
AC_SYS_LARGEFILE()
|
||||
|
||||
AC_CHECK_HEADERS(\
|
||||
|
|
|
@ -2340,9 +2340,9 @@ static BOOL ReadFontDir(const char *dirname, BOOL external_fonts)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#ifdef SONAME_LIBFONTCONFIG
|
||||
static void load_fontconfig_fonts(void)
|
||||
{
|
||||
#ifdef SONAME_LIBFONTCONFIG
|
||||
void *fc_handle = NULL;
|
||||
FcConfig *config;
|
||||
FcPattern *pat;
|
||||
|
@ -2408,10 +2408,126 @@ LOAD_FUNCPTR(FcPatternGetString);
|
|||
pFcObjectSetDestroy(os);
|
||||
pFcPatternDestroy(pat);
|
||||
sym_not_found:
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
#elif defined(HAVE_CARBON_CARBON_H)
|
||||
|
||||
static void load_mac_font_callback(const void *value, void *context)
|
||||
{
|
||||
CFStringRef pathStr = value;
|
||||
CFIndex len;
|
||||
char* path;
|
||||
|
||||
len = CFStringGetMaximumSizeOfFileSystemRepresentation(pathStr);
|
||||
path = HeapAlloc(GetProcessHeap(), 0, len);
|
||||
if (path && CFStringGetFileSystemRepresentation(pathStr, path, len))
|
||||
{
|
||||
TRACE("font file %s\n", path);
|
||||
AddFontToList(path, NULL, 0, ADDFONT_EXTERNAL_FONT | ADDFONT_ADD_TO_CACHE);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, path);
|
||||
}
|
||||
|
||||
static void load_mac_fonts(void)
|
||||
{
|
||||
CFStringRef removeDupesKey;
|
||||
CFBooleanRef removeDupesValue;
|
||||
CFDictionaryRef options;
|
||||
CTFontCollectionRef col;
|
||||
CFArrayRef descs;
|
||||
CFMutableSetRef paths;
|
||||
CFIndex i;
|
||||
|
||||
removeDupesKey = kCTFontCollectionRemoveDuplicatesOption;
|
||||
removeDupesValue = kCFBooleanTrue;
|
||||
options = CFDictionaryCreate(NULL, (const void**)&removeDupesKey, (const void**)&removeDupesValue, 1,
|
||||
&kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
|
||||
col = CTFontCollectionCreateFromAvailableFonts(options);
|
||||
if (options) CFRelease(options);
|
||||
if (!col)
|
||||
{
|
||||
WARN("CTFontCollectionCreateFromAvailableFonts failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
descs = CTFontCollectionCreateMatchingFontDescriptors(col);
|
||||
CFRelease(col);
|
||||
if (!descs)
|
||||
{
|
||||
WARN("CTFontCollectionCreateMatchingFontDescriptors failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
paths = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
|
||||
if (!paths)
|
||||
{
|
||||
WARN("CFSetCreateMutable failed\n");
|
||||
CFRelease(descs);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < CFArrayGetCount(descs); i++)
|
||||
{
|
||||
CTFontDescriptorRef desc;
|
||||
CTFontRef font;
|
||||
ATSFontRef atsFont;
|
||||
OSStatus status;
|
||||
FSRef fsref;
|
||||
CFURLRef url;
|
||||
CFStringRef ext;
|
||||
CFStringRef path;
|
||||
|
||||
desc = CFArrayGetValueAtIndex(descs, i);
|
||||
|
||||
/* CTFontDescriptor doesn't support kCTFontURLAttribute until 10.6, so
|
||||
we have to go CFFontDescriptor -> CTFont -> ATSFont -> FSRef -> CFURL. */
|
||||
font = CTFontCreateWithFontDescriptor(desc, 0, NULL);
|
||||
if (!font) continue;
|
||||
|
||||
atsFont = CTFontGetPlatformFont(font, NULL);
|
||||
if (!atsFont)
|
||||
{
|
||||
CFRelease(font);
|
||||
continue;
|
||||
}
|
||||
|
||||
status = ATSFontGetFileReference(atsFont, &fsref);
|
||||
CFRelease(font);
|
||||
if (status != noErr) continue;
|
||||
|
||||
url = CFURLCreateFromFSRef(NULL, &fsref);
|
||||
if (!url) continue;
|
||||
|
||||
ext = CFURLCopyPathExtension(url);
|
||||
if (ext)
|
||||
{
|
||||
BOOL skip = (CFStringCompare(ext, CFSTR("pfa"), kCFCompareCaseInsensitive) == kCFCompareEqualTo ||
|
||||
CFStringCompare(ext, CFSTR("pfb"), kCFCompareCaseInsensitive) == kCFCompareEqualTo);
|
||||
CFRelease(ext);
|
||||
if (skip)
|
||||
{
|
||||
CFRelease(url);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
path = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle);
|
||||
CFRelease(url);
|
||||
if (!path) continue;
|
||||
|
||||
CFSetAddValue(paths, path);
|
||||
CFRelease(path);
|
||||
}
|
||||
|
||||
CFRelease(descs);
|
||||
|
||||
CFSetApplyFunction(paths, load_mac_font_callback, NULL);
|
||||
CFRelease(paths);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static BOOL load_font_from_data_dir(LPCWSTR file)
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
|
@ -3485,7 +3601,11 @@ static void init_font_list(void)
|
|||
RegCloseKey(hkey);
|
||||
}
|
||||
|
||||
#ifdef SONAME_LIBFONTCONFIG
|
||||
load_fontconfig_fonts();
|
||||
#elif defined(HAVE_CARBON_CARBON_H)
|
||||
load_mac_fonts();
|
||||
#endif
|
||||
|
||||
/* then look in any directories that we've specified in the config file */
|
||||
/* @@ Wine registry key: HKCU\Software\Wine\Fonts */
|
||||
|
|
Loading…
Reference in New Issue