diff --git a/configure b/configure index ff0ab1a102..b3b64b1826 100755 --- a/configure +++ b/configure @@ -1270,6 +1270,7 @@ enable_notifmsg enable_odcombobox enable_popupwin enable_prefseditor +enable_privatefonts enable_radiobox enable_radiobtn enable_richmsgdlg @@ -2209,6 +2210,7 @@ Optional Features: --enable-odcombobox use wxOwnerDrawnComboBox class --enable-popupwin use wxPopUpWindow class --enable-prefseditor use wxPreferencesEditor class + --enable-privatefonts provide wxFont::AddPrivateFont() method --enable-radiobox use wxRadioBox class --enable-radiobtn use wxRadioButton class --enable-richmsgdlg use wxRichMessageDialog class @@ -10192,6 +10194,35 @@ fi eval "$wx_cv_use_prefseditor" + enablestring= + defaultval=$wxUSE_ALL_FEATURES + if test -z "$defaultval"; then + if test x"$enablestring" = xdisable; then + defaultval=yes + else + defaultval=no + fi + fi + + # Check whether --enable-privatefonts was given. +if test "${enable_privatefonts+set}" = set; then : + enableval=$enable_privatefonts; + if test "$enableval" = yes; then + wx_cv_use_privatefonts='wxUSE_PRIVATE_FONTS=yes' + else + wx_cv_use_privatefonts='wxUSE_PRIVATE_FONTS=no' + fi + +else + + wx_cv_use_privatefonts='wxUSE_PRIVATE_FONTS=${'DEFAULT_wxUSE_PRIVATE_FONTS":-$defaultval}" + +fi + + + eval "$wx_cv_use_privatefonts" + + enablestring= defaultval=$wxUSE_ALL_FEATURES if test -z "$defaultval"; then @@ -22480,6 +22511,7 @@ $as_echo "not found" >&6; } fi + if test "$wxUSE_PRIVATE_FONTS" = "yes"; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PRIVATE_FONTS" >&5 @@ -22539,23 +22571,24 @@ fi # Put the nasty error message in config.log where it belongs echo "$PRIVATE_FONTS_PKG_ERRORS" >&5 - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: fontconfig library not found or too old, run-time font loading won't be supported by wxFont" >&5 -$as_echo "$as_me: WARNING: fontconfig library not found or too old, run-time font loading won't be supported by wxFont" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: run-time font loading won't be supported by wxFont" >&5 +$as_echo "$as_me: WARNING: 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 or too old, run-time font loading won't be supported by wxFont" >&5 -$as_echo "$as_me: WARNING: fontconfig library not found or too old, run-time font loading won't be supported by wxFont" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: run-time font loading won't be supported by wxFont" >&5 +$as_echo "$as_me: WARNING: run-time font loading won't be supported by wxFont" >&2;} else PRIVATE_FONTS_CFLAGS=$pkg_cv_PRIVATE_FONTS_CFLAGS PRIVATE_FONTS_LIBS=$pkg_cv_PRIVATE_FONTS_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - $as_echo "#define wxHAVE_FONTCONFIG_2_8_0 1" >>confdefs.h + $as_echo "#define wxUSE_PRIVATE_FONTS 1" >>confdefs.h - CXXFLAGS="$FONTCONFIG_CFLAGS $CXXFLAGS" - GUI_TK_LIBRARY="$GUI_TK_LIBRARY $FONTCONFIG_LIBS" + CXXFLAGS="$PRIVATE_FONTS_CFLAGS $CXXFLAGS" + GUI_TK_LIBRARY="$GUI_TK_LIBRARY $PRIVATE_FONTS_LIBS" fi + fi fi if test "$wxUSE_DFB" = 1; then @@ -34371,6 +34404,11 @@ if test "$wxUSE_PREFERENCES_EDITOR" = "yes"; then SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS preferences" fi +if test "$wxUSE_PRIVATE_FONTS" = "yes"; then + $as_echo "#define wxUSE_PRIVATE_FONTS 1" >>confdefs.h + +fi + if test "$wxUSE_DIALUP_MANAGER" = "yes"; then if test "$wxUSE_MAC" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Dialup manager not supported on this platform... disabled" >&5 diff --git a/configure.in b/configure.in index 47f7e55117..7d00d5d9ff 100644 --- a/configure.in +++ b/configure.in @@ -925,6 +925,7 @@ WX_ARG_FEATURE(notifmsg, [ --enable-notifmsg use wxNotificationMessage WX_ARG_FEATURE(odcombobox, [ --enable-odcombobox use wxOwnerDrawnComboBox class], wxUSE_ODCOMBOBOX) WX_ARG_FEATURE(popupwin, [ --enable-popupwin use wxPopUpWindow class], wxUSE_POPUPWIN) WX_ARG_FEATURE(prefseditor, [ --enable-prefseditor use wxPreferencesEditor class], wxUSE_PREFERENCES_EDITOR) +WX_ARG_FEATURE(privatefonts,[ --enable-privatefonts provide wxFont::AddPrivateFont() method], wxUSE_PRIVATE_FONTS) WX_ARG_FEATURE(radiobox, [ --enable-radiobox use wxRadioBox class], wxUSE_RADIOBOX) WX_ARG_FEATURE(radiobtn, [ --enable-radiobtn use wxRadioButton class], wxUSE_RADIOBTN) WX_ARG_FEATURE(richmsgdlg, [ --enable-richmsgdlg use wxRichMessageDialog class], wxUSE_RICHMSGDLG) @@ -2963,13 +2964,15 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config dnl fi fi - PKG_CHECK_MODULES(PRIVATE_FONTS, [fontconfig >= 2.8.0 pangoft2 >= 1.38.0], - [ - AC_DEFINE(wxHAVE_FONTCONFIG_2_8_0) - CXXFLAGS="$FONTCONFIG_CFLAGS $CXXFLAGS" - GUI_TK_LIBRARY="$GUI_TK_LIBRARY $FONTCONFIG_LIBS" - ], - [AC_MSG_WARN([fontconfig library not found or too old, run-time font loading won't be supported by wxFont])]) + if test "$wxUSE_PRIVATE_FONTS" = "yes"; then + PKG_CHECK_MODULES(PRIVATE_FONTS, [fontconfig >= 2.8.0 pangoft2 >= 1.38.0], + [ + AC_DEFINE(wxUSE_PRIVATE_FONTS) + CXXFLAGS="$PRIVATE_FONTS_CFLAGS $CXXFLAGS" + GUI_TK_LIBRARY="$GUI_TK_LIBRARY $PRIVATE_FONTS_LIBS" + ], + [AC_MSG_WARN([run-time font loading won't be supported by wxFont])]) + fi fi if test "$wxUSE_DFB" = 1; then @@ -6904,6 +6907,10 @@ if test "$wxUSE_PREFERENCES_EDITOR" = "yes"; then SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS preferences" fi +if test "$wxUSE_PRIVATE_FONTS" = "yes"; then + AC_DEFINE(wxUSE_PRIVATE_FONTS) +fi + if test "$wxUSE_DIALUP_MANAGER" = "yes"; then if test "$wxUSE_MAC" = 1; then AC_MSG_WARN([Dialup manager not supported on this platform... disabled]) diff --git a/docs/doxygen/mainpages/const_cpp.h b/docs/doxygen/mainpages/const_cpp.h index 3fd074fb70..1756d18a82 100644 --- a/docs/doxygen/mainpages/const_cpp.h +++ b/docs/doxygen/mainpages/const_cpp.h @@ -188,7 +188,6 @@ Currently the following symbols exist: @itemdef{wxHAS_IMAGES_IN_RESOURCES, Defined if Windows resource files or OS/2 resource files are available on the current platform.} @itemdef{wxHAS_POWER_EVENTS, Defined if wxPowerEvent are ever generated on the current platform.} -@itemdef{wxHAS_PRIVATE_FONTS, Defined if wxFont::AddPrivateFont() is implemented.} @itemdef{wxHAS_RADIO_MENU_ITEMS, Defined if the current port supports radio menu items (see wxMenu::AppendRadioItem).} @itemdef{wxHAS_RAW_BITMAP, Defined if direct access to bitmap data using the classes in @c wx/rawbmp.h is supported.} diff --git a/docs/doxygen/mainpages/const_wxusedef.h b/docs/doxygen/mainpages/const_wxusedef.h index 259416c087..3753cab329 100644 --- a/docs/doxygen/mainpages/const_wxusedef.h +++ b/docs/doxygen/mainpages/const_wxusedef.h @@ -186,6 +186,7 @@ library: @itemdef{wxUSE_POSTSCRIPT, Use wxPostScriptPrinter class.} @itemdef{wxUSE_PRINTF_POS_PARAMS, Use wxVsnprintf which supports positional parameters.} @itemdef{wxUSE_PRINTING_ARCHITECTURE, Enable printer classes.} +@itemdef{wxUSE_PRIVATE_FONTS, Implement wxFont::AddPrivateFont() method.} @itemdef{wxUSE_PROGRESSDLG, Enables progress dialog classes.} @itemdef{wxUSE_PROPGRID, Use wxPropertyGrid library.} @itemdef{wxUSE_PROTOCOL, Use wxProtocol and derived classes.} diff --git a/include/wx/android/setup.h b/include/wx/android/setup.h index d125af0798..2a6aceabed 100644 --- a/include/wx/android/setup.h +++ b/include/wx/android/setup.h @@ -794,14 +794,14 @@ // notice that we can't use wxCHECK_VISUALC_VERSION() here as this file is // included from wx/platform.h before wxCHECK_VISUALC_VERSION() is defined #ifdef _MSC_VER -# define wxUSE_GRAPHICS_CONTEXT 1 +#define wxUSE_GRAPHICS_CONTEXT 1 #else - // Disable support for other Windows compilers, enable it if your compiler - // comes with new enough SDK or you installed the headers manually. - // - // Notice that this will be set by configure under non-Windows platforms - // anyhow so the value there is not important. -# define wxUSE_GRAPHICS_CONTEXT 0 +// Disable support for other Windows compilers, enable it if your compiler +// comes with new enough SDK or you installed the headers manually. +// +// Notice that this will be set by configure under non-Windows platforms +// anyhow so the value there is not important. +#define wxUSE_GRAPHICS_CONTEXT 0 #endif // Enable wxGraphicsContext implementation using Cairo library. @@ -1141,6 +1141,16 @@ // Recommended setting: 1 (but can be safely disabled if you don't use it) #define wxUSE_PREFERENCES_EDITOR 1 +// wxFont::AddPrivateFont() allows to use fonts not installed on the system by +// loading them from font files during run-time. +// +// Default is 1 except under Unix where it will be turned off by configure if +// the required libraries are not available or not new enough. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it and +// want to avoid extra dependencies under Linux, for example). +#define wxUSE_PRIVATE_FONTS 1 + // wxRichToolTip is a customizable tooltip class which has more functionality // than the stock (but native, unlike this class) wxToolTip. // diff --git a/include/wx/chkconf.h b/include/wx/chkconf.h index 41797a4048..106918e031 100644 --- a/include/wx/chkconf.h +++ b/include/wx/chkconf.h @@ -983,6 +983,14 @@ # endif #endif /* !defined(wxUSE_PREFERENCES_EDITOR) */ +#ifndef wxUSE_PRIVATE_FONTS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_PRIVATE_FONTS must be defined, please read comment near the top of this file." +# else +# define wxUSE_PRIVATE_FONTS 0 +# endif +#endif /* !defined(wxUSE_PRIVATE_FONTS) */ + #ifndef wxUSE_PRINTING_ARCHITECTURE # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_PRINTING_ARCHITECTURE must be defined, please read comment near the top of this file." @@ -2305,6 +2313,13 @@ # endif #endif /* wxUSE_PREFERENCES_EDITOR */ +#if wxUSE_PRIVATE_FONTS +# if !defined(__WXMSW__) && !defined(__WXGTK__) && !defined(__WXOSX__) +# undef wxUSE_PRIVATE_FONTS +# define wxUSE_PRIVATE_FONTS 0 +# endif +#endif /* wxUSE_PRIVATE_FONTS */ + #if wxUSE_MEDIACTRL # if !wxUSE_LONGLONG # ifdef wxABORT_ON_CONFIG_ERROR diff --git a/include/wx/font.h b/include/wx/font.h index 8236558201..354f458396 100644 --- a/include/wx/font.h +++ b/include/wx/font.h @@ -329,11 +329,10 @@ public: static wxFont *New(const wxString& strNativeFontDesc); // Load the font from the given file and return true on success or false on - // error (an error message will be logged in this case, unless there is no - // support for private fonts at all in the current port, in which case - // wxHAS_PRIVATE_FONTS will not be defined allowing to check for this at - // compile-time). + // error (an error message will be logged in this case). +#if wxUSE_PRIVATE_FONTS static bool AddPrivateFont(const wxString& filename); +#endif // wxUSE_PRIVATE_FONTS // comparison bool operator==(const wxFont& font) const; diff --git a/include/wx/gtk/font.h b/include/wx/gtk/font.h index a8f8ce381f..4d1220617d 100644 --- a/include/wx/gtk/font.h +++ b/include/wx/gtk/font.h @@ -118,8 +118,4 @@ private: wxDECLARE_DYNAMIC_CLASS(wxFont); }; -#ifdef wxHAVE_FONTCONFIG_2_8_0 - #define wxHAS_PRIVATE_FONTS 1 -#endif - #endif // _WX_GTK_FONT_H_ diff --git a/include/wx/gtk/setup0.h b/include/wx/gtk/setup0.h index 944260554e..e0155cee95 100644 --- a/include/wx/gtk/setup0.h +++ b/include/wx/gtk/setup0.h @@ -795,14 +795,14 @@ // notice that we can't use wxCHECK_VISUALC_VERSION() here as this file is // included from wx/platform.h before wxCHECK_VISUALC_VERSION() is defined #ifdef _MSC_VER -# define wxUSE_GRAPHICS_CONTEXT 1 +#define wxUSE_GRAPHICS_CONTEXT 1 #else - // Disable support for other Windows compilers, enable it if your compiler - // comes with new enough SDK or you installed the headers manually. - // - // Notice that this will be set by configure under non-Windows platforms - // anyhow so the value there is not important. -# define wxUSE_GRAPHICS_CONTEXT 0 +// Disable support for other Windows compilers, enable it if your compiler +// comes with new enough SDK or you installed the headers manually. +// +// Notice that this will be set by configure under non-Windows platforms +// anyhow so the value there is not important. +#define wxUSE_GRAPHICS_CONTEXT 0 #endif // Enable wxGraphicsContext implementation using Cairo library. @@ -1142,6 +1142,16 @@ // Recommended setting: 1 (but can be safely disabled if you don't use it) #define wxUSE_PREFERENCES_EDITOR 1 +// wxFont::AddPrivateFont() allows to use fonts not installed on the system by +// loading them from font files during run-time. +// +// Default is 1 except under Unix where it will be turned off by configure if +// the required libraries are not available or not new enough. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it and +// want to avoid extra dependencies under Linux, for example). +#define wxUSE_PRIVATE_FONTS 1 + // wxRichToolTip is a customizable tooltip class which has more functionality // than the stock (but native, unlike this class) wxToolTip. // diff --git a/include/wx/motif/setup0.h b/include/wx/motif/setup0.h index dafcdaab77..f55fc8b14c 100644 --- a/include/wx/motif/setup0.h +++ b/include/wx/motif/setup0.h @@ -795,14 +795,14 @@ // notice that we can't use wxCHECK_VISUALC_VERSION() here as this file is // included from wx/platform.h before wxCHECK_VISUALC_VERSION() is defined #ifdef _MSC_VER -# define wxUSE_GRAPHICS_CONTEXT 1 +#define wxUSE_GRAPHICS_CONTEXT 1 #else - // Disable support for other Windows compilers, enable it if your compiler - // comes with new enough SDK or you installed the headers manually. - // - // Notice that this will be set by configure under non-Windows platforms - // anyhow so the value there is not important. -# define wxUSE_GRAPHICS_CONTEXT 0 +// Disable support for other Windows compilers, enable it if your compiler +// comes with new enough SDK or you installed the headers manually. +// +// Notice that this will be set by configure under non-Windows platforms +// anyhow so the value there is not important. +#define wxUSE_GRAPHICS_CONTEXT 0 #endif // Enable wxGraphicsContext implementation using Cairo library. @@ -1142,6 +1142,16 @@ // Recommended setting: 1 (but can be safely disabled if you don't use it) #define wxUSE_PREFERENCES_EDITOR 1 +// wxFont::AddPrivateFont() allows to use fonts not installed on the system by +// loading them from font files during run-time. +// +// Default is 1 except under Unix where it will be turned off by configure if +// the required libraries are not available or not new enough. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it and +// want to avoid extra dependencies under Linux, for example). +#define wxUSE_PRIVATE_FONTS 1 + // wxRichToolTip is a customizable tooltip class which has more functionality // than the stock (but native, unlike this class) wxToolTip. // diff --git a/include/wx/msw/font.h b/include/wx/msw/font.h index 16dae838a9..eec24baedb 100644 --- a/include/wx/msw/font.h +++ b/include/wx/msw/font.h @@ -169,6 +169,4 @@ private: wxDECLARE_DYNAMIC_CLASS(wxFont); }; -#define wxHAS_PRIVATE_FONTS 1 - #endif // _WX_FONT_H_ diff --git a/include/wx/msw/setup0.h b/include/wx/msw/setup0.h index 9ac46699d6..5860054d87 100644 --- a/include/wx/msw/setup0.h +++ b/include/wx/msw/setup0.h @@ -795,14 +795,14 @@ // notice that we can't use wxCHECK_VISUALC_VERSION() here as this file is // included from wx/platform.h before wxCHECK_VISUALC_VERSION() is defined #ifdef _MSC_VER -# define wxUSE_GRAPHICS_CONTEXT 1 +#define wxUSE_GRAPHICS_CONTEXT 1 #else - // Disable support for other Windows compilers, enable it if your compiler - // comes with new enough SDK or you installed the headers manually. - // - // Notice that this will be set by configure under non-Windows platforms - // anyhow so the value there is not important. -# define wxUSE_GRAPHICS_CONTEXT 0 +// Disable support for other Windows compilers, enable it if your compiler +// comes with new enough SDK or you installed the headers manually. +// +// Notice that this will be set by configure under non-Windows platforms +// anyhow so the value there is not important. +#define wxUSE_GRAPHICS_CONTEXT 0 #endif // Enable wxGraphicsContext implementation using Cairo library. @@ -1142,6 +1142,16 @@ // Recommended setting: 1 (but can be safely disabled if you don't use it) #define wxUSE_PREFERENCES_EDITOR 1 +// wxFont::AddPrivateFont() allows to use fonts not installed on the system by +// loading them from font files during run-time. +// +// Default is 1 except under Unix where it will be turned off by configure if +// the required libraries are not available or not new enough. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it and +// want to avoid extra dependencies under Linux, for example). +#define wxUSE_PRIVATE_FONTS 1 + // wxRichToolTip is a customizable tooltip class which has more functionality // than the stock (but native, unlike this class) wxToolTip. // diff --git a/include/wx/osx/font.h b/include/wx/osx/font.h index bd29cdf538..fcd82013f5 100644 --- a/include/wx/osx/font.h +++ b/include/wx/osx/font.h @@ -167,6 +167,4 @@ private: wxDECLARE_DYNAMIC_CLASS(wxFont); }; -#define wxHAS_PRIVATE_FONTS 1 - #endif // _WX_FONT_H_ diff --git a/include/wx/osx/setup0.h b/include/wx/osx/setup0.h index d920188567..75049f0e5e 100644 --- a/include/wx/osx/setup0.h +++ b/include/wx/osx/setup0.h @@ -1148,6 +1148,16 @@ // Recommended setting: 1 (but can be safely disabled if you don't use it) #define wxUSE_PREFERENCES_EDITOR 1 +// wxFont::AddPrivateFont() allows to use fonts not installed on the system by +// loading them from font files during run-time. +// +// Default is 1 except under Unix where it will be turned off by configure if +// the required libraries are not available or not new enough. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it and +// want to avoid extra dependencies under Linux, for example). +#define wxUSE_PRIVATE_FONTS 1 + // wxRichToolTip is a customizable tooltip class which has more functionality // than the stock (but native, unlike this class) wxToolTip. // diff --git a/include/wx/setup_inc.h b/include/wx/setup_inc.h index ebaaeba459..9f031a8c53 100644 --- a/include/wx/setup_inc.h +++ b/include/wx/setup_inc.h @@ -1138,6 +1138,16 @@ // Recommended setting: 1 (but can be safely disabled if you don't use it) #define wxUSE_PREFERENCES_EDITOR 1 +// wxFont::AddPrivateFont() allows to use fonts not installed on the system by +// loading them from font files during run-time. +// +// Default is 1 except under Unix where it will be turned off by configure if +// the required libraries are not available or not new enough. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it and +// want to avoid extra dependencies under Linux, for example). +#define wxUSE_PRIVATE_FONTS 1 + // wxRichToolTip is a customizable tooltip class which has more functionality // than the stock (but native, unlike this class) wxToolTip. // diff --git a/include/wx/univ/setup0.h b/include/wx/univ/setup0.h index 9d8bed8509..069f9b156e 100644 --- a/include/wx/univ/setup0.h +++ b/include/wx/univ/setup0.h @@ -794,14 +794,14 @@ // notice that we can't use wxCHECK_VISUALC_VERSION() here as this file is // included from wx/platform.h before wxCHECK_VISUALC_VERSION() is defined #ifdef _MSC_VER -# define wxUSE_GRAPHICS_CONTEXT 1 +#define wxUSE_GRAPHICS_CONTEXT 1 #else - // Disable support for other Windows compilers, enable it if your compiler - // comes with new enough SDK or you installed the headers manually. - // - // Notice that this will be set by configure under non-Windows platforms - // anyhow so the value there is not important. -# define wxUSE_GRAPHICS_CONTEXT 0 +// Disable support for other Windows compilers, enable it if your compiler +// comes with new enough SDK or you installed the headers manually. +// +// Notice that this will be set by configure under non-Windows platforms +// anyhow so the value there is not important. +#define wxUSE_GRAPHICS_CONTEXT 0 #endif // Enable wxGraphicsContext implementation using Cairo library. @@ -1141,6 +1141,16 @@ // Recommended setting: 1 (but can be safely disabled if you don't use it) #define wxUSE_PREFERENCES_EDITOR 1 +// wxFont::AddPrivateFont() allows to use fonts not installed on the system by +// loading them from font files during run-time. +// +// Default is 1 except under Unix where it will be turned off by configure if +// the required libraries are not available or not new enough. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it and +// want to avoid extra dependencies under Linux, for example). +#define wxUSE_PRIVATE_FONTS 1 + // wxRichToolTip is a customizable tooltip class which has more functionality // than the stock (but native, unlike this class) wxToolTip. // diff --git a/interface/wx/font.h b/interface/wx/font.h index 9f7c37708f..e798a95d84 100644 --- a/interface/wx/font.h +++ b/interface/wx/font.h @@ -686,10 +686,10 @@ public: false and log an error message explaining the problem if this requirement is not satisfied either at compile- or run-time. - Currently this method is implemented for all major platforms but you - may also test for @c wxHAS_PRIVATE_FONTS preprocessor symbol: if it is - not defined, this function is not implemented at all and simply always - returns false. + Currently this method is implemented for all major platforms (subject + to having Pango 1.38 or later when running configure under Unix) and + @c wxUSE_PRIVATE_FONTS is always set to 0 under the other platforms, + making this function unavailable at compile-time. @return @true if the font was added and can now be used. diff --git a/samples/font/font.cpp b/samples/font/font.cpp index 6b5110064f..022c0a8c6d 100644 --- a/samples/font/font.cpp +++ b/samples/font/font.cpp @@ -397,7 +397,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) wxT("Find font for en&coding...\tCtrl-C"), wxT("Find font families for given encoding")); -#ifdef wxHAS_PRIVATE_FONTS +#if wxUSE_PRIVATE_FONTS // Try to use a private font, under most platforms we just look for it in // the current directory but under OS X it must be in a specific location // so look for it there. @@ -433,7 +433,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) "Select private font", "Select a font available only in this application"); } -#endif // wxHAS_PRIVATE_FONTS +#endif // wxUSE_PRIVATE_FONTS // now append the freshly created menu to the menu bar... diff --git a/setup.h.in b/setup.h.in index e173a50227..b2de2783c3 100644 --- a/setup.h.in +++ b/setup.h.in @@ -468,6 +468,8 @@ #define wxUSE_PREFERENCES_EDITOR 0 +#define wxUSE_PRIVATE_FONTS 0 + #define wxUSE_RICHTOOLTIP 0 #define wxUSE_SASH 0 @@ -833,10 +835,6 @@ */ #define wxUSE_PLUGINS 0 -/* - * Use FontConfig library for private fonts support in wxFont. - */ -#undef wxHAVE_FONTCONFIG_2_8_0 /* * Use GTK print for printing under GTK+ 2.10+ */ diff --git a/setup.h_vms b/setup.h_vms index e9958e410d..d1f7842057 100644 --- a/setup.h_vms +++ b/setup.h_vms @@ -902,14 +902,6 @@ 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 wxHAVE_FONTCONFIG_2_8_0 1 -#else -#undef wxHAVE_FONTCONFIG_2_8_0 -#endif /* * Use GTK print for printing under GTK+ 2.10+ */ diff --git a/src/common/fontcmn.cpp b/src/common/fontcmn.cpp index dcb899a9ae..ea249bad90 100644 --- a/src/common/fontcmn.cpp +++ b/src/common/fontcmn.cpp @@ -1136,16 +1136,3 @@ bool wxFromString(const wxString& str, wxFontBase *font) return font->SetNativeFontInfo(str); } - -#ifndef wxHAS_PRIVATE_FONTS - -// Adding private fonts is not supported on this platform, so provide the -// functions that would be used, but make them no-ops that return a code -// that indicates failure. - -bool wxFontBase::AddPrivateFont(const wxString& WXUNUSED(filename)) -{ - return false; -} - -#endif // !wxHAS_PRIVATE_FONTS diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index b14f68b218..96403a8bbb 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -558,7 +558,7 @@ bool wxFont::GTKSetPangoAttrs(PangoLayout* layout) const // Support for adding private fonts // ---------------------------------------------------------------------------- -#ifdef wxHAS_PRIVATE_FONTS +#if wxUSE_PRIVATE_FONTS #include "wx/fontenum.h" #include "wx/module.h" @@ -649,4 +649,4 @@ bool wxFontBase::AddPrivateFont(const wxString& filename) return true; } -#endif // wxHAS_PRIVATE_FONTS +#endif // wxUSE_PRIVATE_FONTS diff --git a/src/msw/font.cpp b/src/msw/font.cpp index 4ef7642035..27dc7cfed1 100644 --- a/src/msw/font.cpp +++ b/src/msw/font.cpp @@ -1089,6 +1089,8 @@ bool wxFont::IsFixedWidth() const // Private fonts support // ---------------------------------------------------------------------------- +#if wxUSE_PRIVATE_FONTS + namespace { @@ -1131,3 +1133,5 @@ bool wxFontBase::AddPrivateFont(const wxString& filename) gs_privateFontFileNames.Add(filename); return true; } + +#endif // wxUSE_PRIVATE_FONTS diff --git a/src/msw/graphics.cpp b/src/msw/graphics.cpp index 003eefd41e..9e87c937d1 100644 --- a/src/msw/graphics.cpp +++ b/src/msw/graphics.cpp @@ -963,6 +963,8 @@ wxGDIPlusBrushData::CreateRadialGradientBrush(wxDouble xo, wxDouble yo, // Support for adding private fonts //----------------------------------------------------------------------------- +#if wxUSE_PRIVATE_FONTS + namespace { @@ -974,6 +976,8 @@ Gdiplus::FontFamily* gs_pFontFamily = NULL; // This function is defined in src/msw/font.cpp. extern const wxArrayString& wxGetPrivateFontFileNames(); +#endif // wxUSE_PRIVATE_FONTS + //----------------------------------------------------------------------------- // wxGDIPlusFont implementation //----------------------------------------------------------------------------- @@ -985,6 +989,7 @@ wxGDIPlusFontData::Init(const wxString& name, const wxColour& col, Unit fontUnit) { +#if wxUSE_PRIVATE_FONTS // If the user has registered any private fonts, they should be used in // preference to any system-wide ones. m_font = NULL; @@ -1009,7 +1014,10 @@ wxGDIPlusFontData::Init(const wxString& name, } if ( !m_font ) +#endif // wxUSE_PRIVATE_FONTS + { m_font = new Font(name.wc_str(), size, style, fontUnit); + } m_textBrush = new SolidBrush(wxColourToColor(col)); } @@ -2315,6 +2323,7 @@ void wxGDIPlusRenderer::Load() wxLogTrace("gdiplus", "successfully initialized GDI+"); m_loaded = 1; +#if wxUSE_PRIVATE_FONTS // Make private fonts available to GDI+, if any. const wxArrayString& privateFonts = wxGetPrivateFontFileNames(); const size_t n = privateFonts.size(); @@ -2329,6 +2338,7 @@ void wxGDIPlusRenderer::Load() gs_pFontFamily = new Gdiplus::FontFamily[n]; } +#endif // wxUSE_PRIVATE_FONTS } else { @@ -2344,6 +2354,7 @@ void wxGDIPlusRenderer::Unload() GdiplusShutdown(m_gditoken); m_gditoken = 0; +#if wxUSE_PRIVATE_FONTS if ( gs_privateFonts ) { delete gs_privateFonts; @@ -2352,6 +2363,7 @@ void wxGDIPlusRenderer::Unload() delete[] gs_pFontFamily; gs_pFontFamily = NULL; } +#endif // wxUSE_PRIVATE_FONTS } m_loaded = -1; // next Load() will try again } diff --git a/src/osx/fontutil.cpp b/src/osx/fontutil.cpp index 5cf015bcda..1f44f778c9 100644 --- a/src/osx/fontutil.cpp +++ b/src/osx/fontutil.cpp @@ -69,6 +69,8 @@ wxString wxNativeEncodingInfo::ToString() const // Private Fonts // ---------------------------------------------------------------------------- +#if wxUSE_PRIVATE_FONTS + // On OSX one can provide private fonts simply by putting the font files in // with the resources in your application bundle. So the API for adding fonts // does not do anything except checking that the file you pass to it actually @@ -95,6 +97,8 @@ bool wxFontBase::AddPrivateFont(const wxString& filename) return true; } +#endif // wxUSE_PRIVATE_FONTS + // ---------------------------------------------------------------------------- // helper functions // ----------------------------------------------------------------------------