git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed segfault
[swftools.git]
/
lib
/
xpdf
/
GFXOutputDev.cc
diff --git
a/lib/xpdf/GFXOutputDev.cc
b/lib/xpdf/GFXOutputDev.cc
index
7eed590
..
bc7987b
100644
(file)
--- 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->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);
/* 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("<warning> Ignored Paramter %s=%s", p->name, p->value);
}
p = p->next;
}
}
p = p->next;
}
@@
-200,7
+200,16
@@
GFXOutputDev::GFXOutputDev(parameter_t*p)
void GFXOutputDev::setDevice(gfxdevice_t*dev)
{
void GFXOutputDev::setDevice(gfxdevice_t*dev)
{
+ parameter_t*p = this->parameters;
+
+ /* TODO: get rid of this */
this->device = dev;
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)
}
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);
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, '+');
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);
void GFXOutputDev::fillGfxLine(GfxState *state, gfxline_t*line)
{
gfxcolor_t col = getFillColor(state);
-
+
if(getLogLevel() >= LOGLEVEL_TRACE) {
msg("<trace> fill %02x%02x%02x%02x\n", col.r, col.g, col.b, col.a);
dump_outline(line);
}
if(getLogLevel() >= LOGLEVEL_TRACE) {
msg("<trace> 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)
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);
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;
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;
if the ligature doesn't exist, we need to draw
the characters one-by-one. */
int t;
- msg("<warning> ligature %d missing in font %s\n", c, current_font_id);
+ msg("<warning> ligature %d missing in font %s\n", c, current_gfxfont->id);
for(t=0;t<uLen;t++) {
drawChar(state, x, y, dx, dy, originX, originY, c, nBytes, _u+t, 1);
}
for(t=0;t<uLen;t++) {
drawChar(state, x, y, dx, dy, originX, originY, c, nBytes, _u+t, 1);
}
@@
-961,7
+971,7
@@
void GFXOutputDev::drawChar(GfxState *state, double x, double y,
}
if(charid<0) {
msg("<warning> Didn't find character '%s' (c=%d,u=%d) in current charset (%s, %d characters)",
}
if(charid<0) {
msg("<warning> 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;
}
return;
}
@@
-971,7
+981,7
@@
void GFXOutputDev::drawChar(GfxState *state, double x, double y,
m.ty += user_movey;
if(render == RENDER_FILL) {
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("<debug> Drawing glyph %d as shape", charid);
if(!textmodeinfo) {
} else {
msg("<debug> 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;
gfxfont_t*font = 0;
fontlist_t*last=0,*l = this->fontlist;
+ if(!id)
+ msg("<error> Internal Error: FontID is null");
+
/* TODO: should this be part of the state? */
while(l) {
last = l;
/* 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;
current_gfxfont = l->font;
font = l->font;
- device->addfont(device, id, current_gfxfont);
+ device->addfont(device, current_gfxfont);
return 1;
}
l = l->next;
return 1;
}
l = l->next;
@@
-1704,22
+1716,20
@@
int GFXOutputDev::setGfxFont(char*id, char*name, char*filename, double maxSize)
double quality = (1024 * 0.05) / maxSize;
msg("<verbose> Loading %s...", filename);
double quality = (1024 * 0.05) / maxSize;
msg("<verbose> Loading %s...", filename);
- font = gfxfont_load(filename, quality);
- msg("<verbose> Font %s loaded successfully", filename);
+ font = gfxfont_load(id, filename, quality);
+ msg("<verbose> Font %s (%s) loaded successfully", filename, id);
l = new fontlist_t;
l->font = font;
l->filename = strdup(filename);
l = new fontlist_t;
l->font = font;
l->filename = strdup(filename);
- l->id = strdup(id);
l->next = 0;
l->next = 0;
- current_font_id = l->id;
current_gfxfont = l->font;
if(last) {
last->next = l;
} else {
this->fontlist = l;
}
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;
}
return 1;
}