git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added "loading" message below the logo.
[swftools.git]
/
pdf2swf
/
SWFOutputDev.cc
diff --git
a/pdf2swf/SWFOutputDev.cc
b/pdf2swf/SWFOutputDev.cc
index
5d53fbd
..
78be919
100644
(file)
--- a/
pdf2swf/SWFOutputDev.cc
+++ b/
pdf2swf/SWFOutputDev.cc
@@
-23,6
+23,7
@@
#include <string.h>
#include <unistd.h>
//xpdf header files
#include <string.h>
#include <unistd.h>
//xpdf header files
+#include "gfile.h"
#include "GString.h"
#include "gmem.h"
#include "Object.h"
#include "GString.h"
#include "gmem.h"
#include "Object.h"
@@
-408,7
+409,7
@@
T1_OUTLINE* gfxPath_to_T1_OUTLINE(GfxState*state, GfxPath*path)
{
int num = path->getNumSubpaths();
int s,t;
{
int num = path->getNumSubpaths();
int s,t;
- bezierpathsegment*start,*last;
+ bezierpathsegment*start,*last=0;
bezierpathsegment*outline = start = new bezierpathsegment();
int cpos = 0;
double lastx=0,lasty=0;
bezierpathsegment*outline = start = new bezierpathsegment();
int cpos = 0;
double lastx=0,lasty=0;
@@
-547,7
+548,7
@@
void SWFOutputDev::beginString(GfxState *state, GString *s)
state->getFontTransMat(&m11, &m12, &m21, &m22);
m11 *= state->getHorizScaling();
m21 *= state->getHorizScaling();
state->getFontTransMat(&m11, &m12, &m21, &m22);
m11 *= state->getHorizScaling();
m21 *= state->getHorizScaling();
- swfoutput_setfontmatrix(&output, m11, -m12, m21, -m22);
+ swfoutput_setfontmatrix(&output, m11, -m21, m12, -m22);
}
int charcounter = 0;
}
int charcounter = 0;
@@
-630,6
+631,7
@@
void SWFOutputDev::drawLink(Link *link, Catalog *catalog)
char*s = "-?-";
char*type = "-?-";
char*url = 0;
char*s = "-?-";
char*type = "-?-";
char*url = 0;
+ char*named = 0;
int page = -1;
switch(action->getKind())
{
int page = -1;
switch(action->getKind())
{
@@
-665,6
+667,7
@@
void SWFOutputDev::drawLink(Link *link, Catalog *catalog)
GString*name = l->getName();
if(name) {
s = name->lowerCase()->getCString();
GString*name = l->getName();
if(name) {
s = name->lowerCase()->getCString();
+ named = name->getCString();
if(strstr(s, "next") || strstr(s, "forward"))
{
page = currentpage + 1;
if(strstr(s, "next") || strstr(s, "forward"))
{
page = currentpage + 1;
@@
-731,6
+734,10
@@
void SWFOutputDev::drawLink(Link *link, Catalog *catalog)
{
swfoutput_linktourl(&output, url, points);
}
{
swfoutput_linktourl(&output, url, points);
}
+ else if(named)
+ {
+ swfoutput_namedlink(&output, named, points);
+ }
logf("<verbose> \"%s\" link to \"%s\" (%d)\n", type, s, page);
}
}
logf("<verbose> \"%s\" link to \"%s\" (%d)\n", type, s, page);
}
}
@@
-860,14
+867,14
@@
char*SWFOutputDev::writeEmbeddedFontToFile(GfxFont*font)
ttfinfo = 1;
}
char name2[80];
ttfinfo = 1;
}
char name2[80];
- int r1 = lrand48();
- int r2 = lrand48();
- sprintf(name2,"%04x%04x",r1,r2);
+ char*tmp;
+ tmp = strdup(mktmpname((char*)name2));
+ sprintf(name2, "%s", tmp);
char*a[] = {"./ttf2pt1","-pttf","-b", tmpFileName, name2};
logf("<verbose> Invoking ttf2pt1...");
ttf2pt1_main(5,a);
unlink(tmpFileName);
char*a[] = {"./ttf2pt1","-pttf","-b", tmpFileName, name2};
logf("<verbose> Invoking ttf2pt1...");
ttf2pt1_main(5,a);
unlink(tmpFileName);
- sprintf(name2,"%04x%04x.pfb",r1,r2);
+ sprintf(name2,"%s.pfb",tmp);
tmpFileName = strdup(name2);
}
tmpFileName = strdup(name2);
}
@@
-973,10
+980,12
@@
char* SWFOutputDev::substituteFont(GfxFont*gfxFont, char* oldname)
logf("<fatal> Too many fonts in file.");
exit(1);
}
logf("<fatal> Too many fonts in file.");
exit(1);
}
- substitutesource[substitutepos] = oldname;
- substitutetarget[substitutepos] = fontname;
- logf("<verbose> substituting %s -> %s", oldname, fontname);
- substitutepos ++;
+ if(oldname) {
+ substitutesource[substitutepos] = oldname;
+ substitutetarget[substitutepos] = fontname;
+ logf("<verbose> substituting %s -> %s", oldname, fontname);
+ substitutepos ++;
+ }
return fontname;
}
return fontname;
}
@@
-1080,6
+1089,7
@@
void SWFOutputDev::updateFont(GfxState *state)
if(t1id<0) {
showFontError(gfxFont,0);
if(t1id<0) {
showFontError(gfxFont,0);
+ return;
}
/* we may have done some substitutions here, so check
}
/* we may have done some substitutions here, so check
@@
-1135,7
+1145,7
@@
void SWFOutputDev::drawGeneralImage(GfxState *state, Object *ref, Stream *str,
if (str->getKind() == strDCT &&
(colorMap->getNumPixelComps() == 3 || !mask) )
{
if (str->getKind() == strDCT &&
(colorMap->getNumPixelComps() == 3 || !mask) )
{
- sprintf(fileName, "/tmp/tmp%08x.jpg",lrand48());
+ sprintf(fileName, "%s.jpg",mktmpname(0));
logf("<verbose> Found jpeg. Temporary storage is %s", fileName);
if(!jpeginfo)
{
logf("<verbose> Found jpeg. Temporary storage is %s", fileName);
if(!jpeginfo)
{
@@
-1192,7
+1202,7
@@
void SWFOutputDev::drawGeneralImage(GfxState *state, Object *ref, Stream *str,
if(mask) {
imgStr = new ImageStream(str, width, 1, 1);
imgStr->reset();
if(mask) {
imgStr = new ImageStream(str, width, 1, 1);
imgStr->reset();
- return;
+ //return;
int yes=0,i,j;
unsigned char buf[8];
int xid = 0;
int yes=0,i,j;
unsigned char buf[8];
int xid = 0;