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

Allow multiple instances of CairoOutputDev to be created

for the same document that shares the same CairoFontEngine.
parent 94cff513
......@@ -114,6 +114,7 @@ CairoOutputDev::CairoOutputDev() {
}
fontEngine = NULL;
fontEngine_owner = gFalse;
glyphs = NULL;
fill_pattern = NULL;
stroke_pattern = NULL;
......@@ -134,7 +135,7 @@ CairoOutputDev::CairoOutputDev() {
}
CairoOutputDev::~CairoOutputDev() {
if (fontEngine) {
if (fontEngine_owner && fontEngine) {
delete fontEngine;
}
......@@ -171,12 +172,17 @@ void CairoOutputDev::setCairo(cairo_t *cairo)
}
}
void CairoOutputDev::startDoc(XRef *xrefA) {
void CairoOutputDev::startDoc(XRef *xrefA, CairoFontEngine *parentFontEngine) {
xref = xrefA;
if (fontEngine) {
delete fontEngine;
if (parentFontEngine) {
fontEngine = parentFontEngine;
} else {
if (fontEngine) {
delete fontEngine;
}
fontEngine = new CairoFontEngine(ft_lib);
fontEngine_owner = gTrue;
}
fontEngine = new CairoFontEngine(ft_lib);
}
void CairoOutputDev::startPage(int pageNum, GfxState *state) {
......
......@@ -207,7 +207,7 @@ public:
//----- special access
// Called to indicate that a new PDF document has been loaded.
void startDoc(XRef *xrefA);
void startDoc(XRef *xrefA, CairoFontEngine *fontEngine = NULL);
GBool isReverseVideo() { return gFalse; }
......@@ -229,6 +229,8 @@ protected:
static GBool ft_lib_initialized;
CairoFontEngine *fontEngine;
GBool fontEngine_owner;
cairo_t *cairo;
cairo_matrix_t orig_matrix;
GBool needFontUpdate; // set when the font needs to be updated
......
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