X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=pdf2swf%2Fswfoutput.cc;h=f84ebee32795b465c8875141bffa4fe1095f857d;hb=71e57080c599ffd3ca6565e6b152a2f3fc137c62;hp=07969d9f68592d15ce4a700aedf6bf3d7c6c16d8;hpb=6d6d81bc572e98080d341ee57fc90913202695e4;p=swftools.git diff --git a/pdf2swf/swfoutput.cc b/pdf2swf/swfoutput.cc index 07969d9..f84ebee 100644 --- 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 storeallcharacters=0; 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*)); + 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); @@ -552,6 +556,7 @@ SWFFont::SWFFont(char*name, int id, char*filename) for(s=0;soutline[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++; } @@ -564,7 +569,19 @@ SWFFont::SWFFont(char*name, int id, char*filename) SWFFont::~SWFFont() { int t,usednum=0; - int*ptr = (int*)malloc(swfcharpos*sizeof(int)); + int*ptr; + + if(storeallcharacters) + { + int t; + for(t=0;tcharnum;t++) + { + if(this->charname[t]) + getSWFCharID(this->charname[t]); + } + } + + ptr = (int*)malloc(swfcharpos*sizeof(int)); for(t=0;tswfid); - 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;tcharname[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); @@ -626,6 +648,7 @@ SWFFont::~SWFFont() for(t=0;t