[poppler] poppler/poppler: CairoFontEngine.cc, 1.15, 1.16 CairoFontEngine.h, 1.5, 1.6

Albert Astals Cid aacid at freedesktop.org
Thu Sep 15 15:09:52 PDT 2005


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

Modified Files:
	CairoFontEngine.cc CairoFontEngine.h 
Log Message:
Merge the xpdf 3.01 change that uses runtime detection of freetype version


Index: CairoFontEngine.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/CairoFontEngine.cc,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- CairoFontEngine.cc	28 Jul 2005 17:34:19 -0000	1.15
+++ CairoFontEngine.cc	15 Sep 2005 22:09:50 -0000	1.16
@@ -37,7 +37,7 @@
   delete font;
 }
 
-CairoFont::CairoFont(GfxFont *gfxFont, XRef *xref, FT_Library lib) {
+CairoFont::CairoFont(GfxFont *gfxFont, XRef *xref, FT_Library lib, GBool useCIDs) {
   Ref embRef;
   Object refObj, strObj;
   GooString *tmpFileName, *fileName, *substName,*tmpFileName2;
@@ -162,12 +162,13 @@
     codeToGID = NULL;
     codeToGIDLen = 0;
 
-#if HAVE_FREETYPE_217_OR_OLDER
-    if ((ff1c = FoFiType1C::load(fileName->getCString()))) {
-      codeToGID = ff1c->getCIDToGIDMap(&codeToGIDLen);
-      delete ff1c;
+    if (useCIDs)
+    {
+      if ((ff1c = FoFiType1C::load(fileName->getCString()))) {
+        codeToGID = ff1c->getCIDToGIDMap(&codeToGIDLen);
+        delete ff1c;
+      }
     }
-#endif
 
     if (FT_New_Face(lib, fileName->getCString(), 0, &face)) {
       gfree(codeToGID);
@@ -250,6 +251,12 @@
   for (i = 0; i < cairoFontCacheSize; ++i) {
     fontCache[i] = NULL;
   }
+  
+  FT_Int major, minor, patch;
+  // as of FT 2.1.8, CID fonts are indexed by CID instead of GID
+  FT_Library_Version(lib, &major, &minor, &patch);
+  useCIDs = major > 2 ||
+            (major == 2 && (minor > 1 || (minor == 1 && patch > 7)));
 }
 
 CairoFontEngine::~CairoFontEngine() {
@@ -287,7 +294,7 @@
     }
   }
   
-  font = new CairoFont (gfxFont, xref, lib);
+  font = new CairoFont (gfxFont, xref, lib, useCIDs);
   if (fontCache[cairoFontCacheSize - 1]) {
     delete fontCache[cairoFontCacheSize - 1];
   }

Index: CairoFontEngine.h
===================================================================
RCS file: /cvs/poppler/poppler/poppler/CairoFontEngine.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- CairoFontEngine.h	28 Jul 2005 17:34:19 -0000	1.5
+++ CairoFontEngine.h	15 Sep 2005 22:09:50 -0000	1.6
@@ -18,7 +18,7 @@
 
 class CairoFont {
 public:
-  CairoFont(GfxFont *gfxFont, XRef *xref, FT_Library lib);
+  CairoFont(GfxFont *gfxFont, XRef *xref, FT_Library lib, GBool useCIDs);
   ~CairoFont();
 
   GBool matches(Ref &other);
@@ -54,6 +54,7 @@
 private:
   CairoFont *fontCache[cairoFontCacheSize];
   FT_Library lib;
+  GBool useCIDs;
 };
 
 #endif



More information about the poppler mailing list