git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* shapecount is now named currentswfid
[swftools.git]
/
pdf2swf
/
swfoutput.cc
diff --git
a/pdf2swf/swfoutput.cc
b/pdf2swf/swfoutput.cc
index
074f28b
..
2c99345
100644
(file)
--- a/
pdf2swf/swfoutput.cc
+++ b/
pdf2swf/swfoutput.cc
@@
-37,7
+37,7
@@
static int flag_protected;
static SWF swf;
static TAG *tag;
static int shapeid = -1;
static SWF swf;
static TAG *tag;
static int shapeid = -1;
-static int shapecount = 0;
+static int currentswfid = 0;
static SHAPE* shape;
static int fillstyleid;
static int linestyleid;
static SHAPE* shape;
static int fillstyleid;
static int linestyleid;
@@
-206,8
+206,10
@@
void drawchar(struct swfoutput*obj, SWFFont*font, char*character, swfmatrix*m)
T1_OUTLINE*outline = font->getOutline(character);
char* charname = character;
T1_OUTLINE*outline = font->getOutline(character);
char* charname = character;
- if(!outline)
+ if(!outline) {
+ logf("Didn't find %s in current charset", character);
return;
return;
+ }
swfmatrix m2=*m;
m2.m11/=100;
swfmatrix m2=*m;
m2.m11/=100;
@@
-251,7
+253,7
@@
SWFFont::SWFFont(char*name, int id, char*filename)
T1_LoadFont(id);
this->name = strdup(T1_GetFontFileName(id));
T1_LoadFont(id);
this->name = strdup(T1_GetFontFileName(id));
- this->fontid = name;
+ this->fontid = strdup(name);
this->t1id = id;
char**a= T1_GetAllCharNames(id);
this->t1id = id;
char**a= T1_GetAllCharNames(id);
@@
-267,6
+269,14
@@
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*));
+ used = (char*)malloc(t*sizeof(char));
+ memset(used,0,t*sizeof(char));
+
+ /*
+ tag = InsertTag(tag,ST_DEFINEFONT);
+ SetU16(tag, ++currentswfid);
+ this->swfid = currentswfid;
+ */
t=0;
while(*a)
t=0;
while(*a)
@@
-300,12
+310,22
@@
SWFFont::SWFFont(char*name, int id, char*filename)
}
}
}
}
+SWFFont::~SWFFont()
+{
+ int t,s=0;
+ for(t=0;t<charnum;t++)
+ if(used[t]) s++;
+ logf("<notice> Font %s has %d used characters",fontid, s);
+}
+
T1_OUTLINE*SWFFont::getOutline(char*name)
{
int t;
for(t=0;t<this->charnum;t++) {
T1_OUTLINE*SWFFont::getOutline(char*name)
{
int t;
for(t=0;t<this->charnum;t++) {
- if(!strcmp(this->charname[t],name))
+ if(!strcmp(this->charname[t],name)) {
+ used[t] = 1;
return outline[t];
return outline[t];
+ }
}
return 0;
}
}
return 0;
}
@@
-445,7
+465,7
@@
void startshape(struct swfoutput*obj)
rgb.b = obj->fillrgb.b;
fillstyleid = ShapeAddSolidFillStyle(shape,&obj->fillrgb);
rgb.b = obj->fillrgb.b;
fillstyleid = ShapeAddSolidFillStyle(shape,&obj->fillrgb);
- shapeid = ++shapecount;
+ shapeid = ++currentswfid;
SetU16(tag,shapeid); // ID
r.xmin = 0;
SetU16(tag,shapeid); // ID
r.xmin = 0;
@@
-501,6
+521,12
@@
void swfoutput_newpage(struct swfoutput*obj)
void swfoutput_destroy(struct swfoutput* obj)
{
endpage(obj);
void swfoutput_destroy(struct swfoutput* obj)
{
endpage(obj);
+ fontlist_t *iterator = fontlist;
+ while(iterator) {
+ delete iterator->font;
+ iterator->font = 0;
+ iterator = iterator->next;
+ }
T1_CloseLib();
if(!filename)
T1_CloseLib();
if(!filename)
@@
-664,7
+690,7
@@
void swfoutput_drawimagefile(struct swfoutput*, char*filename, int sizex,int siz
if(shape>=0)
endshape();
if(shape>=0)
endshape();
- bitid = ++shapecount;
+ bitid = ++currentswfid;
/* bitmap */
tag = InsertTag(tag,ST_DEFINEBITSJPEG2);
/* bitmap */
tag = InsertTag(tag,ST_DEFINEBITSJPEG2);
@@
-672,7
+698,7
@@
void swfoutput_drawimagefile(struct swfoutput*, char*filename, int sizex,int siz
SetJPEGBits(tag, filename, 85);
/* shape */
SetJPEGBits(tag, filename, 85);
/* shape */
- myshapeid = ++shapecount;
+ myshapeid = ++currentswfid;
tag = InsertTag(tag,ST_DEFINESHAPE);
NewShape(&shape);
//lsid = ShapeAddLineStyle(shape,obj->linewidth,&obj->strokergb);
tag = InsertTag(tag,ST_DEFINESHAPE);
NewShape(&shape);
//lsid = ShapeAddLineStyle(shape,obj->linewidth,&obj->strokergb);