- virtual void startPage(int pageNum, GfxState *state) ;
+ virtual void startPage(int pageNum, GfxState *state, double x1, double y1, double x2, double y2) ;
+char*getFontName(GfxFont*font)
+{
+ GString*gstr = font->getName();
+ char* fontname = gstr==0?0:gstr->getCString();
+ if(fontname==0) {
+ char buf[32];
+ Ref*r=font->getID();
+ sprintf(buf, "UFONT%d", r->num);
+ return strdup(buf);
+ }
+ char* plus = strchr(fontname, '+');
+ if(plus && plus < &fontname[strlen(fontname)-1])
+ fontname = plus+1;
+ return fontname;
+}
+
if(state->getLineJoin()!=0)
bufpos+=sprintf(bufpos,"ML%d ", state->getMiterLimit());
if(state->getLineJoin()!=0)
bufpos+=sprintf(bufpos,"ML%d ", state->getMiterLimit());
- if(state->getFont() && state->getFont()->getName() && state->getFont()->getName()->getCString())
- bufpos+=sprintf(bufpos,"F\"%s\" ",((state->getFont())->getName())->getCString());
+ if(state->getFont() && getFontName(state->getFont()))
+ bufpos+=sprintf(bufpos,"F\"%s\" ",getFontName(state->getFont()));
bufpos+=sprintf(bufpos,"FS%.1f ", state->getFontSize());
bufpos+=sprintf(bufpos,"MAT[%.1f/%.1f/%.1f/%.1f/%.1f/%.1f] ", state->getTextMat()[0],state->getTextMat()[1],state->getTextMat()[2],
state->getTextMat()[3],state->getTextMat()[4],state->getTextMat()[5]);
bufpos+=sprintf(bufpos,"FS%.1f ", state->getFontSize());
bufpos+=sprintf(bufpos,"MAT[%.1f/%.1f/%.1f/%.1f/%.1f/%.1f] ", state->getTextMat()[0],state->getTextMat()[1],state->getTextMat()[2],
state->getTextMat()[3],state->getTextMat()[4],state->getTextMat()[5]);
- msg("%s=========== %s (ID:%d,%d) ==========\n", loglevel, gstr?FIXNULL(gstr->getCString()):"(unknown font)", r->num,r->gen);
+ msg("%s=========== %s (ID:%d,%d) ==========\n", loglevel, name, r->num,r->gen);
- gstr = font->getTag();
- if(gstr)
- msg("%sTag: %s\n", loglevel, FIXNULL(gstr->getCString()));
+ GString*gstr = font->getTag();
+
+ msg("%sTag: %s\n", loglevel, name);
- msg("<debug> drawChar(%f,%f,%f,%f,'%c',%d)\n",x,y,dx,dy,c,u);
+ msg("<debug> drawChar(%f,%f,%f,%f,'%c',%d) CID=%d\n",x,y,dx,dy,c,u, font->isCIDFont());
if(name)
swfoutput_drawchar(&output, x1, y1, name, c);
if(name)
swfoutput_drawchar(&output, x1, y1, name, c);
msg("<warning> couldn't get name for CID character %02x from Encoding", c);
swfoutput_drawchar(&output, x1, y1, "<unknown>", c);
msg("<warning> couldn't get name for CID character %02x from Encoding", c);
swfoutput_drawchar(&output, x1, y1, "<unknown>", c);
-void SWFOutputDev::startPage(int pageNum, GfxState *state)
+void SWFOutputDev::startPage(int pageNum, GfxState *state, double crop_x1, double crop_y1, double crop_x2, double crop_y2)
- msg("<debug> startPage %d\n", pageNum);
+ msg("<verbose> startPage %d (%f,%f,%f,%f)\n", pageNum, crop_x1, crop_y1, crop_x2, crop_y2);
- state->transform(state->getX1(),state->getY1(),&x1,&y1);
+ /* state->transform(state->getX1(),state->getY1(),&x1,&y1);
state->transform(state->getX2(),state->getY2(),&x2,&y2);
state->transform(state->getX2(),state->getY2(),&x2,&y2);
if(!outputstarted) {
msg("<verbose> Bounding box is (%f,%f)-(%f,%f)", x1,y1,x2,y2);
if(!outputstarted) {
msg("<verbose> Bounding box is (%f,%f)-(%f,%f)", x1,y1,x2,y2);
- swfoutput_init(&output, swffilename, abs((int)(x2-x1)),abs((int)(y2-y1)));
+ swfoutput_init(&output, swffilename,(int)x1,(int)y1,(int)x2,(int)y2);
if (!(fontBuf = font->readEmbFontFile(xref, &fontLen))) {
fclose(f);
msg("<error> Couldn't read embedded font file");
if (!(fontBuf = font->readEmbFontFile(xref, &fontLen))) {
fclose(f);
msg("<error> Couldn't read embedded font file");
"-b", tmpFileName, name2};
msg("<verbose> Invoking %s %s %s %s %s %s %s %s",a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]);
ttf2pt1_main(8,a);
"-b", tmpFileName, name2};
msg("<verbose> Invoking %s %s %s %s %s %s %s %s",a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]);
ttf2pt1_main(8,a);
sprintf(name2,"%s.pfb",tmp);
tmpFileName = strdup(name2);
}
sprintf(name2,"%s.pfb",tmp);
tmpFileName = strdup(name2);
}
-char* gfxFontName(GfxFont* gfxFont)
-{
- GString *gstr;
- gstr = gfxFont->getName();
- if(gstr) {
- return gstr->getCString();
- }
- else {
- char buf[32];
- Ref*r=gfxFont->getID();
- sprintf(buf, "UFONT%d", r->num);
- return strdup(buf);
- }
-}