X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fpdf%2FGFXOutputDev.cc;h=b497db5139c4be43c97b61b69d903da4e626e2c9;hb=95d04eff5714c6b79dd865ca297be70cf037fee8;hp=da5df32925519f90f739891876aec65d43655dff;hpb=cbcb36e38ef35e0a1b950fa8cfa3d90e5aeaa19b;p=swftools.git diff --git a/lib/pdf/GFXOutputDev.cc b/lib/pdf/GFXOutputDev.cc index da5df32..b497db5 100644 --- a/lib/pdf/GFXOutputDev.cc +++ b/lib/pdf/GFXOutputDev.cc @@ -368,6 +368,7 @@ GFXOutputDev::GFXOutputDev(InfoOutputDev*info, PDFDoc*doc) this->config_remapunicode=0; this->config_transparent=0; this->config_extrafontdata = 0; + this->config_fontquality = 10; this->gfxfontlist = gfxfontlist_create(); @@ -384,12 +385,17 @@ void GFXOutputDev::setParameter(const char*key, const char*value) this->config_transparent = atoi(value); } else if(!strcmp(key,"extrafontdata")) { this->config_extrafontdata = atoi(value); + } else if(!strcmp(key,"fontquality")) { + this->config_fontquality = atof(value); + if(this->config_fontquality<=1) + this->config_fontquality=1; } else if(!strcmp(key,"help")) { printf("\nPDF layer options:\n"); printf("breakonwarning=0/1 Abort conversion if graphic objects are found which\n"); printf(" are not 100%% supported\n"); printf("transparent=0/1 Make PDF transparent (alpha background)\n"); printf("extrafontdata=0/1 Store Type3 characters and capture characters\n"); + printf("fontquality=1..100 Curve approximation quality of the fonts\n"); } } @@ -836,7 +842,7 @@ GFXOutputDev::~GFXOutputDev() free(this->pages); this->pages = 0; } - gfxfontlist_free(this->gfxfontlist, 1); + gfxfontlist_free(this->gfxfontlist, 1);this->gfxfontlist = 0; }; GBool GFXOutputDev::upsideDown() { @@ -850,12 +856,6 @@ GBool GFXOutputDev::useDrawChar() const char*renderModeDesc[]= {"fill", "stroke", "fill+stroke", "invisible", "clip+fill", "stroke+clip", "fill+stroke+clip", "clip"}; -#define RENDER_FILL 0 -#define RENDER_STROKE 1 -#define RENDER_FILLSTROKE 2 -#define RENDER_INVISIBLE 3 -#define RENDER_CLIP 4 - static char tmp_printstr[4096]; char* makeStringPrintable(char*str) { @@ -1097,12 +1097,11 @@ void GFXOutputDev::startPage(int pageNum, GfxState *state, double crop_x1, doubl this->currentpage = pageNum; double x1,y1,x2,y2; int rot = doc->getPageRotate(1); - gfxcolor_t white; + gfxcolor_t white = {255,255,255,255}; + gfxcolor_t black = {255,0,0,0}; laststate = state; gfxline_t clippath[5]; - white.r = white.g = white.b = white.a = 255; - /* state->transform(state->getX1(),state->getY1(),&x1,&y1); state->transform(state->getX2(),state->getY2(),&x2,&y2); Use CropBox, not MediaBox, as page size @@ -1425,7 +1424,7 @@ void GFXOutputDev::updateStrokeColor(GfxState *state) } -gfxfont_t* createGfxFont(GfxFont*xpdffont, FontInfo*src) +gfxfont_t* createGfxFont(GfxFont*xpdffont, FontInfo*src, double config_fontquality) { gfxfont_t*font = (gfxfont_t*)malloc(sizeof(gfxfont_t)); memset(font, 0, sizeof(gfxfont_t)); @@ -1434,7 +1433,8 @@ gfxfont_t* createGfxFont(GfxFont*xpdffont, FontInfo*src) memset(font->glyphs, 0, sizeof(gfxglyph_t)*src->num_glyphs); font->id = strdup(getFontID(xpdffont)); int t; - double quality = (INTERNAL_FONT_SIZE * 0.05) / src->max_size; + + double quality = (INTERNAL_FONT_SIZE * 200 / config_fontquality) / src->max_size; double scale = 1; //printf("%d glyphs\n", font->num_glyphs); font->num_glyphs = 0; @@ -1525,7 +1525,7 @@ void GFXOutputDev::updateFont(GfxState *state) gfxfont_t*font = gfxfontlist_findfont(this->gfxfontlist,id); if(!font) { - font = createGfxFont(gfxFont, current_fontinfo); + font = createGfxFont(gfxFont, current_fontinfo, this->config_fontquality); font->id = strdup(id); this->gfxfontlist = gfxfontlist_addfont(this->gfxfontlist, font); device->addfont(device, font);