[poppler] CMakeLists.txt splash/SplashFTFontEngine.cc splash/SplashFTFontEngine.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Mar 9 17:05:36 UTC 2022


 CMakeLists.txt               |    3 +-
 splash/SplashFTFontEngine.cc |   62 +------------------------------------------
 splash/SplashFTFontEngine.h  |    1 
 3 files changed, 4 insertions(+), 62 deletions(-)

New commits:
commit a736a7f3dc480691bf5425dc6a118773593e1b03
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed Mar 9 17:58:35 2022 +0100

    Require the min freetype of our minimum linux base
    
    Simplifies SplashFTFontEngine a bit

diff --git a/CMakeLists.txt b/CMakeLists.txt
index cd0b502e..76513eb6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -140,8 +140,9 @@ set(CAIRO_VERSION "1.10.0")
 set(GLIB_REQUIRED "2.56")
 set(GTK_REQUIRED "3.22")
 set(GDK_PIXBUF_REQUIRED "2.36")
+set(FREETYPE_VERSION "2.8")
 
-find_package(Freetype REQUIRED)
+find_package(Freetype ${FREETYPE_VERSION} REQUIRED)
 if(WITH_FONTCONFIGURATION_FONTCONFIG)
   find_package(Fontconfig REQUIRED)
 endif()
diff --git a/splash/SplashFTFontEngine.cc b/splash/SplashFTFontEngine.cc
index bbfe66f6..f9520b29 100644
--- a/splash/SplashFTFontEngine.cc
+++ b/splash/SplashFTFontEngine.cc
@@ -43,16 +43,10 @@
 
 SplashFTFontEngine::SplashFTFontEngine(bool aaA, bool enableFreeTypeHintingA, bool enableSlightHintingA, FT_Library libA)
 {
-    FT_Int major, minor, patch;
-
     aa = aaA;
     enableFreeTypeHinting = enableFreeTypeHintingA;
     enableSlightHinting = enableSlightHintingA;
     lib = libA;
-
-    // as of FT 2.1.8, CID fonts are indexed by CID instead of GID
-    FT_Library_Version(lib, &major, &minor, &patch);
-    useCIDs = major > 2 || (major == 2 && (minor > 1 || (minor == 1 && patch > 7)));
 }
 
 SplashFTFontEngine *SplashFTFontEngine::init(bool aaA, bool enableFreeTypeHintingA, bool enableSlightHintingA)
@@ -87,64 +81,12 @@ SplashFontFile *SplashFTFontEngine::loadOpenTypeT1CFont(SplashFontFileID *idA, S
 
 SplashFontFile *SplashFTFontEngine::loadCIDFont(SplashFontFileID *idA, SplashFontSrc *src)
 {
-    FoFiType1C *ff;
-    int *cidToGIDMap;
-    int nCIDs;
-    SplashFontFile *ret;
-
-    // check for a CFF font
-    if (useCIDs) {
-        cidToGIDMap = nullptr;
-        nCIDs = 0;
-    } else {
-        if (src->isFile) {
-            ff = FoFiType1C::load(src->fileName->c_str());
-        } else {
-            ff = FoFiType1C::make(src->buf, src->bufLen);
-        }
-        if (ff) {
-            cidToGIDMap = ff->getCIDToGIDMap(&nCIDs);
-            delete ff;
-        } else {
-            cidToGIDMap = nullptr;
-            nCIDs = 0;
-        }
-    }
-    ret = SplashFTFontFile::loadCIDFont(this, idA, src, cidToGIDMap, nCIDs);
-    if (!ret) {
-        gfree(cidToGIDMap);
-    }
-    return ret;
+    return SplashFTFontFile::loadCIDFont(this, idA, src, nullptr, 0);
 }
 
 SplashFontFile *SplashFTFontEngine::loadOpenTypeCFFFont(SplashFontFileID *idA, SplashFontSrc *src, int *codeToGID, int codeToGIDLen)
 {
-    int *cidToGIDMap;
-    int nCIDs;
-    SplashFontFile *ret;
-
-    cidToGIDMap = nullptr;
-    nCIDs = 0;
-    if (!codeToGID) {
-        if (!useCIDs) {
-            std::unique_ptr<FoFiTrueType> ff;
-            if (src->isFile) {
-                ff = FoFiTrueType::load(src->fileName->c_str());
-            } else {
-                ff = FoFiTrueType::make(src->buf, src->bufLen);
-            }
-            if (ff) {
-                if (ff->isOpenTypeCFF()) {
-                    cidToGIDMap = ff->getCIDToGIDMap(&nCIDs);
-                }
-            }
-        }
-    }
-    ret = SplashFTFontFile::loadCIDFont(this, idA, src, codeToGID ? codeToGID : cidToGIDMap, codeToGID ? codeToGIDLen : nCIDs);
-    if (!ret) {
-        gfree(cidToGIDMap);
-    }
-    return ret;
+    return SplashFTFontFile::loadCIDFont(this, idA, src, codeToGID ? codeToGID : nullptr, codeToGID ? codeToGIDLen : 0);
 }
 
 SplashFontFile *SplashFTFontEngine::loadTrueTypeFont(SplashFontFileID *idA, SplashFontSrc *src, int *codeToGID, int codeToGIDLen, int faceIndex)
diff --git a/splash/SplashFTFontEngine.h b/splash/SplashFTFontEngine.h
index 32e670c6..28aa8fac 100644
--- a/splash/SplashFTFontEngine.h
+++ b/splash/SplashFTFontEngine.h
@@ -64,7 +64,6 @@ private:
     bool enableFreeTypeHinting;
     bool enableSlightHinting;
     FT_Library lib;
-    bool useCIDs;
 
     friend class SplashFTFontFile;
     friend class SplashFTFont;


More information about the poppler mailing list