call swf_output_preparepage() in order to get links to work correctly
[swftools.git] / pdf2swf / swfoutput.cc
index 81cf8b0..0d0246b 100644 (file)
@@ -170,8 +170,6 @@ static void swf_startframe(gfxdevice_t*dev, int width, int height);
 static void swf_endframe(gfxdevice_t*dev);
 static gfxresult_t* swf_finish(gfxdevice_t*driver);
 
-int getCharID(SWFFONT *font, int charnr, char *charname, int u);
-
 static swfoutput_internal* init_internal_struct()
 {
     swfoutput_internal*i = (swfoutput_internal*)malloc(sizeof(swfoutput_internal));
@@ -715,52 +713,6 @@ static void endtext(gfxdevice_t*dev)
     i->textid = -1;
 }
 
-int getCharID(SWFFONT *font, int charnr, char *charname, int u)
-{
-    int t;
-    if(charname && font->glyphnames) {
-       for(t=0;t<font->numchars;t++) {
-           if(font->glyphnames[t] && !strcmp(font->glyphnames[t],charname)) {
-               msg("<debug> Char [%d,>%s<,%d] maps to %d\n", charnr, charname, u, t);
-               return t;
-           }
-       }
-       /* if we didn't find the character, maybe
-          we can find the capitalized version */
-       for(t=0;t<font->numchars;t++) {
-           if(font->glyphnames[t] && !strcasecmp(font->glyphnames[t],charname)) {
-               msg("<debug> Char [%d,>>%s<<,%d] maps to %d\n", charnr, charname, u, t);
-               return t;
-           }
-       }
-    }
-
-    if(u>0 && font->encoding != 255) {
-       /* try to use the unicode id */
-       if(u>=0 && u<font->maxascii && font->ascii2glyph[u]>=0) {
-           msg("<debug> Char [%d,%s,>%d<] maps to %d\n", charnr, charname, u, font->ascii2glyph[u]);
-           return font->ascii2glyph[u];
-       }
-    }
-
-    if(font->encoding != FONT_ENCODING_UNICODE) {
-       /* the following only works if the font encoding
-          is US-ASCII based. It's needed for fonts which return broken unicode
-          indices */
-       if(charnr>=0 && charnr<font->maxascii && font->ascii2glyph[charnr]>=0) {
-           msg("<debug> Char [>%d<,%s,%d] maps to %d\n", charnr, charname, u, font->ascii2glyph[charnr]);
-           return font->ascii2glyph[charnr];
-       }
-    } 
-    
-    if(charnr>=0 && charnr<font->numchars) {
-       msg("<debug> Char [>%d<,%s,%d] maps to %d\n", charnr, charname, u, charnr);
-       return charnr;
-    }
-    
-    return -1;
-}
-
 /* set's the matrix which is to be applied to characters drawn by swfoutput_drawchar() */
 static void swfoutput_setfontmatrix(gfxdevice_t*dev,double m11,double m21,
                                                   double m12,double m22)
@@ -1754,7 +1706,7 @@ static ArtVpath* gfxline_to_ArtVpath(gfxline_t*line)
     double x=0,y=0;
 
     /* factor which determines into how many line fragments a spline is converted */
-    double subfraction = 1.2;//0.3
+    double subfraction = 2.4;//0.3
 
     l2 = line;
     while(l2) {
@@ -1905,8 +1857,6 @@ static int add_image(swfoutput_internal*i, gfximage_t*img, int targetwidth, int
        return -1;
 
     /* TODO: cache images */
-    *newwidth = sizex;
-    *newheight  = sizey;
     
     if(newsizex<sizex || newsizey<sizey) {
        msg("<verbose> Scaling %dx%d image to %dx%d", sizex, sizey, newsizex, newsizey);
@@ -1914,7 +1864,9 @@ static int add_image(swfoutput_internal*i, gfximage_t*img, int targetwidth, int
        *newwidth = sizex = newsizex;
        *newheight  = sizey = newsizey;
        mem = newpic;
-    
+    } else {
+       *newwidth = newsizex = sizex;
+       *newheight = newsizey  = sizey;
     }
 
     int num_colors = swf_ImageGetNumberOfPaletteEntries(mem,sizex,sizey,0);