Add wxUSE_PRIVATE_FONTS and drop wxHAS_PRIVATE_FONTS

Handle this feature as all the other ones and provide a configure switch
and a setup.h option to disable it if necessary, as it may be desirable
to do it, especially under Linux, to avoid extra dependency on pangoft2
if this functionality is unnecessary.
This commit is contained in:
Vadim Zeitlin 2017-11-14 15:24:15 +01:00
parent a98c51e6bc
commit b040dab0ca
25 changed files with 213 additions and 95 deletions

52
configure vendored
View File

@ -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

View File

@ -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])

View File

@ -188,7 +188,6 @@ Currently the following symbols exist:
@itemdef{wxHAS_IMAGES_IN_RESOURCES, Defined if <a href="http://en.wikipedia.org/wiki/Resource_(Windows)">
Windows resource files</a> 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.}

View File

@ -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.}

View File

@ -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.
//

View File

@ -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

View File

@ -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;

View File

@ -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_

View File

@ -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.
//

View File

@ -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.
//

View File

@ -169,6 +169,4 @@ private:
wxDECLARE_DYNAMIC_CLASS(wxFont);
};
#define wxHAS_PRIVATE_FONTS 1
#endif // _WX_FONT_H_

View File

@ -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.
//

View File

@ -167,6 +167,4 @@ private:
wxDECLARE_DYNAMIC_CLASS(wxFont);
};
#define wxHAS_PRIVATE_FONTS 1
#endif // _WX_FONT_H_

View File

@ -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.
//

View File

@ -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.
//

View File

@ -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.
//

View File

@ -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.

View File

@ -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...

View File

@ -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+
*/

View File

@ -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+
*/

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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
// ----------------------------------------------------------------------------