#include "../devices/ops.h"
#include "../devices/arts.h"
#include "../devices/render.h"
+
+#include "../art/libart.h"
+#include "../devices/artsutils.c"
+
#include "../png.h"
#include "fonts.h"
GBool GFXOutputDev::interpretType3Chars()
{
- return gTrue;
+ return this->do_interpretType3Chars;
}
typedef struct _drawnchar
this->pagepos = 0;
this->config_use_fontconfig=1;
this->config_break_on_warning=0;
+ this->do_interpretType3Chars = gTrue;
this->parameters = p;
/* configure device */
while(p) {
- if(!strcmp(p->name,"fontconfig")) {
- this->config_use_fontconfig = atoi(p->value);
- } else if(!strcmp(p->name,"breakonwarning")) {
- this->config_break_on_warning = atoi(p->value);
- }
+ setParameter(p->name, p->value);
p = p->next;
}
};
+
+void GFXOutputDev::setParameter(char*key, char*value)
+{
+ if(!strcmp(key,"rawtext")) {
+ this->do_interpretType3Chars = atoi(value)^1;
+ } else if(!strcmp(key,"breakonwarning")) {
+ this->config_break_on_warning = atoi(value);
+ } else if(!strcmp(key,"fontconfig")) {
+ this->config_use_fontconfig = atoi(value);
+ } else {
+ msg("<warning> Ignored parameter: %s=%s", key, value);
+ }
+}
void GFXOutputDev::setDevice(gfxdevice_t*dev)
{
else if(nr == 1)
msg("<warning> The following font caused problems (substituting):");
else if(nr == 2)
- msg("<warning> The following Type 3 Font will be rendered as bitmap:");
+ msg("<warning> The following Type 3 Font will be rendered as graphics:");
dumpFontInfo("<warning>", font);
}
return gFalse;
}
-void GFXOutputDev::strokeGfxline(GfxState *state, gfxline_t*line)
+#define STROKE_FILL 1
+#define STROKE_CLIP 2
+void GFXOutputDev::strokeGfxline(GfxState *state, gfxline_t*line, int flags)
{
int lineCap = state->getLineCap(); // 0=butt, 1=round 2=square
int lineJoin = state->getLineJoin(); // 0=miter, 1=round 2=bevel
);
dump_outline(line);
}
-
- //swfoutput_drawgfxline(output, line, width, &col, capType, joinType, miterLimit);
- device->stroke(device, line, width, &col, capType, joinType, miterLimit);
+
+ if(flags&STROKE_FILL) {
+ ArtSVP* svp = gfxstrokeToSVP(line, width, capType, joinType, miterLimit);
+ gfxline_t*gfxline = SVPtogfxline(svp);
+ if(flags&STROKE_CLIP) {
+ device->startclip(device, gfxline);
+ states[statepos].clipping++;
+ } else {
+ device->fill(device, gfxline, &col);
+ }
+ free(gfxline);
+ art_svp_free(svp);
+ } else {
+ if(flags&STROKE_CLIP)
+ msg("<error> Stroke&clip not supported at the same time");
+ device->stroke(device, line, width, &col, capType, joinType, miterLimit);
+ }
if(line2)
gfxline_free(line2);
states[statepos].clipping++;
gfxline_free(line);
}
+void GFXOutputDev::clipToStrokePath(GfxState *state)
+{
+ GfxPath * path = state->getPath();
+ gfxline_t*line= gfxPath_to_gfxline(state, path, 0, user_movex + clipmovex, user_movey + clipmovey);
+ strokeGfxline(state, line, STROKE_FILL|STROKE_CLIP);
+ gfxline_free(line);
+}
void GFXOutputDev::endframe()
{
int getGfxCharID(gfxfont_t*font, int charnr, char *charname, int u)
{
char*uniname = 0;
+ if(!font)
+ return charnr;
if(u>0) {
int t;
/* find out char name from unicode index
Gushort *CIDToGIDMap = 0;
GfxFont*font = state->getFont();
- if(font->getType() == fontType3) {
+ if(font->getType() == fontType3 && do_interpretType3Chars) {
/* type 3 chars are passed as graphics */
msg("<debug> type3 char at %f/%f", x, y);
return;
current_text_stroke = 0;
} else if((render&3) == RENDER_FILLSTROKE) {
fillGfxLine(state, current_text_stroke);
- strokeGfxline(state, current_text_stroke);
+ strokeGfxline(state, current_text_stroke,0);
gfxline_free(current_text_stroke);
current_text_stroke = 0;
} else if((render&3) == RENDER_STROKE) {
- strokeGfxline(state, current_text_stroke);
+ strokeGfxline(state, current_text_stroke,0);
gfxline_free(current_text_stroke);
current_text_stroke = 0;
}
type3active = 1;
/*int t;
-
+
gfxcolor_t col={255,0,0,0};
gfxmatrix_t m = {1,0,0, 0,1,0};
GfxPath * path = state->getPath();
gfxline_t*line= gfxPath_to_gfxline(state, path, 0, user_movex + clipmovex, user_movey + clipmovey);
- strokeGfxline(state, line);
+ strokeGfxline(state, line, 0);
gfxline_free(line);
}
#endif
int width = (int)bbox.xmax,height = (int)bbox.ymax;
+ if(width<=0 || height<=0)
+ return;
gfxdevice_t belowrender;
gfxdevice_render_init(&belowrender);