[poppler] poppler/GfxFont.cc poppler/GlobalParams.cc poppler/GlobalParams.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Mar 28 12:01:51 UTC 2022


 poppler/GfxFont.cc      |    8 ++++----
 poppler/GlobalParams.cc |    8 ++++----
 poppler/GlobalParams.h  |    2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 7d31fc4128f3e62ddeb1e9acb15a78ca7e10a82f
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Mar 27 22:29:14 2022 +0200

    One/Two more GooString to std::string

diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
index aec55cd6..e630cf06 100644
--- a/poppler/GfxFont.cc
+++ b/poppler/GfxFont.cc
@@ -686,7 +686,7 @@ std::optional<GfxFontLoc> GfxFont::locateFont(XRef *xref, PSOutputDev *ps)
     }
 
     //----- external font file (fontFile, fontDir)
-    if (name && (path = globalParams->findFontFile(name))) {
+    if (name && (path = globalParams->findFontFile(name->toStr()))) {
         if (std::optional<GfxFontLoc> fontLoc = getExternalFont(path, isCIDFont())) {
             return fontLoc;
         }
@@ -746,17 +746,17 @@ std::optional<GfxFontLoc> GfxFont::locateFont(XRef *xref, PSOutputDev *ps)
         if (isItalic()) {
             substIdx += 1;
         }
-        GooString substName(base14SubstFonts[substIdx]);
+        const std::string substName = base14SubstFonts[substIdx];
         if (ps) {
             error(errSyntaxWarning, -1, "Substituting font '{0:s}' for '{1:s}'", base14SubstFonts[substIdx], name ? name->c_str() : "null");
             GfxFontLoc fontLoc;
             fontLoc.locType = gfxFontLocResident;
             fontLoc.fontType = fontType1;
-            fontLoc.path = substName.toStr();
+            fontLoc.path = substName;
             fontLoc.substIdx = substIdx;
             return std::move(fontLoc); // std::move only required to please g++-7
         } else {
-            path = globalParams->findFontFile(&substName);
+            path = globalParams->findFontFile(substName);
             if (path) {
                 if (std::optional<GfxFontLoc> fontLoc = getExternalFont(path, false)) {
                     error(errSyntaxWarning, -1, "Substituting font '{0:s}' for '{1:s}'", base14SubstFonts[substIdx], name ? name->c_str() : "");
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index b758b829..36caf37a 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -875,13 +875,13 @@ static FcPattern *buildFcPattern(const GfxFont *font, const GooString *base14Nam
 }
 #endif
 
-GooString *GlobalParams::findFontFile(const GooString *fontName)
+GooString *GlobalParams::findFontFile(const std::string &fontName)
 {
     GooString *path = nullptr;
 
     setupBaseFonts(POPPLER_FONTSDIR);
     globalParamsLocker();
-    const auto fontFile = fontFiles.find(fontName->toStr());
+    const auto fontFile = fontFiles.find(fontName);
     if (fontFile != fontFiles.end()) {
         path = new GooString(fontFile->second);
     }
@@ -1073,12 +1073,12 @@ fin:
 
 GooString *GlobalParams::findBase14FontFile(const GooString *base14Name, const GfxFont *font)
 {
-    return findFontFile(base14Name);
+    return findFontFile(base14Name->toStr());
 }
 #else
 GooString *GlobalParams::findBase14FontFile(const GooString *base14Name, const GfxFont *font)
 {
-    return findFontFile(base14Name);
+    return findFontFile(base14Name->toStr());
 }
 
 static struct
diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index bbe759bf..967268ca 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -108,7 +108,7 @@ public:
     FILE *getUnicodeMapFile(const std::string &encodingName);
     FILE *findCMapFile(const GooString *collection, const GooString *cMapName);
     FILE *findToUnicodeFile(const GooString *name);
-    GooString *findFontFile(const GooString *fontName);
+    GooString *findFontFile(const std::string &fontName);
     GooString *findBase14FontFile(const GooString *base14Name, const GfxFont *font);
     GooString *findSystemFontFile(const GfxFont *font, SysFontType *type, int *fontNum, GooString *substituteFontName = nullptr, const GooString *base14Name = nullptr);
     std::string getTextEncodingName() const;


More information about the poppler mailing list