diff --git a/configure b/configure index 80b1e5d3f4..db8cc436a3 100755 --- a/configure +++ b/configure @@ -978,6 +978,8 @@ X_CFLAGS XMKMF DIRECTFB_LIBS DIRECTFB_CFLAGS +FONTCONFIG_LIBS +FONTCONFIG_CFLAGS GTK_CONFIG GTK_LIBS GTK_CFLAGS @@ -1366,6 +1368,8 @@ CXX CXXFLAGS CCC PKG_CONFIG +FONTCONFIG_CFLAGS +FONTCONFIG_LIBS DIRECTFB_CFLAGS DIRECTFB_LIBS XMKMF @@ -2348,6 +2352,10 @@ Some influential environment variables: CXX C++ compiler command CXXFLAGS C++ compiler flags PKG_CONFIG path to pkg-config utility + FONTCONFIG_CFLAGS + C compiler flags for FONTCONFIG, overriding pkg-config + FONTCONFIG_LIBS + linker flags for FONTCONFIG, overriding pkg-config DIRECTFB_CFLAGS C compiler flags for DIRECTFB, overriding pkg-config DIRECTFB_LIBS @@ -22471,6 +22479,83 @@ $as_echo "not found" >&6; } fi fi + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FONTCONFIG" >&5 +$as_echo_n "checking for FONTCONFIG... " >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$FONTCONFIG_CFLAGS"; then + pkg_cv_FONTCONFIG_CFLAGS="$FONTCONFIG_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fontconfig\""; } >&5 + ($PKG_CONFIG --exists --print-errors "fontconfig") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_FONTCONFIG_CFLAGS=`$PKG_CONFIG --cflags "fontconfig" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$FONTCONFIG_LIBS"; then + pkg_cv_FONTCONFIG_LIBS="$FONTCONFIG_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fontconfig\""; } >&5 + ($PKG_CONFIG --exists --print-errors "fontconfig") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_FONTCONFIG_LIBS=`$PKG_CONFIG --libs "fontconfig" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + FONTCONFIG_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "fontconfig"` + else + FONTCONFIG_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fontconfig"` + fi + # Put the nasty error message in config.log where it belongs + echo "$FONTCONFIG_PKG_ERRORS" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: fontconfig library not found, run-time font loading won't be supported by wxFont" >&5 +$as_echo "$as_me: WARNING: fontconfig library not found, run-time font loading won't be supported by wxFont" >&2;} +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: fontconfig library not found, run-time font loading won't be supported by wxFont" >&5 +$as_echo "$as_me: WARNING: fontconfig library not found, run-time font loading won't be supported by wxFont" >&2;} +else + FONTCONFIG_CFLAGS=$pkg_cv_FONTCONFIG_CFLAGS + FONTCONFIG_LIBS=$pkg_cv_FONTCONFIG_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + $as_echo "#define wxUSE_FONTCONFIG 1" >>confdefs.h + + CXXFLAGS="$FONTCONFIG_CFLAGS $CXXFLAGS" + GUI_TK_LIBRARY="$GUI_TK_LIBRARY $FONTCONFIG_LIBS" + +fi fi if test "$wxUSE_DFB" = 1; then diff --git a/configure.in b/configure.in index 5b65a0bc24..40ce665b4d 100644 --- a/configure.in +++ b/configure.in @@ -2962,6 +2962,14 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config dnl AC_MSG_RESULT(not found) dnl fi fi + + PKG_CHECK_MODULES(FONTCONFIG, [fontconfig], + [ + AC_DEFINE(wxUSE_FONTCONFIG) + CXXFLAGS="$FONTCONFIG_CFLAGS $CXXFLAGS" + GUI_TK_LIBRARY="$GUI_TK_LIBRARY $FONTCONFIG_LIBS" + ], + [AC_MSG_WARN([fontconfig library not found, run-time font loading won't be supported by wxFont])]) fi if test "$wxUSE_DFB" = 1; then diff --git a/include/wx/gtk/font.h b/include/wx/gtk/font.h index 669055c2c3..4bd38738d6 100644 --- a/include/wx/gtk/font.h +++ b/include/wx/gtk/font.h @@ -118,7 +118,7 @@ private: wxDECLARE_DYNAMIC_CLASS(wxFont); }; -#ifndef __WXMSW__ +#if wxUSE_FONTCONFIG #define wxHAS_PRIVATE_FONTS 1 #endif diff --git a/setup.h.in b/setup.h.in index 0715a696e1..0d35c88436 100644 --- a/setup.h.in +++ b/setup.h.in @@ -833,6 +833,10 @@ */ #define wxUSE_PLUGINS 0 +/* + * Use FontConfig library for private fonts support in wxFont. + */ +#define wxUSE_FONTCONFIG 0 /* * Use GTK print for printing under GTK+ 2.10+ */ diff --git a/setup.h_vms b/setup.h_vms index d1f7842057..24e8301f4a 100644 --- a/setup.h_vms +++ b/setup.h_vms @@ -902,6 +902,14 @@ typedef pid_t GPid; * Use SDL for audio (Unix) */ #define wxUSE_LIBSDL 0 +/* + * Use FontConfig library for private fonts support in wxFont. + */ +#ifdef VMS_GTK2 +#define wxUSE_FONTCONFIG 1 +#else +#define wxUSE_FONTCONFIG 0 +#endif /* * Use GTK print for printing under GTK+ 2.10+ */ diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index 297c567e25..8903aef9a8 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -20,6 +20,7 @@ #include "wx/font.h" #ifndef WX_PRECOMP + #include "wx/intl.h" #include "wx/log.h" #include "wx/utils.h" #include "wx/settings.h" @@ -31,11 +32,6 @@ #include "wx/gtk/private.h" -#ifdef GDK_WINDOWING_X11 - #include - #include -#endif - // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- @@ -564,6 +560,8 @@ bool wxFont::GTKSetPangoAttrs(PangoLayout* layout) const #ifdef wxHAS_PRIVATE_FONTS +#include + namespace { FcConfig* gs_fcConfig = NULL;