? mkinstalldirs ? poppler/GlobalParams.cc-merge Index: poppler/CairoFontEngine.cc =================================================================== RCS file: /cvs/poppler/poppler/poppler/CairoFontEngine.cc,v retrieving revision 1.20 diff -u -r1.20 CairoFontEngine.cc --- poppler/CairoFontEngine.cc 21 Dec 2005 17:30:33 -0000 1.20 +++ poppler/CairoFontEngine.cc 22 Feb 2006 06:55:41 -0000 @@ -38,7 +38,7 @@ delete font; } -CairoFont::CairoFont(GfxFont *gfxFont, XRef *xref, FT_Library lib, GBool useCIDs) { +CairoFont *CairoFont::Create(GfxFont *gfxFont, XRef *xref, FT_Library lib, GBool useCIDs) { Ref embRef; Object refObj, strObj; GooString *tmpFileName, *fileName, *substName,*tmpFileName2; @@ -52,7 +52,13 @@ FoFiType1C *ff1c; CharCodeToUnicode *ctu; Unicode uBuf[8]; + Ref ref; static cairo_user_data_key_t cairo_font_face_key; + cairo_font_face_t *cairo_font_face; + FT_Face face; + + Gushort *codeToGID; + int codeToGIDLen; dfp = NULL; codeToGID = NULL; @@ -241,19 +247,26 @@ error(-1, "could not create cairo font\n"); goto err2; /* this doesn't do anything, but it looks like we're * handling the error */ - } - + } { + CairoFont *ret = new CairoFont(ref, cairo_font_face, face, codeToGID, codeToGIDLen); cairo_font_face_set_user_data (cairo_font_face, &cairo_font_face_key, - this, + ret, cairo_font_face_destroy); - return; + return ret; + } err2: /* hmm? */ printf ("some font thing failed\n"); + return NULL; } +CairoFont::CairoFont(Ref ref, cairo_font_face_t *cairo_font_face, FT_Face face, + Gushort *codeToGID, int codeToGIDLen) : ref(ref), cairo_font_face(cairo_font_face), + face(face), codeToGID(codeToGID), + codeToGIDLen(codeToGIDLen) { } + CairoFont::~CairoFont() { FT_Done_Face (face); gfree(codeToGID); @@ -336,7 +349,7 @@ } } - font = new CairoFont (gfxFont, xref, lib, useCIDs); + font = CairoFont::Create (gfxFont, xref, lib, useCIDs); if (fontCache[cairoFontCacheSize - 1]) { delete fontCache[cairoFontCacheSize - 1]; } Index: poppler/CairoFontEngine.h =================================================================== RCS file: /cvs/poppler/poppler/poppler/CairoFontEngine.h,v retrieving revision 1.6 diff -u -r1.6 CairoFontEngine.h --- poppler/CairoFontEngine.h 15 Sep 2005 22:09:50 -0000 1.6 +++ poppler/CairoFontEngine.h 22 Feb 2006 06:55:41 -0000 @@ -18,20 +18,21 @@ class CairoFont { public: - CairoFont(GfxFont *gfxFont, XRef *xref, FT_Library lib, GBool useCIDs); + static CairoFont *Create(GfxFont *gfxFont, XRef *xref, FT_Library lib, GBool useCIDs); ~CairoFont(); GBool matches(Ref &other); cairo_font_face_t *getFontFace(void); unsigned long getGlyph(CharCode code, Unicode *u, int uLen); private: + CairoFont(Ref ref, cairo_font_face_t *cairo_font_face, FT_Face face, + Gushort *codeToGID, int codeToGIDLen); Ref ref; cairo_font_face_t *cairo_font_face; FT_Face face; Gushort *codeToGID; int codeToGIDLen; - double m11, m12, m21, m22; }; //------------------------------------------------------------------------ Index: poppler/CairoOutputDev.cc =================================================================== RCS file: /cvs/poppler/poppler/poppler/CairoOutputDev.cc,v retrieving revision 1.29 diff -u -r1.29 CairoOutputDev.cc --- poppler/CairoOutputDev.cc 18 Feb 2006 20:17:00 -0000 1.29 +++ poppler/CairoOutputDev.cc 22 Feb 2006 06:55:41 -0000 @@ -266,6 +266,8 @@ currentFont = fontEngine->getFont (state->getFont(), xref); + if (!currentFont) + return; state->getFontTransMat(&m11, &m12, &m21, &m22); m11 *= state->getHorizScaling(); m12 *= state->getHorizScaling(); @@ -377,6 +379,9 @@ { double tx, ty; + if (!currentFont) + return; + glyphs[glyphCount].index = currentFont->getGlyph (code, u, uLen); state->transform(x, y, &tx, &ty); glyphs[glyphCount].x = tx;