From d13c78984c1007a56e52cdf7fed9d3a8205a2d45 Mon Sep 17 00:00:00 2001 From: kramm Date: Mon, 16 Aug 2004 08:37:41 +0000 Subject: [PATCH] added logging of glyph bounding boxes. --- pdf2swf/swfoutput.cc | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/pdf2swf/swfoutput.cc b/pdf2swf/swfoutput.cc index a007e80..9abde43 100644 --- a/pdf2swf/swfoutput.cc +++ b/pdf2swf/swfoutput.cc @@ -119,11 +119,17 @@ static int moveto(TAG*tag, plotxy p0) // write a line-to command into the swf static void lineto(TAG*tag, plotxy p0) { - int rx = ((int)(p0.x*20)-swflastx); - int ry = ((int)(p0.y*20)-swflasty); + int px = (int)(p0.x*20); + int py = (int)(p0.y*20); + int rx = (px-swflastx); + int ry = (py-swflasty); /* we can't skip this for rx=0,ry=0, those are plots */ swf_ShapeSetLine (tag, shape, rx,ry); + + //swf_ExpandRect3(boundingBox, px, py, linewidth); + //swf_ExpandRect3(boundingBox, swflastx, swflasty, linewidth); + shapeisempty = 0; swflastx+=rx; swflasty+=ry; @@ -1032,11 +1038,6 @@ int getCharID(SWFFONT *font, int charnr, char *charname, int u) } if(u>0) { - if(u>=font->maxascii) - msg(" u=%d, font->maxascii=%d",u,font->maxascii); - else - msg(" u=%d, font->maxascii=%d ascci2glyph[%d]=%d",u,font->maxascii,u,font->ascii2glyph[u]); - /* try to use the unicode id */ if(u>=0 && umaxascii && font->ascii2glyph[u]>=0) { return font->ascii2glyph[u]; @@ -1106,7 +1107,12 @@ void swfoutput_setfont(struct swfoutput*obj, char*fontid, char*filename) msg(" | Style: %d", swffont->style); msg(" | Encoding: %d", swffont->encoding); for(int iii=0; iiinumchars;iii++) { - msg(" | Glyph %d) name=%s, unicode=%d\n", iii, swffont->glyphnames[iii], swffont->glyph2ascii[iii]); + msg(" | Glyph %d) name=%s, unicode=%d size=%d bbox=(%.2f,%.2f,%.2f,%.2f)\n", iii, swffont->glyphnames[iii], swffont->glyph2ascii[iii], swffont->glyph[iii].shape->bitlen, + swffont->layout->bounds[iii].xmin/20.0, + swffont->layout->bounds[iii].ymin/20.0, + swffont->layout->bounds[iii].xmax/20.0, + swffont->layout->bounds[iii].ymax/20.0 + ); } } -- 1.7.10.4