Add fontconfig as dependency
pangocairo does not list fontconfig as a dependency.
This commit is contained in:
parent
19e0d0cda1
commit
4af8b9b265
22
configure.ac
22
configure.ac
@ -1103,6 +1103,26 @@ fi
|
||||
VIPS_CFLAGS="$VIPS_CFLAGS $PANGOCAIRO_CFLAGS"
|
||||
VIPS_LIBS="$VIPS_LIBS $PANGOCAIRO_LIBS"
|
||||
|
||||
# font file support with fontconfig
|
||||
AC_ARG_WITH([fontconfig],
|
||||
AS_HELP_STRING([--without-fontconfig],
|
||||
[build without fontconfig (default: test)]))
|
||||
|
||||
if test x"$with_pangocairo" != x"no" -a x"$with_fontconfig" != x"no"; then
|
||||
PKG_CHECK_MODULES(FONTCONFIG, fontconfig,
|
||||
[AC_DEFINE(HAVE_FONTCONFIG,1,[define if you have fontconfig installed.])
|
||||
with_fontconfig=yes
|
||||
PACKAGES_USED="$PACKAGES_USED fontconfig"
|
||||
],
|
||||
[AC_MSG_WARN([fontconfig not found; disabling fontconfig support])
|
||||
with_fontconfig=no
|
||||
]
|
||||
)
|
||||
fi
|
||||
|
||||
VIPS_CFLAGS="$VIPS_CFLAGS $FONTCONFIG_CFLAGS"
|
||||
VIPS_LIBS="$VIPS_LIBS $FONTCONFIG_LIBS"
|
||||
|
||||
# look for TIFF with pkg-config ... fall back to our tester
|
||||
# pkgconfig support for libtiff starts with libtiff-4
|
||||
AC_ARG_WITH([tiff],
|
||||
@ -1326,6 +1346,7 @@ accelerate loops with orc: $with_orc, \
|
||||
ICC profile support with lcms: $with_lcms, \
|
||||
zlib: $with_zlib, \
|
||||
text rendering with pangocairo: $with_pangocairo, \
|
||||
font file support with fontconfig: $with_fontconfig, \
|
||||
EXIF metadata support with libexif: $with_libexif, \
|
||||
JPEG load/save with libjpeg: $with_jpeg, \
|
||||
PNG load with libspng: $with_libspng, \
|
||||
@ -1428,6 +1449,7 @@ accelerate loops with orc: $with_orc
|
||||
ICC profile support with lcms: $with_lcms
|
||||
zlib: $with_zlib
|
||||
text rendering with pangocairo: $with_pangocairo
|
||||
font file support with fontconfig: $with_fontconfig
|
||||
EXIF metadata support with libexif: $with_libexif
|
||||
|
||||
## File format support
|
||||
|
@ -84,7 +84,10 @@
|
||||
#include <cairo.h>
|
||||
#include <pango/pango.h>
|
||||
#include <pango/pangocairo.h>
|
||||
|
||||
#ifdef HAVE_FONTCONFIG
|
||||
#include <fontconfig/fontconfig.h>
|
||||
#endif
|
||||
|
||||
#include "pcreate.h"
|
||||
|
||||
@ -123,10 +126,12 @@ static GMutex *vips_text_lock = NULL;
|
||||
*/
|
||||
static PangoFontMap *vips_text_fontmap = NULL;
|
||||
|
||||
#ifdef HAVE_FONTCONFIG
|
||||
/* All the fontfiles we've loaded. fontconfig lets you add a fontfile
|
||||
* repeatedly, and we obviously don't want that.
|
||||
*/
|
||||
static GHashTable *vips_text_fontfiles = NULL;
|
||||
#endif
|
||||
|
||||
static void
|
||||
vips_text_dispose( GObject *gobject )
|
||||
@ -365,13 +370,17 @@ vips_text_build( VipsObject *object )
|
||||
|
||||
if( !vips_text_fontmap )
|
||||
vips_text_fontmap = pango_cairo_font_map_new();
|
||||
|
||||
#ifdef HAVE_FONTCONFIG
|
||||
if( !vips_text_fontfiles )
|
||||
vips_text_fontfiles =
|
||||
g_hash_table_new( g_str_hash, g_str_equal );
|
||||
#endif
|
||||
|
||||
text->context = pango_font_map_create_context(
|
||||
PANGO_FONT_MAP( vips_text_fontmap ) );
|
||||
|
||||
#ifdef HAVE_FONTCONFIG
|
||||
if( text->fontfile &&
|
||||
!g_hash_table_lookup( vips_text_fontfiles, text->fontfile ) ) {
|
||||
if( !FcConfigAppFontAddFile( NULL,
|
||||
@ -386,6 +395,11 @@ vips_text_build( VipsObject *object )
|
||||
text->fontfile,
|
||||
g_strdup( text->fontfile ) );
|
||||
}
|
||||
#else
|
||||
if( text->fontfile )
|
||||
g_warning( "%s",
|
||||
_( "ignoring fontfile (no fontconfig support)" ) );
|
||||
#endif
|
||||
|
||||
/* If our caller set height and not dpi, we adjust dpi until
|
||||
* we get a fit.
|
||||
|
Loading…
Reference in New Issue
Block a user