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

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 22 20:51:14 UTC 2021


 poppler/GfxFont.cc |    6 ++----
 poppler/GfxFont.h  |   10 +++++-----
 2 files changed, 7 insertions(+), 9 deletions(-)

New commits:
commit dd373dcee45653390042107ed45a616b6234ea77
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Oct 22 22:25:24 2021 +0200

    Some const changes in GfxFont & friends

diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
index 6218f5f5..b3f2b382 100644
--- a/poppler/GfxFont.cc
+++ b/poppler/GfxFont.cc
@@ -220,12 +220,10 @@ GfxFont *GfxFont::makeFont(XRef *xref, const char *tagA, Ref idA, Dict *fontDict
     return font;
 }
 
-GfxFont::GfxFont(const char *tagA, Ref idA, const GooString *nameA, GfxFontType typeA, Ref embFontIDA) : tag(tagA)
+GfxFont::GfxFont(const char *tagA, Ref idA, const GooString *nameA, GfxFontType typeA, Ref embFontIDA) : tag(tagA), id(idA), type(typeA)
 {
     ok = false;
-    id = idA;
     name = nameA;
-    type = typeA;
     embFontID = embFontIDA;
     embFontName = nullptr;
     family = nullptr;
@@ -2412,7 +2410,7 @@ GfxFontDict::~GfxFontDict()
     gfree(fonts);
 }
 
-GfxFont *GfxFontDict::lookup(const char *tag)
+GfxFont *GfxFontDict::lookup(const char *tag) const
 {
     int i;
 
diff --git a/poppler/GfxFont.h b/poppler/GfxFont.h
index add7f05e..9eadb879 100644
--- a/poppler/GfxFont.h
+++ b/poppler/GfxFont.h
@@ -310,12 +310,12 @@ protected:
     static GfxFontLoc *getExternalFont(GooString *path, bool cid);
 
     const std::string tag; // PDF font tag
-    Ref id; // reference (used as unique ID)
+    const Ref id; // reference (used as unique ID)
     const GooString *name; // font name
     GooString *family; // font family
     Stretch stretch; // font stretch
     Weight weight; // font weight
-    GfxFontType type; // type of font
+    const GfxFontType type; // type of font
     int flags; // font descriptor flags
     GooString *embFontName; // name of embedded font
     Ref embFontID; // ref to embedded font file stream
@@ -455,11 +455,11 @@ public:
     GfxFontDict &operator=(const GfxFontDict &) = delete;
 
     // Get the specified font.
-    GfxFont *lookup(const char *tag);
+    GfxFont *lookup(const char *tag) const;
 
     // Iterative access.
-    int getNumFonts() { return numFonts; }
-    GfxFont *getFont(int i) { return fonts[i]; }
+    int getNumFonts() const { return numFonts; }
+    GfxFont *getFont(int i) const { return fonts[i]; }
 
 private:
     int hashFontObject(Object *obj);


More information about the poppler mailing list