X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=pdf2swf%2FSWFOutputDev.cc;h=46a07bf4f3faed10ebda784bfa4fbde99a47e10a;hb=baad9b2b637cabbc94f94d2140656d8c84261e1c;hp=fc295eb3c32b6e9f7408a5b7118fa6ed2fd4bdcf;hpb=2732d70502f6158be2ad81fce2f9899755b645bc;p=swftools.git diff --git a/pdf2swf/SWFOutputDev.cc b/pdf2swf/SWFOutputDev.cc index fc295eb..46a07bf 100644 --- a/pdf2swf/SWFOutputDev.cc +++ b/pdf2swf/SWFOutputDev.cc @@ -22,7 +22,9 @@ #include #include #include +#include "../config.h" //xpdf header files +#include "config.h" #include "gfile.h" #include "GString.h" #include "gmem.h" @@ -35,7 +37,6 @@ #include "Page.h" #include "PDFDoc.h" #include "Error.h" -#include "config.h" #include "OutputDev.h" #include "GfxState.h" #include "GfxFont.h" @@ -441,6 +442,14 @@ T1_OUTLINE* gfxPath_to_T1_OUTLINE(GfxState*state, GfxPath*path) bezierpathsegment*outline = start = new bezierpathsegment(); int cpos = 0; double lastx=0,lasty=0; + if(!num) { + logf(" empty path"); + outline->type = T1_PATHTYPE_MOVE; + outline->dest.x = 0; + outline->dest.y = 0; + outline->link = 0; + return (T1_OUTLINE*)outline; + } for(t = 0; t < num; t++) { GfxSubpath *subpath = path->getSubpath(t); int subnum = subpath->getNumPoints(); @@ -743,24 +752,27 @@ void SWFOutputDev::drawLink(Link *link, Catalog *catalog) LinkNamed*l = (LinkNamed*)action; GString*name = l->getName(); if(name) { - s = name->lowerCase()->getCString(); - named = name->getCString(); - if(strstr(s, "next") || strstr(s, "forward")) - { - page = currentpage + 1; - } - else if(strstr(s, "prev") || strstr(s, "back")) - { - page = currentpage - 1; - } - else if(strstr(s, "last") || strstr(s, "end")) - { - page = pages[pagepos-1]; //:) - } - else if(strstr(s, "first") || strstr(s, "top")) - { - page = 1; - } + s = name->lowerCase()->getCString(); + named = name->getCString(); + if(!strchr(s,':')) + { + if(strstr(s, "next") || strstr(s, "forward")) + { + page = currentpage + 1; + } + else if(strstr(s, "prev") || strstr(s, "back")) + { + page = currentpage - 1; + } + else if(strstr(s, "last") || strstr(s, "end")) + { + page = pages[pagepos-1]; //:) + } + else if(strstr(s, "first") || strstr(s, "top")) + { + page = 1; + } + } } } break; @@ -961,8 +973,30 @@ char*SWFOutputDev::writeEmbeddedFontToFile(XRef*ref, GfxFont*font) refObj.fetch(ref, &strObj); refObj.free(); strObj.streamReset(); - while ((c = strObj.streamGetChar()) != EOF) { - fputc(c, f); + int f4[4]; + char f4c[4]; + int t; + for(t=0;t<4;t++) { + f4[t] = strObj.streamGetChar(); + f4c[t] = (char)f4[t]; + if(f4[t] == EOF) + break; + } + if(t==4) { + if(!strncmp(f4c, "true", 4)) { + /* some weird TTF fonts don't start with 0,1,0,0 but with "true". + Change this on the fly */ + f4[0] = f4[2] = f4[3] = 0; + f4[1] = 1; + } + fputc(f4[0], f); + fputc(f4[1], f); + fputc(f4[2], f); + fputc(f4[3], f); + + while ((c = strObj.streamGetChar()) != EOF) { + fputc(c, f); + } } strObj.streamClose(); strObj.free(); @@ -1773,6 +1807,11 @@ void pdfswf_insertstop() insertstoptag = 1; } +void pdfswf_setversion(int n) +{ + flashversion = n; +} + int closed=0; void pdfswf_close() {