From 377ede4ea24974fde5de2a44bd060e6d87dd8bd5 Mon Sep 17 00:00:00 2001 From: kramm Date: Fri, 17 Sep 2004 16:57:28 +0000 Subject: [PATCH] added xpdf-3.00 support. --- pdf2swf/SWFOutputDev.cc | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/pdf2swf/SWFOutputDev.cc b/pdf2swf/SWFOutputDev.cc index 0b79336..8e93f5d 100644 --- a/pdf2swf/SWFOutputDev.cc +++ b/pdf2swf/SWFOutputDev.cc @@ -45,11 +45,18 @@ #include "GfxFont.h" #include "CharCodeToUnicode.h" #include "NameToUnicodeTable.h" -#include "FontFile.h" #include "GlobalParams.h" +//#define XPDF_101 +#ifdef XPDF_101 +#include "FontFile.h" +#else +#include "FoFiType1C.h" +#include "FoFiTrueType.h" +#endif +#include "SWFOutputDev.h" + //swftools header files #include "swfoutput.h" -#include "SWFOutputDev.h" #include "../lib/log.h" #include @@ -770,7 +777,11 @@ void SWFOutputDev::drawLink(Link *link, Catalog *catalog) swfcoord points[5]; int x, y; +#ifdef XPDF_101 link->getBorder(&x1, &y1, &x2, &y2, &w); +#else + link->getRect(&x1, &y1, &x2, &y2); +#endif // if (w > 0) { rgb.r = 0; @@ -1001,6 +1012,11 @@ void SWFOutputDev::updateStrokeColor(GfxState *state) (char)(rgb.b*255), (char)(opaq*255)); } +void FoFiWrite(void *stream, char *data, int len) +{ + fwrite(data, len, 1, (FILE*)stream); +} + char*SWFOutputDev::writeEmbeddedFontToFile(XRef*ref, GfxFont*font) { char*tmpFileName = NULL; @@ -1041,8 +1057,13 @@ char*SWFOutputDev::writeEmbeddedFontToFile(XRef*ref, GfxFont*font) msg(" Couldn't read embedded font file"); return 0; } +#ifdef XPDF_101 Type1CFontFile *cvt = new Type1CFontFile(fontBuf, fontLen); cvt->convertToType1(f); +#else + FoFiType1C *cvt = FoFiType1C::make(fontBuf, fontLen); + cvt->convertToType1(NULL, gTrue, FoFiWrite, f); +#endif //cvt->convertToCIDType0("test", f); //cvt->convertToType0("test", f); delete cvt; @@ -1054,8 +1075,13 @@ char*SWFOutputDev::writeEmbeddedFontToFile(XRef*ref, GfxFont*font) msg(" Couldn't read embedded font file"); return 0; } +#ifdef XPDF_101 TrueTypeFontFile *cvt = new TrueTypeFontFile(fontBuf, fontLen); cvt->writeTTF(f); +#else + FoFiTrueType *cvt = FoFiTrueType::make(fontBuf, fontLen); + cvt->writeTTF(FoFiWrite, f); +#endif delete cvt; gfree(fontBuf); } else { @@ -1819,7 +1845,11 @@ void pdfswf_performconversion() for(t=0;tdisplayPage((OutputDev*)output, currentpage, /*zoom*/zoom, /*rotate*/0, /*doLinks*/(int)1); +#else + doc->displayPage((OutputDev*)output, currentpage, zoom, zoom, /*rotate*/0, true, /*doLinks*/(int)1); +#endif } } int pdfswf_numpages() -- 1.7.10.4