[Libreoffice-commits] core.git: 2 commits - vcl/inc vcl/unx

Khaled Hosny (via logerrit) logerrit at kemper.freedesktop.org
Thu Sep 5 17:25:02 UTC 2019


 vcl/inc/unx/freetype_glyphcache.hxx            |    1 
 vcl/unx/generic/glyphs/freetype_glyphcache.cxx |   59 ++-----------------------
 2 files changed, 5 insertions(+), 55 deletions(-)

New commits:
commit 467387ed2f4f226b580da7a674c2ed88365c976a
Author:     Khaled Hosny <khaledhosny at eglug.org>
AuthorDate: Wed Aug 28 12:50:22 2019 +0200
Commit:     Khaled Hosny <khaledhosny at eglug.org>
CommitDate: Thu Sep 5 19:24:10 2019 +0200

    Merge GetFontCodeRanges() into GetFontCharMap()
    
    Change-Id: I61d8edf0be492c1c06274c11ac5d2e65415525a9
    Reviewed-on: https://gerrit.libreoffice.org/78638
    Tested-by: Jenkins
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>

diff --git a/vcl/inc/unx/freetype_glyphcache.hxx b/vcl/inc/unx/freetype_glyphcache.hxx
index 6fd0154d98a7..17084fcf5a75 100644
--- a/vcl/inc/unx/freetype_glyphcache.hxx
+++ b/vcl/inc/unx/freetype_glyphcache.hxx
@@ -75,7 +75,6 @@ public:
 
     void                  AnnounceFont( PhysicalFontCollection* );
 
-    bool                  GetFontCodeRanges( CmapResult& ) const;
     const FontCharMapRef& GetFontCharMap();
 
 private:
diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
index ed473e9c198a..d58c5bedc097 100644
--- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
@@ -704,8 +704,11 @@ const FontCharMapRef& FreetypeFontInfo::GetFontCharMap()
 
     // get the charmap and cache it
     CmapResult aCmapResult;
-    bool bOK = GetFontCodeRanges( aCmapResult );
-    if( bOK )
+    aCmapResult.mbSymbolic = IsSymbolFont();
+
+    sal_uLong nLength = 0;
+    const unsigned char* pCmap = GetTable("cmap", &nLength);
+    if (pCmap && (nLength > 0) && ParseCMAP(pCmap, nLength, aCmapResult))
     {
         FontCharMapRef xFontCharMap( new FontCharMap ( aCmapResult ) );
         mxFontCharMap = xFontCharMap;
@@ -719,19 +722,6 @@ const FontCharMapRef& FreetypeFontInfo::GetFontCharMap()
     return mxFontCharMap;
 }
 
-// TODO: merge into method GetFontCharMap()
-bool FreetypeFontInfo::GetFontCodeRanges( CmapResult& rResult ) const
-{
-    rResult.mbSymbolic = IsSymbolFont();
-
-    sal_uLong nLength = 0;
-    const unsigned char* pCmap = GetTable( "cmap", &nLength );
-    if( pCmap && (nLength > 0) )
-        if( ParseCMAP( pCmap, nLength, rResult ) )
-            return true;
-    return false;
-}
-
 bool FreetypeFont::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const
 {
     bool bRet = false;
commit fc0119d0afb7775663762d972b6d5dbc15581c66
Author:     Khaled Hosny <khaledhosny at eglug.org>
AuthorDate: Wed Aug 28 12:46:19 2019 +0200
Commit:     Khaled Hosny <khaledhosny at eglug.org>
CommitDate: Thu Sep 5 19:24:01 2019 +0200

    Remove effectively dead code
    
    We dropped support for non-SFNT fonts for a while now.
    
    Change-Id: Iaa2ea308effa7328bd84240cf29fc3fd117d418a
    Reviewed-on: https://gerrit.libreoffice.org/78637
    Tested-by: Jenkins
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>

diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
index 525da6e52b43..ed473e9c198a 100644
--- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
@@ -465,9 +465,6 @@ FreetypeFont::FreetypeFont(LogicalFontInstance* pFontInstance, FreetypeFontInfo*
     if( mpFontInfo->IsSymbolFont() )
     {
         FT_Encoding eEncoding = FT_ENCODING_MS_SYMBOL;
-        if (!FT_IS_SFNT(maFaceFT))
-            eEncoding = FT_ENCODING_ADOBE_CUSTOM; // freetype wants this for PS symbol fonts
-
         FT_Select_Charmap(maFaceFT, eEncoding);
     }
 
@@ -727,48 +724,12 @@ bool FreetypeFontInfo::GetFontCodeRanges( CmapResult& rResult ) const
 {
     rResult.mbSymbolic = IsSymbolFont();
 
-    // TODO: is the full CmapResult needed on platforms calling this?
-    if( FT_IS_SFNT( maFaceFT ) )
-    {
-        sal_uLong nLength = 0;
-        const unsigned char* pCmap = GetTable( "cmap", &nLength );
-        if( pCmap && (nLength > 0) )
-            if( ParseCMAP( pCmap, nLength, rResult ) )
-                return true;
-    }
-
-    std::vector<sal_uInt32> aCodes;
-
-    // FT's coverage is available since FT>=2.1.0 (OOo-baseline>=2.1.4 => ok)
-    aCodes.reserve( 0x1000 );
-    FT_UInt nGlyphIndex;
-    for( sal_uInt32 cCode = FT_Get_First_Char( maFaceFT, &nGlyphIndex );; )
-    {
-        if( !nGlyphIndex )
-            break;
-        aCodes.push_back( cCode );  // first code inside range
-        sal_uInt32 cNext;
-        do cNext = FT_Get_Next_Char( maFaceFT, cCode, &nGlyphIndex ); while( cNext == ++cCode );
-        aCodes.push_back( cCode );  // first code outside range
-        cCode = cNext;
-    }
-
-    const int nCount = aCodes.size();
-    if( !nCount) {
-        if( !rResult.mbSymbolic )
-            return false;
-
-        // we usually get here for Type1 symbol fonts
-        aCodes.push_back( 0xF020 );
-        aCodes.push_back( 0xF100 );
-    }
-
-    sal_uInt32* pCodes = new sal_uInt32[ nCount ];
-    for( int i = 0; i < nCount; ++i )
-        pCodes[i] = aCodes[i];
-    rResult.mpRangeCodes = pCodes;
-    rResult.mnRangeCount = nCount / 2;
-    return true;
+    sal_uLong nLength = 0;
+    const unsigned char* pCmap = GetTable( "cmap", &nLength );
+    if( pCmap && (nLength > 0) )
+        if( ParseCMAP( pCmap, nLength, rResult ) )
+            return true;
+    return false;
 }
 
 bool FreetypeFont::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const


More information about the Libreoffice-commits mailing list