X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fpdf%2FGFXOutputDev.cc;h=af891cbf21b07b1ce2e9c5da211b0e333d668d7c;hb=42ba5ad2e5f1a05f81e2b057bbc65b4d9d8f8eda;hp=441a92b003e72bd1f4c2779baba3af01c311b43c;hpb=711659af8759d3939ef395e04f81191a43049a19;p=swftools.git diff --git a/lib/pdf/GFXOutputDev.cc b/lib/pdf/GFXOutputDev.cc index 441a92b..af891cb 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; }