[poppler] poppler/poppler: FontInfo.cc,1.4,1.5 FontInfo.h,1.2,1.3

Brad Hards bradh at freedesktop.org
Mon Jul 4 01:10:18 PDT 2005


Update of /cvs/poppler/poppler/poppler
In directory gabe:/tmp/cvs-serv9740

Modified Files:
	FontInfo.cc FontInfo.h 
Log Message:
Change FontInfo::type() to return an enumerated value,
rather than a GooString.


Index: FontInfo.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/FontInfo.cc,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- FontInfo.cc	28 Jun 2005 22:51:29 -0000	1.4
+++ FontInfo.cc	4 Jul 2005 08:10:16 -0000	1.5
@@ -13,17 +13,6 @@
 #include "config.h"
 #include "FontInfo.h"
 
-static char *fontTypeNames[] = {
-  "unknown",
-  "Type 1",
-  "Type 1C",
-  "Type 3",
-  "TrueType",
-  "CID Type 0",
-  "CID Type 0C",
-  "CID TrueType"
-};
-
 FontInfoScanner::FontInfoScanner(PDFDoc *docA) {
   doc = docA;
   currentPage = 1;
@@ -164,7 +153,7 @@
   }
   
   // font type
-  type = new GooString(fontTypeNames[font->getType()]);
+  type = (FontInfo::Type)font->getType();
 
   // check for an embedded font
   if (font->getType() == fontType3) {
@@ -196,7 +185,7 @@
 
 FontInfo::FontInfo(FontInfo& f) {
   name = f.name->copy();
-  type = f.type->copy();
+  type = f.type;
   emb = f.emb;
   subset = f.subset;
   hasToUnicode = f.hasToUnicode;
@@ -205,5 +194,4 @@
 
 FontInfo::~FontInfo() {
   delete name;
-  delete type;
 }

Index: FontInfo.h
===================================================================
RCS file: /cvs/poppler/poppler/poppler/FontInfo.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- FontInfo.h	28 Jun 2005 22:49:15 -0000	1.2
+++ FontInfo.h	4 Jul 2005 08:10:16 -0000	1.3
@@ -6,7 +6,17 @@
 
 class FontInfo {
 public:
-
+  enum Type {
+    unknown,
+    Type1,
+    Type1C,
+    Type3,
+    TrueType,
+    CIDType0,
+    CIDType0C,
+    CIDTrueType
+  };
+    
   // Constructor.
   FontInfo(GfxFont *fontA, PDFDoc *doc);
   // Copy constructor
@@ -15,14 +25,14 @@
   ~FontInfo();
 
   GooString *getName()      { return name; };
-  GooString *getType()      { return type; };
+  Type       getType()      { return type; };
   GBool      getEmbedded()  { return emb; };
   GBool      getSubset()    { return subset; };
   GBool      getToUnicode() { return hasToUnicode; };
 
 private:
   GooString *name;
-  GooString *type;
+  Type type;
   GBool emb;
   GBool subset;
   GBool hasToUnicode;



More information about the poppler mailing list