X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fdevices%2Fpdf.c;h=16bb6cf7cebf8b0499e13edf4d90d951e5c7349c;hp=8ecfa874200c86e62c5f447be85f0805aa883c9d;hb=8589e0d1f5e47c05458033e750fd6182ca704fbe;hpb=219ea5ad983fc389d894c967528b451ea321b8c6 diff --git a/lib/devices/pdf.c b/lib/devices/pdf.c index 8ecfa87..16bb6cf 100644 --- a/lib/devices/pdf.c +++ b/lib/devices/pdf.c @@ -100,7 +100,7 @@ void pdf_startpage(gfxdevice_t*dev, int width, int height) internal_t*i = (internal_t*)dev->internal; if(!i->tempfile) { - i->tempfile = strdup(mktempname(0)); + i->tempfile = strdup(mktempname(0, "pdf")); PDF_begin_document(i->p, i->tempfile, 0, ""); //PDF_set_value(i->p, "compress", 0); @@ -281,14 +281,14 @@ void pdf_fillbitmap(gfxdevice_t*dev, gfxline_t*line, gfximage_t*img, gfxmatrix_t } char tempfile[128]; - mktempname(tempfile); + mktempname(tempfile, "jpg"); gfximage_save_jpeg(img, tempfile, 96); int imgid=-1; if(has_alpha) { char tempfile2[128]; - mktempname(tempfile2); + mktempname(tempfile2, "jpg"); int t; int size = img->width*img->height; unsigned char*alpha = malloc(size); @@ -389,17 +389,31 @@ void pdf_addfont(gfxdevice_t*dev, gfxfont_t*font) for(t=0;tglyphs[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;tp, fontname2, l*2, "host", "embedding=true"); i->fontlist = gfxfontlist_addfont2(i->fontlist, font, (void*)(ptroff_t)fontid); + unlink(filename); } } }