treat glyphs with alpha=0 differently than normal glyphs (remove outlines)
[swftools.git] / lib / devices / pdf.c
index 8ecfa87..1e0d6a8 100644 (file)
@@ -389,17 +389,31 @@ void pdf_addfont(gfxdevice_t*dev, gfxfont_t*font)
            for(t=0;t<num;t++) {
                font->glyphs[t].unicode = 32+t;
            }
+           font->max_unicode = 0;
            font->unicode2glyph = 0;
            gfxfont_save(font, filename);
            font->id=old_id;
+           
+#ifdef RUN_TTX
+           /* for testing the generated fonts: run everything through ttx (fonttools) */
+           char cmd[256];
+           sprintf(cmd, "mv %s.ttf test.ttf", fontname);system(cmd);
+           system("rm -f test.ttx");
+           if(system("ttx test.ttf")&0xff00) exit(1);
+           sprintf(cmd, "mv test.ttf %s.old.ttf", fontname, fontname);system(cmd);
+           sprintf(cmd, "ttx test.ttx;mv test.ttf %s.ttf", fontname);system(cmd);
+           sprintf(cmd, "rm -f test.ttx");system(cmd);
+#endif
           
-           int l = strlen(font->id);
+           int l = strlen(fontname);
            for(t=0;t<l+1;t++) {
                fontname2[t*2+0] = fontname[t];
                fontname2[t*2+1] = 0;
            }
+           
            fontid = PDF_load_font(i->p, fontname2, l*2, "host", "embedding=true");
            i->fontlist = gfxfontlist_addfont2(i->fontlist, font, (void*)(ptroff_t)fontid);
+           unlink(filename);
        }
     }
 }