diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2013-09-06 16:04:09 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-09-06 19:16:21 +0000 |
commit | e4a1acd396785675bfc25c7cd5c66304ec40f38f (patch) | |
tree | 0ffe8998efc17cba7dc6cab2e1ad9cd518a1da1b /vcl | |
parent | 1d223fa1ec3724b291a7d46de7e38e32c03c5235 (diff) |
Check for FT_Face_GetCharVariantIndex at build time
No more dlsym() hacks. The downside is that LibreOffice built on systems
with old FreeType will not be able to use FT_Face_GetCharVariantIndex()
on newer systems, but most Linux users use their distribution builds
anyway.
This only affects the use of Unicode Variation Selectors which is an
exotic feature that wasn't even supported on Linux before 4.1.
Change-Id: I674822ef5bc8d7940a821a01cc85ae7a6d39a80e
Reviewed-on: https://gerrit.libreoffice.org/5844
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/generic/glyphs/gcach_ftyp.cxx | 29 |
1 files changed, 7 insertions, 22 deletions
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) { |