Commit a75efe20 authored by Adrian Johnson's avatar Adrian Johnson Committed by Carlos Garcia Campos

Make the catalog available to CairoFontEngine

parent 941d3976
......@@ -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;
}
......
......@@ -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;
......
......@@ -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];
......
......@@ -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;
......
......@@ -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;
......
......@@ -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
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment