X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=pdf2swf%2Fswfoutput.cc;h=f84ebee32795b465c8875141bffa4fe1095f857d;hb=f02681d9b6f222ad16e3b97096c82b40e9813a7d;hp=9624d2d79ceff68c5e5394bce5d34db69c8d4f67;hpb=98cd8ccfb030f47413d9e1b0d89e7870aea42c16;p=swftools.git diff --git a/pdf2swf/swfoutput.cc b/pdf2swf/swfoutput.cc index 9624d2d..f84ebee 100644 --- a/pdf2swf/swfoutput.cc +++ b/pdf2swf/swfoutput.cc @@ -27,11 +27,14 @@ extern "C" { #include "../lib/log.h" #include "../lib/rfxswf.h" } +#define standardEncodingSize 335 +extern char *standardEncodingNames[standardEncodingSize]; int opennewwindow=0; int ignoredraworder=0; int drawonlyshapes=0; int jpegquality=85; +int storeallcharacters=0; static int flag_protected = 0; typedef unsigned char u8; @@ -516,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); @@ -550,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++; } @@ -562,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); + 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] && + !strcmp(name,standardEncodingNames[s])) + break; + } + swf_SetU8(ftag, (U8)s); + } } free(ptr); @@ -608,6 +648,7 @@ SWFFont::~SWFFont() for(t=0;t