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 makefonts utility
[swftools.git]
/
pdf2swf
/
swfoutput.cc
diff --git
a/pdf2swf/swfoutput.cc
b/pdf2swf/swfoutput.cc
index
07969d9
..
f84ebee
100644
(file)
--- a/
pdf2swf/swfoutput.cc
+++ b/
pdf2swf/swfoutput.cc
@@
-34,6
+34,7
@@
int opennewwindow=0;
int ignoredraworder=0;
int drawonlyshapes=0;
int jpegquality=85;
int ignoredraworder=0;
int drawonlyshapes=0;
int jpegquality=85;
+int storeallcharacters=0;
static int flag_protected = 0;
typedef unsigned char u8;
static int flag_protected = 0;
typedef unsigned char u8;
@@
-518,6
+519,9
@@
SWFFont::SWFFont(char*name, int id, char*filename)
outline = (T1_OUTLINE**)malloc(t*sizeof(T1_OUTLINE*));
charname = (char**)malloc(t*sizeof(char*));
outline = (T1_OUTLINE**)malloc(t*sizeof(T1_OUTLINE*));
charname = (char**)malloc(t*sizeof(char*));
+ width = (int*)malloc(t*sizeof(int));
+ memset(width, 0, t*sizeof(int));
+ memset(charname, 0, t*sizeof(char*));
used = (char*)malloc(t*sizeof(char));
char2swfcharid = (U16*)malloc(t*2);
swfcharid2char = (U16*)malloc(t*2);
used = (char*)malloc(t*sizeof(char));
char2swfcharid = (U16*)malloc(t*2);
swfcharid2char = (U16*)malloc(t*2);
@@
-552,6
+556,7
@@
SWFFont::SWFFont(char*name, int id, char*filename)
for(s=0;s<t;s++)
{
this->outline[outlinepos] = T1_CopyOutline(T1_GetCharOutline(id, s, 100.0, 0));
for(s=0;s<t;s++)
{
this->outline[outlinepos] = T1_CopyOutline(T1_GetCharOutline(id, s, 100.0, 0));
+ this->width[outlinepos] = T1_GetCharWidth(id, s);
this->charname[outlinepos] = strdup(T1_GetCharName(id, s));
outlinepos++;
}
this->charname[outlinepos] = strdup(T1_GetCharName(id, s));
outlinepos++;
}
@@
-564,7
+569,19
@@
SWFFont::SWFFont(char*name, int id, char*filename)
SWFFont::~SWFFont()
{
int t,usednum=0;
SWFFont::~SWFFont()
{
int t,usednum=0;
- int*ptr = (int*)malloc(swfcharpos*sizeof(int));
+ int*ptr;
+
+ if(storeallcharacters)
+ {
+ int t;
+ for(t=0;t<this->charnum;t++)
+ {
+ if(this->charname[t])
+ getSWFCharID(this->charname[t]);
+ }
+ }
+
+ ptr = (int*)malloc(swfcharpos*sizeof(int));
for(t=0;t<charnum;t++)
if(used[t]) usednum++;
for(t=0;t<charnum;t++)
if(used[t]) usednum++;
@@
-580,6
+597,7
@@
SWFFont::~SWFFont()
m.m21 = m.m12 = 0;
m.m13 = CHARMIDX;
m.m23 = CHARMIDY;
m.m21 = m.m12 = 0;
m.m13 = CHARMIDX;
m.m23 = CHARMIDY;
+
for(t=0;t<swfcharpos;t++)
{
ptr[t] = swf_GetDataSize(ftag);
for(t=0;t<swfcharpos;t++)
{
ptr[t] = swf_GetDataSize(ftag);
@@
-605,16
+623,20
@@
SWFFont::~SWFFont()
}
ftag = swf_InsertTag(ftag,ST_DEFINEFONTINFO);
swf_SetU16(ftag, this->swfid);
}
ftag = swf_InsertTag(ftag,ST_DEFINEFONTINFO);
swf_SetU16(ftag, this->swfid);
- swf_SetU8(ftag, strlen(this->fontid));
- swf_SetBlock(ftag, (U8*)this->fontid, strlen(this->fontid));
- swf_SetU8(ftag, 0);
+ if(this->fontid) {
+ swf_SetU8(ftag, strlen(this->fontid));
+ swf_SetBlock(ftag, (U8*)this->fontid, strlen(this->fontid));
+ } else {
+ swf_SetU8(ftag, 0);
+ }
+ swf_SetU8(ftag, 0); //flags
for(t=0;t<swfcharpos;t++)
{
int s;
char * name = this->charname[this->swfcharid2char[t]];
for(s=0;s<256;s++) {
if(standardEncodingNames[s] &&
for(t=0;t<swfcharpos;t++)
{
int s;
char * name = this->charname[this->swfcharid2char[t]];
for(s=0;s<256;s++) {
if(standardEncodingNames[s] &&
- !strcasecmp(name,standardEncodingNames[s]))
+ !strcmp(name,standardEncodingNames[s]))
break;
}
swf_SetU8(ftag, (U8)s);
break;
}
swf_SetU8(ftag, (U8)s);
@@
-626,6
+648,7
@@
SWFFont::~SWFFont()
for(t=0;t<charnum;t++)
free(charname[t]);
free(charname);
for(t=0;t<charnum;t++)
free(charname[t]);
free(charname);
+ free(width);
free(used);
free(swfcharid2char);
free(char2swfcharid);
free(used);
free(swfcharid2char);
free(char2swfcharid);
@@
-1157,7
+1180,7
@@
void drawlink(struct swfoutput*obj, ActionTAG*actions, swfcoord*points)
swf_ButtonSetRecord(tag,0x04,myshapeid2,depth,0,0);
swf_ButtonSetRecord(tag,0x08,myshapeid,depth,0,0);
swf_SetU8(tag,0);
swf_ButtonSetRecord(tag,0x04,myshapeid2,depth,0,0);
swf_ButtonSetRecord(tag,0x08,myshapeid,depth,0,0);
swf_SetU8(tag,0);
- swf_SetActions(tag,actions);
+ swf_ActionSet(tag,actions);
swf_SetU8(tag,0);
tag = swf_InsertTag(tag,ST_PLACEOBJECT2);
swf_SetU8(tag,0);
tag = swf_InsertTag(tag,ST_PLACEOBJECT2);