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;
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)
}
}
+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++) {
- if(!strcmp(this->charname[t],name))
+ if(!strcmp(this->charname[t],name)) {
+ used[t] = 1;
return outline[t];
+ }
}
return 0;
}
rgb.b = obj->fillrgb.b;
fillstyleid = ShapeAddSolidFillStyle(shape,&obj->fillrgb);
- shapeid = ++shapecount;
+ shapeid = ++currentswfid;
SetU16(tag,shapeid); // ID
r.xmin = 0;
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)
if(shape>=0)
endshape();
- bitid = ++shapecount;
+ bitid = ++currentswfid;
/* bitmap */
tag = InsertTag(tag,ST_DEFINEBITSJPEG2);
SetJPEGBits(tag, filename, 85);
/* shape */
- myshapeid = ++shapecount;
+ myshapeid = ++currentswfid;
tag = InsertTag(tag,ST_DEFINESHAPE);
NewShape(&shape);
//lsid = ShapeAddLineStyle(shape,obj->linewidth,&obj->strokergb);