[PATCH] Make the catalog available to CairoFontEngine

Adrian Johnson ajohnson at redneon.com
Fri Oct 31 06:56:40 PDT 2008


---
 glib/poppler-document.cc   |    3 ++-
 poppler/CairoFontEngine.cc |    2 +-
 poppler/CairoFontEngine.h  |    3 ++-
 poppler/CairoOutputDev.cc  |    7 +++++--
 poppler/CairoOutputDev.h   |    3 ++-
 test/pdf-inspector.cc      |    2 +-
 6 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index 7637af4..ef5deb0 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -106,14 +106,15 @@ _poppler_document_new_from_pdfdoc (PDFDoc  *newDoc,
 
 #if defined (HAVE_CAIRO)
   document->output_dev = new CairoOutputDev ();
+  document->output_dev->startDoc(document->doc->getXRef (), document->doc->getCatalog ());
 #elif defined (HAVE_SPLASH)
   SplashColor white;
   white[0] = 255;
   white[1] = 255;
   white[2] = 255;
   document->output_dev = new SplashOutputDev(splashModeRGB8, 4, gFalse, white);
-#endif
   document->output_dev->startDoc(document->doc->getXRef ());
+#endif
 
   return document;
 }
diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc
index 61e00a3..75340b8 100644
--- a/poppler/CairoFontEngine.cc
+++ b/poppler/CairoFontEngine.cc
@@ -561,7 +561,7 @@ CairoFontEngine::~CairoFontEngine() {
 }
 
 CairoFont *
-CairoFontEngine::getFont(GfxFont *gfxFont, XRef *xref) {
+CairoFontEngine::getFont(GfxFont *gfxFont, XRef *xref, Catalog *catalog) {
   int i, j;
   Ref ref;
   CairoFont *font;
diff --git a/poppler/CairoFontEngine.h b/poppler/CairoFontEngine.h
index 8b7a99f..1f25026 100644
--- a/poppler/CairoFontEngine.h
+++ b/poppler/CairoFontEngine.h
@@ -35,6 +35,7 @@
 #include <cairo-ft.h>
 
 #include "GfxFont.h"
+#include "Catalog.h"
 
 class CairoFont {
 public:
@@ -89,7 +90,7 @@ public:
   CairoFontEngine(FT_Library libA);
   ~CairoFontEngine();
 
-  CairoFont *getFont(GfxFont *gfxFont, XRef *xref);
+  CairoFont *getFont(GfxFont *gfxFont, XRef *xref, Catalog *catalog);
 
 private:
   CairoFont *fontCache[cairoFontCacheSize];
diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 25335b7..eec5167 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -107,6 +107,7 @@ GBool CairoOutputDev::ft_lib_initialized = gFalse;
 
 CairoOutputDev::CairoOutputDev() {
   xref = NULL;
+  catalog = NULL;
 
   if (!ft_lib_initialized) {
     FT_Init_FreeType(&ft_lib);
@@ -172,8 +173,10 @@ void CairoOutputDev::setCairo(cairo_t *cairo)
   }
 }
 
-void CairoOutputDev::startDoc(XRef *xrefA, CairoFontEngine *parentFontEngine) {
+void CairoOutputDev::startDoc(XRef *xrefA, Catalog *catalogA,
+			      CairoFontEngine *parentFontEngine) {
   xref = xrefA;
+  catalog = catalogA;
   if (parentFontEngine) {
     fontEngine = parentFontEngine;
   } else {
@@ -414,7 +417,7 @@ void CairoOutputDev::updateFont(GfxState *state) {
   if (state->getFont()->getType() == fontType3)	 
     return;
 
-  currentFont = fontEngine->getFont (state->getFont(), xref);
+  currentFont = fontEngine->getFont (state->getFont(), xref, catalog);
 
   if (!currentFont)
     return;
diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h
index 27b39ed..d70740d 100644
--- a/poppler/CairoOutputDev.h
+++ b/poppler/CairoOutputDev.h
@@ -207,7 +207,7 @@ public:
   //----- special access
 
   // Called to indicate that a new PDF document has been loaded.
-  void startDoc(XRef *xrefA, CairoFontEngine *fontEngine = NULL);
+  void startDoc(XRef *xrefA, Catalog *catalogA, CairoFontEngine *fontEngine = NULL);
  
   GBool isReverseVideo() { return gFalse; }
   
@@ -224,6 +224,7 @@ protected:
   CairoFont *currentFont;
   
   XRef *xref;			// xref table for current document
+  Catalog *catalog;
 
   static FT_Library ft_lib;
   static GBool ft_lib_initialized;
diff --git a/test/pdf-inspector.cc b/test/pdf-inspector.cc
index 3965380..3eb8650 100644
--- a/test/pdf-inspector.cc
+++ b/test/pdf-inspector.cc
@@ -292,7 +292,7 @@ PdfInspector::load(const char *file_name)
       gtk_spin_button_set_range (GTK_SPIN_BUTTON (spin), 0, doc->getNumPages()-1);
       gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), 0);
 
-      output->startDoc (doc->getXRef());
+      output->startDoc (doc->getXRef(), doc->getCatalog());
     }
   else
     {      
-- 
1.5.6.3


--------------090504070501070603020308
Content-Type: text/x-patch;
 name="0005-Add-CairoOutputDev-functions-for-getting-Type-3-glyp.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename*0="0005-Add-CairoOutputDev-functions-for-getting-Type-3-glyp.pa";
 filename*1="tch"



More information about the poppler mailing list