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

Albert Astals Cid aacid at kemper.freedesktop.org
Thu Apr 5 10:49:04 UTC 2018


 poppler/GfxFont.cc |    8 ++++----
 poppler/GfxFont.h  |   16 ++++++++--------
 2 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 4f9b3d8d8d17863873a8a399ff3fe212d247b236
Author: Albert Astals Cid <albert.astals.cid at kdab.com>
Date:   Thu Apr 5 12:37:40 2018 +0200

    Make some GfxFont methods const

diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
index 2a1aa8ad..678510dc 100644
--- a/poppler/GfxFont.cc
+++ b/poppler/GfxFont.cc
@@ -1556,7 +1556,7 @@ static int parseCharName(char *charName, Unicode *uBuf, int uLen,
 
 int Gfx8BitFont::getNextChar(char *s, int len, CharCode *code,
 			     Unicode **u, int *uLen,
-			     double *dx, double *dy, double *ox, double *oy) {
+			     double *dx, double *dy, double *ox, double *oy) const {
   CharCode c;
 
   *code = c = (CharCode)(*s & 0xff);
@@ -2053,7 +2053,7 @@ GfxCIDFont::~GfxCIDFont() {
 
 int GfxCIDFont::getNextChar(char *s, int len, CharCode *code,
 			    Unicode **u, int *uLen,
-			    double *dx, double *dy, double *ox, double *oy) {
+			    double *dx, double *dy, double *ox, double *oy) const {
   CID cid;
   CharCode dummy;
   double w, h, vx, vy;
@@ -2391,7 +2391,7 @@ int *GfxCIDFont::getCodeToGIDMap(FoFiTrueType *ff, int *mapsizep) {
   return codeToGID;
 }
 
-double GfxCIDFont::getWidth(CID cid) {
+double GfxCIDFont::getWidth(CID cid) const {
   double w;
   int a, b, m;
 
@@ -2415,7 +2415,7 @@ double GfxCIDFont::getWidth(CID cid) {
   return w;
 }
 
-double GfxCIDFont::getWidth (char* s, int len) {
+double GfxCIDFont::getWidth (char* s, int len) const {
   int nUsed;
   CharCode c;
 
diff --git a/poppler/GfxFont.h b/poppler/GfxFont.h
index 1d82ecbf..b3ad420c 100644
--- a/poppler/GfxFont.h
+++ b/poppler/GfxFont.h
@@ -190,7 +190,7 @@ public:
   void decRefCnt();
 
   // Get font tag.
-  GooString *getTag() { return tag; }
+  const GooString *getTag() const { return tag; }
 
   // Get font dictionary ID.
   Ref *getID() { return &id; }
@@ -213,7 +213,7 @@ public:
 
   // Get font type.
   GfxFontType getType() { return type; }
-  virtual GBool isCIDFont() { return gFalse; }
+  virtual GBool isCIDFont() const { return gFalse; }
 
   // Get embedded font ID, i.e., a ref for the font file stream.
   // Returns false if there is no embedded font.
@@ -276,7 +276,7 @@ public:
   // the char code.
   virtual int getNextChar(char *s, int len, CharCode *code,
 			  Unicode **u, int *uLen,
-			  double *dx, double *dy, double *ox, double *oy) = 0;
+			  double *dx, double *dy, double *ox, double *oy) const = 0;
 
   // Does this font have a toUnicode map?
   GBool hasToUnicodeCMap() { return hasToUnicode; }
@@ -332,7 +332,7 @@ public:
 
   int getNextChar(char *s, int len, CharCode *code,
 			  Unicode **u, int *uLen,
-			  double *dx, double *dy, double *ox, double *oy) override;
+			  double *dx, double *dy, double *ox, double *oy) const override;
 
   // Return the encoding.
   char **getEncoding() { return enc; }
@@ -393,11 +393,11 @@ public:
   GfxCIDFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA,
 	     GfxFontType typeA, Ref embFontIDA, Dict *fontDict);
 
-  GBool isCIDFont() override { return gTrue; }
+  GBool isCIDFont() const override { return gTrue; }
 
   int getNextChar(char *s, int len, CharCode *code,
 			  Unicode **u, int *uLen,
-			  double *dx, double *dy, double *ox, double *oy) override;
+			  double *dx, double *dy, double *ox, double *oy) const override;
 
   // Return the writing mode (0=horizontal, 1=vertical).
   int getWMode() override;
@@ -415,14 +415,14 @@ public:
 
   int *getCodeToGIDMap(FoFiTrueType *ff, int *length);
 
-  double getWidth(char* s, int len);
+  double getWidth(char* s, int len) const;
 
 private:
   ~GfxCIDFont();
 
   int mapCodeToGID(FoFiTrueType *ff, int cmapi,
     Unicode unicode, GBool wmode);
-  double getWidth(CID cid);	// Get width of a character.
+  double getWidth(CID cid) const;	// Get width of a character.
 
   GooString *collection;		// collection name
   CMap *cMap;			// char code --> CID


More information about the poppler mailing list