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

Albert Astals Cid aacid at kemper.freedesktop.org
Thu Apr 5 14:05:22 UTC 2018


 poppler/Gfx.cc     |   13 +++++++++++--
 poppler/Gfx.h      |    5 ++++-
 poppler/GfxFont.cc |    2 +-
 poppler/GfxFont.h  |    2 +-
 4 files changed, 17 insertions(+), 5 deletions(-)

New commits:
commit b60de1700d95d022ec0d1676886b0442cb763473
Author: Albert Astals Cid <albert.astals.cid at kdab.com>
Date:   Thu Apr 5 16:03:54 2018 +0200

    Introduce a const version of GfxResources::lookupFont

diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index 4f6c33f8..14600732 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -375,9 +375,10 @@ GfxResources::~GfxResources() {
   delete fonts;
 }
 
-GfxFont *GfxResources::lookupFont(char *name) {
+GfxFont *GfxResources::doLookupFont(const char *name) const
+{
   GfxFont *font;
-  GfxResources *resPtr;
+  const GfxResources *resPtr;
 
   for (resPtr = this; resPtr; resPtr = resPtr->next) {
     if (resPtr->fonts) {
@@ -389,6 +390,14 @@ GfxFont *GfxResources::lookupFont(char *name) {
   return nullptr;
 }
 
+GfxFont *GfxResources::lookupFont(const char *name) {
+  return doLookupFont(name);
+}
+
+const GfxFont *GfxResources::lookupFont(const char *name) const {
+  return doLookupFont(name);
+}
+
 Object GfxResources::lookupXObject(char *name) {
   GfxResources *resPtr;
 
diff --git a/poppler/Gfx.h b/poppler/Gfx.h
index 8e2f66cc..fb24dbac 100644
--- a/poppler/Gfx.h
+++ b/poppler/Gfx.h
@@ -22,6 +22,7 @@
 // Copyright (C) 2010 David Benjamin <davidben at mit.edu>
 // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger at googlemail.com>
 // Copyright (C) 2013 Fabio D'Urso <fabiodurso at hotmail.it>
+// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info at kdab.com>. Work sponsored by the LiMux project of the city of Munich
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -115,7 +116,8 @@ public:
   GfxResources(const GfxResources &) = delete;
   GfxResources& operator=(const GfxResources &other) = delete;
 
-  GfxFont *lookupFont(char *name);
+  GfxFont *lookupFont(const char *name);
+  const GfxFont *lookupFont(const char *name) const;
   Object lookupXObject(char *name);
   Object lookupXObjectNF(char *name);
   Object lookupMarkedContentNF(char *name);
@@ -128,6 +130,7 @@ public:
   GfxResources *getNext() { return next; }
 
 private:
+  GfxFont *doLookupFont(const char *name) const;
 
   GfxFontDict *fonts;
   Object xObjDict;
diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
index 678510dc..02fee50c 100644
--- a/poppler/GfxFont.cc
+++ b/poppler/GfxFont.cc
@@ -2478,7 +2478,7 @@ GfxFontDict::~GfxFontDict() {
   gfree(fonts);
 }
 
-GfxFont *GfxFontDict::lookup(char *tag) {
+GfxFont *GfxFontDict::lookup(const char *tag) {
   int i;
 
   for (i = 0; i < numFonts; ++i) {
diff --git a/poppler/GfxFont.h b/poppler/GfxFont.h
index 4719de69..ef02892b 100644
--- a/poppler/GfxFont.h
+++ b/poppler/GfxFont.h
@@ -452,7 +452,7 @@ public:
   GfxFontDict& operator=(const GfxFontDict &) = delete;
 
   // Get the specified font.
-  GfxFont *lookup(char *tag);
+  GfxFont *lookup(const char *tag);
 
   // Iterative access.
   int getNumFonts() { return numFonts; }


More information about the poppler mailing list