X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=pdf2swf%2Fswfoutput.cc;h=509a6e19a64dcb8eaa000f3e245d2befe80722ae;hb=9f87d4fc88247a11fa58cfbdaaaf52d3fdfb10e4;hp=13ba52f9ac78750427a9775671f52519797f82a8;hpb=e638c8aa70025caedf9cb4c131bb68214c856bf0;p=swftools.git diff --git a/pdf2swf/swfoutput.cc b/pdf2swf/swfoutput.cc index 13ba52f..509a6e1 100644 --- a/pdf2swf/swfoutput.cc +++ b/pdf2swf/swfoutput.cc @@ -899,6 +899,11 @@ static void drawchar(struct swfoutput*obj, SWFFont*font, char*character, int cha if(usefonts && ! drawonlyshapes) { int charid = font->getSWFCharID(character, charnr); + if(charid<0) { + msg(" Didn't find %s in current charset (%s)", + FIXNULL(character),FIXNULL(font->getName())); + return; + } if(shapeid>=0) endshape(); if(textid<0) @@ -986,7 +991,8 @@ SWFFont::SWFFont(char*name, int id, char*filename) this->fontid = strdup(name); this->t1id = id; - char**a= T1_GetAllCharNames(id); + char**charnamebase= T1_GetAllCharNames(id); + char**a= charnamebase; int t, outlinepos=0; char*map[256]; @@ -1028,7 +1034,7 @@ SWFFont::SWFFont(char*name, int id, char*filename) t=0; while(*a) { - map[t] = *a; + map[t] = strdup(*a); a++; t++; if(t==256 || !*a) { @@ -1043,6 +1049,12 @@ SWFFont::SWFFont(char*name, int id, char*filename) int ret = T1_ReencodeFont(id, map); if(ret) fprintf(stderr,"Can't reencode font: (%s) ret:%d\n",filename, ret); + /* Deleting the font invalidates the charname array, + so we have to ask for it again now. + We continue at the position we were, hoping the font + didn't shrink in the meantime or something. + */ + a = T1_GetAllCharNames(id) + (a - charnamebase); } // parsecharacters @@ -1055,6 +1067,9 @@ SWFFont::SWFFont(char*name, int id, char*filename) this->charname[outlinepos] = strdup(name); outlinepos++; } + + for(s=0;sstandardtable[charnr], -1); } msg(" Didn't find character '%s' in font '%s'", FIXNULL(name), this->name); - return 0; + return -1; } int SWFFont::getWidth(char*name)