static int flatten = 0;
+static char* filters = 0;
+
char* fontpaths[256];
int fontpathpos = 0;
}
else if (!strcmp(name, "s"))
{
- char*s = strdup(val);
+ char*s = val;
char*c = strchr(s, '=');
if(c && *c && c[1]) {
*c = 0;
store_parameter("extrafontdata", "1");
return 0;
}
+ else if (!strcmp(name, "ff"))
+ {
+ if(filters) {
+ // append this to the current filter expression (we allow more than one --filter)
+ int l = strlen(filters);
+ int new_len = l + strlen(val) + 2;
+ filters = (char*)realloc(filters, new_len);
+ filters[l] = ':';
+ strcpy(filters+l+1, val);
+ } else {
+ filters = strdup(val);
+ }
+ return 1;
+ }
else if (!strcmp(name, "w"))
{
store_parameter("linksopennewwindow", "0");
{"t", "stop"},
{"T", "flashversion"},
{"F", "fontdir"},
+{"ff", "filter"},
{"b", "defaultviewer"},
{"l", "defaultloader"},
{"B", "viewer"},
out = &rescale;
}
+ if(filters) {
+ gfxfilterchain_t*chain = gfxfilterchain_parse(filters);
+ if(!chain) {
+ fprintf(stderr, "Unable to parse filters: %s\n", filters);
+ exit(1);
+ }
+ out = gfxfilterchain_apply(chain, out);
+ gfxfilterchain_destroy(chain);
+ }
+
/* pass global parameters to output device */
parameter_t*p = device_config;
while(p) {
p->next = 0;free(p);
p = next;
}
+ if(filters) {
+ free(filters);
+ }
return 0;
}