[Libreoffice-commits] core.git: vcl/generic

Caolán McNamara caolanm at redhat.com
Thu May 9 11:14:46 PDT 2013


 vcl/generic/glyphs/gcach_ftyp.cxx |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 7b91f87ab99f61ad41579c3ab72744b5fad31dd1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu May 9 19:13:29 2013 +0100

    no FT_Face_GetCharVariantIndex on RHEL-5, dlsym it
    
    Change-Id: Ie94e6d0acdfbb11801bc974b9ed37133df964245

diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx
index a839cc5..75564d1 100644
--- a/vcl/generic/glyphs/gcach_ftyp.cxx
+++ b/vcl/generic/glyphs/gcach_ftyp.cxx
@@ -132,6 +132,7 @@ static FT_Error (*pFTNewSize)(FT_Face,FT_Size*);
 static FT_Error (*pFTActivateSize)(FT_Size);
 static FT_Error (*pFTDoneSize)(FT_Size);
 void (*pFTEmbolden)(FT_GlyphSlot);
+static FT_UInt (*pFT_Face_GetCharVariantIndex)(FT_Face, FT_ULong, FT_ULong);
 static bool bEnableSizeFT = false;
 
 struct EqStr{ bool operator()(const char* a, const char* b) const { return !strcmp(a,b); } };
@@ -495,6 +496,7 @@ FreetypeManager::FreetypeManager()
     pFTActivateSize = FT_Activate_Size;
     pFTDoneSize = FT_Done_Size;
     pFTEmbolden = FT_GlyphSlot_Embolden;
+    pFT_Face_GetCharVariantIndex = FT_Face_GetCharVariantIndex;
     nFTVERSION = FTVERSION;
 #else
 #ifdef RTLD_DEFAULT // true if a good dlfcn.h header was included
@@ -511,6 +513,7 @@ FreetypeManager::FreetypeManager()
     pFTActivateSize = (FT_Error(*)(FT_Size))(sal_IntPtr)dlsym( RTLD_DEFAULT, "FT_Activate_Size" );
     pFTDoneSize     = (FT_Error(*)(FT_Size))(sal_IntPtr)dlsym( RTLD_DEFAULT, "FT_Done_Size" );
     pFTEmbolden     = (void(*)(FT_GlyphSlot))(sal_IntPtr)dlsym( RTLD_DEFAULT, "FT_GlyphSlot_Embolden" );
+    pFT_Face_GetCharVariantIndex = (FT_UInt(*)(FT_Face, FT_ULong, FT_ULong))(sal_IntPtr)dlsym( RTLD_DEFAULT, "FT_Face_GetCharVariantIndex" );
 
     bEnableSizeFT = (pFTNewSize!=NULL) && (pFTActivateSize!=NULL) && (pFTDoneSize!=NULL);
 
@@ -527,6 +530,10 @@ FreetypeManager::FreetypeManager()
     // disable artificial emboldening with the Freetype API for older versions
     if( nFTVERSION < 2110 )
         pFTEmbolden = NULL;
+    // disable FT_Face_GetCharVariantIndex for older versions
+    // https://bugzilla.mozilla.org/show_bug.cgi?id=618406#c8
+    if( nFTVERSION < 2404 )
+        pFT_Face_GetCharVariantIndex = NULL;
 
 #else // RTLD_DEFAULT
     // assume systems where dlsym is not possible use supplied library
@@ -1217,8 +1224,8 @@ int ServerFont::GetRawGlyphIndex(sal_UCS4 aChar, sal_UCS4 aVS) const
     int nGlyphIndex = 0;
     // 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)
-        nGlyphIndex = FT_Face_GetCharVariantIndex(maFaceFT, aChar, aVS);
+    if (aVS && pFT_Face_GetCharVariantIndex)
+        nGlyphIndex = (*pFT_Face_GetCharVariantIndex)(maFaceFT, aChar, aVS);
 
     if (nGlyphIndex == 0)
     {


More information about the Libreoffice-commits mailing list