Check for pangoft2 >= 1.38 in configure too
We need to use PKG_CHECK_MODULES(pangoft2) anyhow because we need to link with its libraries, so make the version check there too and simplify wxFont::AddPrivateFont() implementation in wxGTK.
This commit is contained in:
58
configure
vendored
58
configure
vendored
@@ -978,8 +978,8 @@ X_CFLAGS
|
||||
XMKMF
|
||||
DIRECTFB_LIBS
|
||||
DIRECTFB_CFLAGS
|
||||
FONTCONFIG_LIBS
|
||||
FONTCONFIG_CFLAGS
|
||||
PRIVATE_FONTS_LIBS
|
||||
PRIVATE_FONTS_CFLAGS
|
||||
GTK_CONFIG
|
||||
GTK_LIBS
|
||||
GTK_CFLAGS
|
||||
@@ -1368,8 +1368,8 @@ CXX
|
||||
CXXFLAGS
|
||||
CCC
|
||||
PKG_CONFIG
|
||||
FONTCONFIG_CFLAGS
|
||||
FONTCONFIG_LIBS
|
||||
PRIVATE_FONTS_CFLAGS
|
||||
PRIVATE_FONTS_LIBS
|
||||
DIRECTFB_CFLAGS
|
||||
DIRECTFB_LIBS
|
||||
XMKMF
|
||||
@@ -2352,10 +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
|
||||
PRIVATE_FONTS_CFLAGS
|
||||
C compiler flags for PRIVATE_FONTS, overriding pkg-config
|
||||
PRIVATE_FONTS_LIBS
|
||||
linker flags for PRIVATE_FONTS, overriding pkg-config
|
||||
DIRECTFB_CFLAGS
|
||||
C compiler flags for DIRECTFB, overriding pkg-config
|
||||
DIRECTFB_LIBS
|
||||
@@ -22482,20 +22482,20 @@ $as_echo "not found" >&6; }
|
||||
|
||||
|
||||
pkg_failed=no
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FONTCONFIG" >&5
|
||||
$as_echo_n "checking for FONTCONFIG... " >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PRIVATE_FONTS" >&5
|
||||
$as_echo_n "checking for PRIVATE_FONTS... " >&6; }
|
||||
|
||||
if test -n "$PKG_CONFIG"; then
|
||||
if test -n "$FONTCONFIG_CFLAGS"; then
|
||||
pkg_cv_FONTCONFIG_CFLAGS="$FONTCONFIG_CFLAGS"
|
||||
if test -n "$PRIVATE_FONTS_CFLAGS"; then
|
||||
pkg_cv_PRIVATE_FONTS_CFLAGS="$PRIVATE_FONTS_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
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fontconfig >= 2.8.0 pangoft2 >= 1.38.0\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "fontconfig >= 2.8.0 pangoft2 >= 1.38.0") 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`
|
||||
pkg_cv_PRIVATE_FONTS_CFLAGS=`$PKG_CONFIG --cflags "fontconfig >= 2.8.0 pangoft2 >= 1.38.0" 2>/dev/null`
|
||||
else
|
||||
pkg_failed=yes
|
||||
fi
|
||||
@@ -22504,16 +22504,16 @@ else
|
||||
pkg_failed=untried
|
||||
fi
|
||||
if test -n "$PKG_CONFIG"; then
|
||||
if test -n "$FONTCONFIG_LIBS"; then
|
||||
pkg_cv_FONTCONFIG_LIBS="$FONTCONFIG_LIBS"
|
||||
if test -n "$PRIVATE_FONTS_LIBS"; then
|
||||
pkg_cv_PRIVATE_FONTS_LIBS="$PRIVATE_FONTS_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
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fontconfig >= 2.8.0 pangoft2 >= 1.38.0\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "fontconfig >= 2.8.0 pangoft2 >= 1.38.0") 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`
|
||||
pkg_cv_PRIVATE_FONTS_LIBS=`$PKG_CONFIG --libs "fontconfig >= 2.8.0 pangoft2 >= 1.38.0" 2>/dev/null`
|
||||
else
|
||||
pkg_failed=yes
|
||||
fi
|
||||
@@ -22532,21 +22532,21 @@ 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"`
|
||||
PRIVATE_FONTS_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "fontconfig >= 2.8.0 pangoft2 >= 1.38.0"`
|
||||
else
|
||||
FONTCONFIG_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fontconfig"`
|
||||
PRIVATE_FONTS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fontconfig >= 2.8.0 pangoft2 >= 1.38.0"`
|
||||
fi
|
||||
# Put the nasty error message in config.log where it belongs
|
||||
echo "$FONTCONFIG_PKG_ERRORS" >&5
|
||||
echo "$PRIVATE_FONTS_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;}
|
||||
{ $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;}
|
||||
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;}
|
||||
{ $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;}
|
||||
else
|
||||
FONTCONFIG_CFLAGS=$pkg_cv_FONTCONFIG_CFLAGS
|
||||
FONTCONFIG_LIBS=$pkg_cv_FONTCONFIG_LIBS
|
||||
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; }
|
||||
|
||||
|
@@ -2963,7 +2963,7 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
|
||||
dnl fi
|
||||
fi
|
||||
|
||||
PKG_CHECK_MODULES(FONTCONFIG, [fontconfig >= 2.8.0],
|
||||
PKG_CHECK_MODULES(PRIVATE_FONTS, [fontconfig >= 2.8.0 pangoft2 >= 1.38.0],
|
||||
[
|
||||
AC_DEFINE(wxHAVE_FONTCONFIG_2_8_0)
|
||||
CXXFLAGS="$FONTCONFIG_CFLAGS $CXXFLAGS"
|
||||
|
@@ -601,61 +601,52 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxFcConfigDestroyModule, wxModule);
|
||||
|
||||
bool wxFontBase::AddPrivateFont(const wxString& filename)
|
||||
{
|
||||
wxString why;
|
||||
|
||||
// All this code only works if we have pango_context_get_font_map() which
|
||||
// is new in 1.38, so don't bother compiling -- or running -- it if this is
|
||||
// not the case.
|
||||
#if PANGO_VERSION_CHECK(1,38,0)
|
||||
if ( wx_pango_version_check(1,38,0) == NULL )
|
||||
// We already checked that we have the required functions at compile-time,
|
||||
// but we should also check if they're available at run-time in case we use
|
||||
// older versions of them than the ones we were compiled with.
|
||||
if ( wx_pango_version_check(1,38,0) != NULL )
|
||||
{
|
||||
wxLogError(_("Using private fonts is not supported on this system: "
|
||||
"Pango library is too old, 1.38 or later required."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !gs_fcConfig )
|
||||
{
|
||||
gs_fcConfig = FcInitLoadConfigAndFonts();
|
||||
if ( !gs_fcConfig )
|
||||
{
|
||||
gs_fcConfig = FcInitLoadConfigAndFonts();
|
||||
if ( !gs_fcConfig )
|
||||
{
|
||||
wxLogError(_("Failed to create font configuration object."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !FcConfigAppFontAddFile(gs_fcConfig,
|
||||
reinterpret_cast<const FcChar8*>(
|
||||
static_cast<const char*>(filename.utf8_str())
|
||||
)) )
|
||||
{
|
||||
wxLogError(_("Failed to add custom font \"%s\"."), filename);
|
||||
wxLogError(_("Failed to create font configuration object."));
|
||||
return false;
|
||||
}
|
||||
|
||||
wxGtkObject<PangoContext> context(wxGetPangoContext());
|
||||
PangoFontMap* const fmap = pango_context_get_font_map(context);
|
||||
if ( !fmap || !PANGO_IS_FC_FONT_MAP(fmap) )
|
||||
{
|
||||
wxLogError(_("Failed to register font configuration using private fonts."));
|
||||
return false;
|
||||
}
|
||||
|
||||
PangoFcFontMap* const fcfmap = PANGO_FC_FONT_MAP(fmap);
|
||||
pango_fc_font_map_set_config(fcfmap, gs_fcConfig);
|
||||
|
||||
// Ensure that the face names defined by private fonts are recognized by
|
||||
// our SetFaceName() which uses wxFontEnumerator to check if the name is in
|
||||
// the list of available faces.
|
||||
wxFontEnumerator::InvalidateCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
if ( !FcConfigAppFontAddFile(gs_fcConfig,
|
||||
reinterpret_cast<const FcChar8*>(
|
||||
static_cast<const char*>(filename.utf8_str())
|
||||
)) )
|
||||
{
|
||||
why = _("system Pango library is too old, 1.38 or later required");
|
||||
wxLogError(_("Failed to add custom font \"%s\"."), filename);
|
||||
return false;
|
||||
}
|
||||
#else // Pango < 1.38
|
||||
why = _("this application was compiled with too old Pango library version");
|
||||
#endif // Pango 1.38+/1.38-
|
||||
|
||||
wxLogError(_("Using private fonts is not supported: %s."), why);
|
||||
return false;
|
||||
wxGtkObject<PangoContext> context(wxGetPangoContext());
|
||||
PangoFontMap* const fmap = pango_context_get_font_map(context);
|
||||
if ( !fmap || !PANGO_IS_FC_FONT_MAP(fmap) )
|
||||
{
|
||||
wxLogError(_("Failed to register font configuration using private fonts."));
|
||||
return false;
|
||||
}
|
||||
|
||||
PangoFcFontMap* const fcfmap = PANGO_FC_FONT_MAP(fmap);
|
||||
pango_fc_font_map_set_config(fcfmap, gs_fcConfig);
|
||||
|
||||
// Ensure that the face names defined by private fonts are recognized by
|
||||
// our SetFaceName() which uses wxFontEnumerator to check if the name is in
|
||||
// the list of available faces.
|
||||
wxFontEnumerator::InvalidateCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // wxHAS_PRIVATE_FONTS
|
||||
|
Reference in New Issue
Block a user