X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=lib%2Fxpdf%2FGFXOutputDev.cc;h=cddffd2218b9dfc9328ba1866f8beedcf110deee;hb=b76b027984afbadc9e060477a783a4d71f426298;hp=7eed5902638d10bea8dc7e5b8e8c5655b5adc7df;hpb=1279e7201aaf80eca58ad982ec11de68c85631af;p=swftools.git diff --git a/lib/xpdf/GFXOutputDev.cc b/lib/xpdf/GFXOutputDev.cc index 7eed590..cddffd2 100644 --- a/lib/xpdf/GFXOutputDev.cc +++ b/lib/xpdf/GFXOutputDev.cc @@ -185,14 +185,14 @@ GFXOutputDev::GFXOutputDev(parameter_t*p) this->forceType0Fonts=1; this->config_use_fontconfig=1; + this->parameters = p; + /* configure device */ while(p) { if(!strcmp(p->name,"forceType0Fonts")) { this->forceType0Fonts = atoi(p->value); } else if(!strcmp(p->name,"fontconfig")) { this->config_use_fontconfig = atoi(p->value); - } else { - msg(" Ignored Paramter %s=%s", p->name, p->value); } p = p->next; } @@ -200,7 +200,16 @@ GFXOutputDev::GFXOutputDev(parameter_t*p) void GFXOutputDev::setDevice(gfxdevice_t*dev) { + parameter_t*p = this->parameters; + + /* TODO: get rid of this */ this->device = dev; + if(this->device) { + while(p) { + this->device->setparameter(this->device, p->name, p->value); + p = p->next; + } + } } void GFXOutputDev::setMove(int x,int y) @@ -244,8 +253,9 @@ static char*getFontName(GfxFont*font) Ref*r=font->getID(); sprintf(buf, "UFONT%d", r->num); fontid = strdup(buf); + } else { + fontid = strdup(fname); } - fontid = strdup(fname); char*fontname= 0; char* plus = strchr(fontid, '+'); @@ -647,11 +657,12 @@ gfxcolor_t getFillColor(GfxState * state) void GFXOutputDev::fillGfxLine(GfxState *state, gfxline_t*line) { gfxcolor_t col = getFillColor(state); - + if(getLogLevel() >= LOGLEVEL_TRACE) { msg(" fill %02x%02x%02x%02x\n", col.r, col.g, col.b, col.a); dump_outline(line); } + device->fill(device, line, &col); } void GFXOutputDev::fill(GfxState *state) @@ -743,7 +754,6 @@ GFXOutputDev::~GFXOutputDev() fontlist_t*next = l->next; l->next = 0; gfxfont_free(l->font); - free(l->id);l->id=0; free(l->filename);l->filename=0; free(l); l = next; @@ -952,7 +962,7 @@ void GFXOutputDev::drawChar(GfxState *state, double x, double y, if the ligature doesn't exist, we need to draw the characters one-by-one. */ int t; - msg(" ligature %d missing in font %s\n", c, current_font_id); + msg(" ligature %d missing in font %s\n", c, current_gfxfont->id); for(t=0;t Didn't find character '%s' (c=%d,u=%d) in current charset (%s, %d characters)", - FIXNULL(name),c, u, FIXNULL((char*)current_font_id), current_gfxfont->num_glyphs); + FIXNULL(name),c, u, FIXNULL((char*)current_gfxfont->id), current_gfxfont->num_glyphs); return; } @@ -971,7 +981,7 @@ void GFXOutputDev::drawChar(GfxState *state, double x, double y, m.ty += user_movey; if(render == RENDER_FILL) { - device->drawchar(device, current_font_id, charid, &col, &m); + device->drawchar(device, current_gfxfont, charid, &col, &m); } else { msg(" Drawing glyph %d as shape", charid); if(!textmodeinfo) { @@ -1683,14 +1693,16 @@ int GFXOutputDev::setGfxFont(char*id, char*name, char*filename, double maxSize) gfxfont_t*font = 0; fontlist_t*last=0,*l = this->fontlist; + if(!id) + msg(" Internal Error: FontID is null"); + /* TODO: should this be part of the state? */ while(l) { last = l; - if(!strcmp(l->id, id)) { - current_font_id = l->id; + if(!strcmp(l->font->id, id)) { current_gfxfont = l->font; font = l->font; - device->addfont(device, id, current_gfxfont); + device->addfont(device, current_gfxfont); return 1; } l = l->next; @@ -1704,22 +1716,24 @@ int GFXOutputDev::setGfxFont(char*id, char*name, char*filename, double maxSize) double quality = (1024 * 0.05) / maxSize; msg(" Loading %s...", filename); - font = gfxfont_load(filename, quality); - msg(" Font %s loaded successfully", filename); + font = gfxfont_load(id, filename, quality); + if(!font) { + msg(" Couldn't load Font %s (%s)", filename, id); + return 0; + } + msg(" Font %s (%s) loaded successfully", filename, id); l = new fontlist_t; l->font = font; l->filename = strdup(filename); - l->id = strdup(id); l->next = 0; - current_font_id = l->id; current_gfxfont = l->font; if(last) { last->next = l; } else { this->fontlist = l; } - device->addfont(device, id, current_gfxfont); + device->addfont(device, current_gfxfont); return 1; } @@ -2209,8 +2223,6 @@ void GFXOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, GBool inlineImg) { - if(states[statepos].textRender & 4) //clipped - return; msg(" drawImageMask %dx%d, invert=%d inline=%d", width, height, invert, inlineImg); drawGeneralImage(state,ref,str,width,height,0,invert,inlineImg,1, 0, 0,0,0,0, 0); } @@ -2219,9 +2231,6 @@ void GFXOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, int *maskColors, GBool inlineImg) { - if(states[statepos].textRender & 4) //clipped - return; - msg(" drawImage %dx%d, %s, %s, inline=%d", width, height, colorMap?"colorMap":"no colorMap", maskColors?"maskColors":"no maskColors", @@ -2238,9 +2247,6 @@ void GFXOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert) { - if(states[statepos].textRender & 4) //clipped - return; - msg(" drawMaskedImage %dx%d, %s, %dx%d mask", width, height, colorMap?"colorMap":"no colorMap", maskWidth, maskHeight); @@ -2257,9 +2263,6 @@ void GFXOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap) { - if(states[statepos].textRender & 4) //clipped - return; - msg(" drawSoftMaskedImage %dx%d, %s, %dx%d mask", width, height, colorMap?"colorMap":"no colorMap", maskWidth, maskHeight);