X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fpdf%2FGFXOutputDev.cc;h=84a4635dc4abe9f38c3762dc8495fbea3602c818;hb=e0cdf06c7b589679774f0361071468a317ccb8f4;hp=441a92b003e72bd1f4c2779baba3af01c311b43c;hpb=711659af8759d3939ef395e04f81191a43049a19;p=swftools.git diff --git a/lib/pdf/GFXOutputDev.cc b/lib/pdf/GFXOutputDev.cc index 441a92b..84a4635 100644 --- a/lib/pdf/GFXOutputDev.cc +++ b/lib/pdf/GFXOutputDev.cc @@ -335,6 +335,19 @@ GFXGlobalParams::~GFXGlobalParams() #endif } #ifdef HAVE_FONTCONFIG +static char stralphacmp(const char*s1, const char*s2) +{ + while(*s1 && *s2) { + /* skip over space, minus, comma etc. */ + while(*s1>=32 && *s1<=63) s1++; + while(*s2>=32 && *s2<=63) s2++; + if(*s1!=*s2) + break; + s1++;s2++; + } + return *s1 - *s2; +} + static char fc_ismatch(FcPattern*match, char*family, char*style) { char*fcfamily=0,*fcstyle=0,*fcfullname=0,*filename=0; @@ -348,7 +361,7 @@ static char fc_ismatch(FcPattern*match, char*family, char*style) if(scalable!=FcTrue || outline!=FcTrue) return 0; - if (!strcasecmp(fcfamily, family)) { + if (!stralphacmp(fcfamily, family)) { msg(" Font %s-%s (%s) is a match for %s%s%s", fcfamily, fcstyle, filename, family, style?"-":"", style?style:""); return 1; } else { @@ -612,6 +625,7 @@ GFXOutputDev::GFXOutputDev(InfoOutputDev*info, PDFDoc*doc) this->config_drawonlyshapes = 0; this->config_disable_polygon_conversion = 0; this->config_multiply = 1; + this->config_linkdatafile = 0; this->page2page = 0; this->num_pages = 0; @@ -630,6 +644,8 @@ void GFXOutputDev::setParameter(const char*key, const char*value) this->config_drawonlyshapes = atoi(value); } else if(!strcmp(key,"extrafontdata")) { this->config_extrafontdata = atoi(value); + } else if(!strcmp(key,"linkdatafile")) { + this->config_linkdatafile = strdup(value); } else if(!strcmp(key,"convertgradients")) { this->config_convertgradients = atoi(value); } else if(!strcmp(key,"multiply")) { @@ -1642,6 +1658,12 @@ void GFXOutputDev::startPage(int pageNum, GfxState *state, double crop_x1, doubl states[statepos].dashStart = 0; this->last_char_gfxfont = 0; + + if(this->config_linkdatafile) { + FILE*fi = fopen(config_linkdatafile, "ab+"); + fprintf(fi, "[page %d]\n", pageNum); + fclose(fi); + } } @@ -1830,8 +1852,13 @@ void GFXOutputDev::processLink(Link *link, Catalog *catalog) else if(s) { device->drawlink(device, points, s); + if(this->config_linkdatafile) { + FILE*fi = fopen(config_linkdatafile, "ab+"); + fprintf(fi, "%s\n", s); + fclose(fi); + } } - + msg(" \"%s\" link to \"%s\" (%d)", type, FIXNULL(s), page); free(s);s=0; } @@ -2669,6 +2696,9 @@ void GFXOutputDev::endTransparencyGroup(GfxState *state) dbg("endTransparencyGroup this->device now back to %08x (destroying %08x)", states[statepos].olddevice, this->device); + while(statepos && !states[statepos].olddevice) + --statepos; + this->device = states[statepos].olddevice; if(!this->device) { msg(" Invalid state nesting");