summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config_host/config_features.h.in4
-rw-r--r--configure.ac8
-rw-r--r--vcl/generic/glyphs/gcach_ftyp.cxx29
3 files changed, 19 insertions, 22 deletions
diff --git a/config_host/config_features.h.in b/config_host/config_features.h.in
index 1c42ff014a12..100706ac9098 100644
--- a/config_host/config_features.h.in
+++ b/config_host/config_features.h.in
@@ -116,5 +116,9 @@
#define HAVE_FEATURE_READONLY_INSTALLSET 0
+/*
+ * Whether FreeType has FT_Face_GetCharVariantIndex or not.
+ */
+#define HAVE_FT_FACE_GETCHARVARIANTINDEX 0
#endif
diff --git a/configure.ac b/configure.ac
index 2f20dd1de6a8..22807cb08aae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -608,6 +608,7 @@ linux-android*)
AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
fi
+ AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
;;
@@ -7686,6 +7687,13 @@ if test "$test_freetype" = "yes"; then
PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
SYSTEM_FREETYPE=YES
+ _save_libs="$LIBS"
+ _save_cflags="$CFLAGS"
+ LIBS="$LIBS $FREETYPE_LIBS"
+ CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
+ AC_CHECK_FUNC(FT_Face_GetCharVariantIndex, AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX), [])
+ LIBS="$_save_libs"
+ CFLAGS="$_save_cflags"
fi
AC_SUBST(FREETYPE_CFLAGS)
AC_SUBST(FREETYPE_LIBS)
diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx
index df56d1b03ef6..ff0a428122e0 100644
--- a/vcl/generic/glyphs/gcach_ftyp.cxx
+++ b/vcl/generic/glyphs/gcach_ftyp.cxx
@@ -28,6 +28,7 @@
#include "vcl/svapp.hxx"
#include <outfont.hxx>
#include <impfont.hxx>
+#include <config_features.h>
#include <config_graphite.h>
#if ENABLE_GRAPHITE
#include <graphite2/Font.h>
@@ -67,8 +68,6 @@ typedef const FT_Vector* FT_Vector_CPtr;
// TODO: move file mapping stuff to OSL
#if defined(UNX)
- // PORTERS: dlfcn is used for getting symbols from FT versions newer than baseline
- #include <dlfcn.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
@@ -115,7 +114,6 @@ static FT_Library aLibFT = 0;
// enable linking with old FT versions
static int nFTVERSION = 0;
-static FT_UInt (*pFT_Face_GetCharVariantIndex)(FT_Face, FT_ULong, FT_ULong);
typedef ::boost::unordered_map<const char*, boost::shared_ptr<FtFontFile>, rtl::CStringHash, rtl::CStringEqual> FontFileList;
@@ -468,23 +466,6 @@ FreetypeManager::FreetypeManager()
FT_Library_Version(aLibFT, &nMajor, &nMinor, &nPatch);
nFTVERSION = nMajor * 1000 + nMinor * 100 + nPatch;
-#ifdef ANDROID
- // For Android we use the bundled static libfreetype.a, and we
- // want to avoid accidentally finding the FT_* symbols in the
- // system FreeType code (which *is* present in a system library,
- // libskia.so, but is not a public API, and in fact does crash the
- // app if used).
- pFT_Face_GetCharVariantIndex = FT_Face_GetCharVariantIndex;
-#else
-#ifdef RTLD_DEFAULT // true if a good dlfcn.h header was included
- pFT_Face_GetCharVariantIndex = (FT_UInt(*)(FT_Face, FT_ULong, FT_ULong))(sal_IntPtr)dlsym( RTLD_DEFAULT, "FT_Face_GetCharVariantIndex" );
-
- // disable FT_Face_GetCharVariantIndex for older versions
- // https://bugzilla.mozilla.org/show_bug.cgi?id=618406#c8
- if( nFTVERSION < 2404 )
- pFT_Face_GetCharVariantIndex = NULL;
-#endif
-#endif
// TODO: remove when the priorities are selected by UI
char* pEnv;
pEnv = ::getenv( "SAL_EMBEDDED_BITMAP_PRIORITY" );
@@ -1110,10 +1091,14 @@ int ServerFont::GetRawGlyphIndex(sal_UCS4 aChar, sal_UCS4 aVS) const
}
int nGlyphIndex = 0;
+#if HAVE_FT_FACE_GETCHARVARIANTINDEX
// If asked, check first for variant glyph with the given Unicode variation
// selector. This is quite uncommon so we don't bother with caching here.
- if (aVS && pFT_Face_GetCharVariantIndex)
- nGlyphIndex = (*pFT_Face_GetCharVariantIndex)(maFaceFT, aChar, aVS);
+ // Disabled for buggy FreeType versions:
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=618406#c8
+ if (aVS && nFTVERSION >= 2404)
+ nGlyphIndex = FT_Face_GetCharVariantIndex(maFaceFT, aChar, aVS);
+#endif
if (nGlyphIndex == 0)
{