diff options
author | Matthias Kramm <kramm@quiss.org> | 2009-10-26 14:23:50 -0700 |
---|---|---|
committer | Matthias Kramm <kramm@quiss.org> | 2009-10-26 14:23:50 -0700 |
commit | 42fd70a26a2af2431a5782d862017c81fb3b7c4c (patch) | |
tree | cfd80a85cc3c9ed9b5bcfcafada5a22d67c55b74 | |
parent | fe8c4ac75820199184e7061eb405c85c2123e2ea (diff) | |
parent | 2e5b799fa6e0fe9ef61a168e9d1d107ca7f17e32 (diff) |
merged with masterfontalignzones
-rw-r--r-- | lib/Makefile.in | 4 | ||||
-rw-r--r-- | lib/bitio.c | 8 | ||||
-rw-r--r-- | lib/devices/swf.c | 61 | ||||
-rw-r--r-- | lib/gfxdevice.h | 2 | ||||
-rw-r--r-- | lib/gfxpoly.c | 16 | ||||
-rw-r--r-- | lib/gfxpoly/Makefile | 5 | ||||
-rw-r--r-- | lib/gfxpoly/test_stroke.c | 1 | ||||
-rw-r--r-- | lib/modules/swfbits.c | 6 | ||||
-rw-r--r-- | lib/pdf/GFXOutputDev.cc | 23 | ||||
-rw-r--r-- | lib/pdf/InfoOutputDev.h | 1 | ||||
-rw-r--r-- | lib/pdf/XMLOutputDev.cc | 27 | ||||
-rw-r--r-- | lib/rfxswf.c | 20 | ||||
-rw-r--r-- | lib/rfxswf.h | 16 | ||||
-rw-r--r-- | spec/circularfill.spec.rb | 51 | ||||
-rwxr-xr-x | spec/edit_spec.py | 7 | ||||
-rw-r--r-- | spec/gradients.spec.rb | 61 | ||||
-rw-r--r-- | spec/imagematrix.spec.rb | 229 | ||||
-rw-r--r-- | spec/layers.spec.rb | 45 | ||||
-rw-r--r-- | spec/links.spec.rb | 9 | ||||
-rw-r--r-- | spec/miterlimit.spec.rb | 35 | ||||
-rw-r--r-- | spec/pattern.spec.rb | 9 | ||||
-rw-r--r-- | spec/simpletext.spec.rb | 21 | ||||
-rw-r--r-- | spec/smalltext.spec.rb | 23 | ||||
-rw-r--r-- | spec/textarea.spec.rb | 13 | ||||
-rw-r--r-- | spec/textposition.spec.rb | 245 | ||||
-rw-r--r-- | spec/textselectspaces.spec.rb | 3 | ||||
-rw-r--r-- | spec/transpstack.spec.rb | 3 | ||||
-rw-r--r-- | src/pdf2swf.c | 2 | ||||
-rw-r--r-- | src/swfcombine.c | 3 |
29 files changed, 533 insertions, 416 deletions
diff --git a/lib/Makefile.in b/lib/Makefile.in index 630a70f9..ef5a16c6 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -141,15 +141,19 @@ readers/image.$(O): readers/image.c readers/image.h libocr$(A): $(ocr_objects) devices/ocr.$(O) $(AR) r libocr$(A) $(ocr_objects) devices/ocr.$(O) + $(RANLIB) libocr$(A) libbase$(A): $(base_objects) Makefile $(AR) r libbase$(A) $(base_objects) + $(RANLIB) libbase$(A) libgfxswf$(A): devices/swf.$(O) readers/swf2.$(O) readers/image.$(O) $(AR) r libgfxswf$(A) devices/swf.$(O) readers/swf2.$(O) readers/image.$(O) + $(RANLIB) libgfxswf$(A) libgfx$(A): $(gfx_objects) $(gfxpoly_objects) Makefile $(AR) r libgfx$(A) $(gfx_objects) $(gfxpoly_objects) + $(RANLIB) libgfx$(A) librfxswf$(A): Makefile $(rfxswf_objects) rfxswf.$(O) drawer.$(O) MD5.$(O) $(lame_in_source) $(h263_objects) $(as12compiler_in_source) $(as3compiler_objects) Makefile $(AR) r librfxswf$(A) $(rfxswf_objects) rfxswf.$(O) drawer.$(O) MD5.$(O) $(lame_in_source) $(h263_objects) $(as12compiler_in_source) $(as3compiler_objects) diff --git a/lib/bitio.c b/lib/bitio.c index bd549359..442bf488 100644 --- a/lib/bitio.c +++ b/lib/bitio.c @@ -29,6 +29,7 @@ #include <string.h> #include <memory.h> #include <fcntl.h> +#include <errno.h> #include "../config.h" @@ -68,9 +69,14 @@ static int reader_fileread(reader_t*reader, void* data, int len) reader->pos += ret; return ret; } +static void reader_fileread_dealloc(reader_t*r) +{ + memset(r, 0, sizeof(reader_t)); +} void reader_init_filereader(reader_t*r, int handle) { r->read = reader_fileread; + r->dealloc = reader_fileread_dealloc; r->internal = (void*)handle; r->type = READER_TYPE_FILE; r->mybyte = 0; @@ -338,7 +344,7 @@ static void zlib_error(int ret, char* msg, z_stream*zs) msg, ret, zs->msg?zs->msg:"unknown"); - perror("errno:"); + if(errno) perror("errno:"); exit(1); } #endif diff --git a/lib/devices/swf.c b/lib/devices/swf.c index 41bf2838..42bb610f 100644 --- a/lib/devices/swf.c +++ b/lib/devices/swf.c @@ -220,6 +220,10 @@ static void swf_addfont(gfxdevice_t*dev, gfxfont_t*font); static void swf_drawlink(gfxdevice_t*dev, gfxline_t*line, const char*action); static void swf_startframe(gfxdevice_t*dev, int width, int height); static void swf_endframe(gfxdevice_t*dev); +static void swfoutput_namedlink(gfxdevice_t*dev, char*name, gfxline_t*points); +static void swfoutput_linktopage(gfxdevice_t*dev, int page, gfxline_t*points); +static void swfoutput_linktourl(gfxdevice_t*dev, const char*url, gfxline_t*points); + static gfxresult_t* swf_finish(gfxdevice_t*driver); static swfoutput_internal* init_internal_struct() @@ -806,7 +810,7 @@ static charbuffer_t*charbuffer_append(charbuffer_t*buf, SWFFONT*font, int charid If we set it to low, however, the char positions will be inaccurate */ #define GLYPH_SCALE 1 -static void chararray_writetodev(gfxdevice_t*dev, chararray_t*array, MATRIX*matrix) +static void chararray_writetodev(gfxdevice_t*dev, chararray_t*array, MATRIX*matrix, char invisible) { swfoutput_internal*i = (swfoutput_internal*)dev->internal; @@ -838,15 +842,20 @@ static void chararray_writetodev(gfxdevice_t*dev, chararray_t*array, MATRIX*matr //swf_SetU32(i->tag, 0x800000);//sharpness swf_SetU8(i->tag, 0);//reserved } - i->tag = swf_InsertTag(i->tag,ST_PLACEOBJECT2); - swf_ObjectPlace(i->tag,textid,getNewDepth(dev),&i->page_matrix,NULL,NULL); + if(invisible && i->config_flashversion>=8) { + i->tag = swf_InsertTag(i->tag,ST_PLACEOBJECT3); + swf_ObjectPlaceBlend(i->tag,textid,getNewDepth(dev),&i->page_matrix,NULL,NULL,BLENDMODE_MULTIPLY); + } else { + i->tag = swf_InsertTag(i->tag,ST_PLACEOBJECT2); + swf_ObjectPlace(i->tag,textid,getNewDepth(dev),&i->page_matrix,NULL,NULL); + } } -static void charbuffer_writetodevandfree(gfxdevice_t*dev, charbuffer_t*buf) +static void charbuffer_writetodevandfree(gfxdevice_t*dev, charbuffer_t*buf, char invisible) { while(buf) { charbuffer_t*next = buf->next;buf->next = 0; - chararray_writetodev(dev, buf->array, &buf->matrix); + chararray_writetodev(dev, buf->array, &buf->matrix, invisible); chararray_destroy(buf->array); free(buf); buf = next; @@ -858,7 +867,7 @@ static void endtext(gfxdevice_t*dev) swfoutput_internal*i = (swfoutput_internal*)dev->internal; if(!i->textmode) return; - charbuffer_writetodevandfree(dev, i->chardata);i->chardata = 0; + charbuffer_writetodevandfree(dev, i->chardata, 0);i->chardata = 0; i->textmode = 0; } @@ -946,7 +955,7 @@ static void endpage(gfxdevice_t*dev) if(i->textmode) endtext(dev); if(i->topchardata) { - charbuffer_writetodevandfree(dev, i->topchardata); + charbuffer_writetodevandfree(dev, i->topchardata, 1); i->topchardata=0; } @@ -1505,7 +1514,7 @@ void swfoutput_finalize(gfxdevice_t*dev) /* Add AVM2 actionscript */ if(i->config_flashversion>=9 && - (i->config_insertstoptag || i->hasbuttons)) { + (i->config_insertstoptag || i->hasbuttons) && !i->config_linknameurl) { swf_AddButtonLinks(i->swf, i->config_insertstoptag, i->config_internallinkfunction||i->config_externallinkfunction); } @@ -1644,7 +1653,7 @@ static void swfoutput_setlinewidth(gfxdevice_t*dev, double _linewidth) } -static void drawlink(gfxdevice_t*dev, ActionTAG*,ActionTAG*, gfxline_t*points, char mouseover, const char*url); +static void drawlink(gfxdevice_t*dev, ActionTAG*,ActionTAG*, gfxline_t*points, char mouseover, char*type, const char*url); static void swfoutput_namedlink(gfxdevice_t*dev, char*name, gfxline_t*points); static void swfoutput_linktopage(gfxdevice_t*dev, int page, gfxline_t*points); static void swfoutput_linktourl(gfxdevice_t*dev, const char*url, gfxline_t*points); @@ -1710,8 +1719,8 @@ void swfoutput_linktourl(gfxdevice_t*dev, const char*url, gfxline_t*points) } actions = action_End(actions); - drawlink(dev, actions, 0, points, 0, url); - + drawlink(dev, actions, 0, points, 0, "url", url); + swf_ActionFree(actions); } void swfoutput_linktopage(gfxdevice_t*dev, int page, gfxline_t*points) @@ -1738,7 +1747,7 @@ void swfoutput_linktopage(gfxdevice_t*dev, int page, gfxline_t*points) char name[80]; sprintf(name, "page%d", page); - drawlink(dev, actions, 0, points, 0, name); + drawlink(dev, actions, 0, points, 0, "page", name); swf_ActionFree(actions); } @@ -1758,6 +1767,7 @@ void swfoutput_namedlink(gfxdevice_t*dev, char*name, gfxline_t*points) if(i->textmode) endtext(dev); + char*type = 0; if(!strncmp(tmp, "call:", 5)) { char*x = strchr(&tmp[5], ':'); @@ -1776,6 +1786,7 @@ void swfoutput_namedlink(gfxdevice_t*dev, char*name, gfxline_t*points) } actions2 = action_End(0); mouseover = 0; + type = "call"; } else { @@ -1788,9 +1799,10 @@ void swfoutput_namedlink(gfxdevice_t*dev, char*name, gfxline_t*points) actions2 = action_PushString(actions2, ""); actions2 = action_SetVariable(actions2); actions2 = action_End(actions2); + type = "subtitle"; } - drawlink(dev, actions1, actions2, points, mouseover, name); + drawlink(dev, actions1, actions2, points, mouseover, type, name); swf_ActionFree(actions1); swf_ActionFree(actions2); @@ -1837,7 +1849,7 @@ static void drawgfxline(gfxdevice_t*dev, gfxline_t*line, int fill) } -static void drawlink(gfxdevice_t*dev, ActionTAG*actions1, ActionTAG*actions2, gfxline_t*points, char mouseover, const char*url) +static void drawlink(gfxdevice_t*dev, ActionTAG*actions1, ActionTAG*actions2, gfxline_t*points, char mouseover, char*type, const char*url) { swfoutput_internal*i = (swfoutput_internal*)dev->internal; RGBA rgb; @@ -1851,6 +1863,11 @@ static void drawlink(gfxdevice_t*dev, ActionTAG*actions1, ActionTAG*actions2, gf int buttonid = getNewID(dev); gfxbbox_t bbox = gfxline_getbbox(points); + if(i->config_linknameurl) { + actions1 = 0; + actions2 = 0; + } + i->hasbuttons = 1; /* shape */ @@ -1934,10 +1951,14 @@ static void drawlink(gfxdevice_t*dev, ActionTAG*actions1, ActionTAG*actions2, gf swf_ButtonPostProcess(i->tag, 1); } } + char buf[80]; + char*buf2 = 0; const char* name = 0; if(i->config_linknameurl) { - name = url; + buf2 = malloc(strlen(type)+strlen(url)+2); + sprintf(buf2, "%s:%s", type, url); + name = buf2; } else { name = buf; sprintf(buf, "button%d", buttonid); @@ -1959,6 +1980,9 @@ static void drawlink(gfxdevice_t*dev, ActionTAG*actions1, ActionTAG*actions2, gf } else { swf_ObjectPlace(i->tag, buttonid, getNewDepth(dev),&i->page_matrix,0,(U8*)name); } + + if(buf2) + free(buf2); } @@ -3082,7 +3106,12 @@ static void swf_drawchar(gfxdevice_t*dev, gfxfont_t*font, int glyph, gfxcolor_t* glyph, i->swffont->id, x, y, color->r, color->g, color->b, color->a); if(color->a == 0 && i->config_invisibletexttofront) { - i->topchardata = charbuffer_append(i->topchardata, i->swffont, glyph, x, y, i->current_font_size, *(RGBA*)color, &i->fontmatrix); + RGBA color2 = *(RGBA*)color; + if(i->config_flashversion>=8) { + // use "multiply" blend mode + color2.a = color2.r = color2.g = color2.b = 255; + } + i->topchardata = charbuffer_append(i->topchardata, i->swffont, glyph, x, y, i->current_font_size, color2, &i->fontmatrix); } else { i->chardata = charbuffer_append(i->chardata, i->swffont, glyph, x, y, i->current_font_size, *(RGBA*)color, &i->fontmatrix); } diff --git a/lib/gfxdevice.h b/lib/gfxdevice.h index caaa983e..2e508bf6 100644 --- a/lib/gfxdevice.h +++ b/lib/gfxdevice.h @@ -114,7 +114,7 @@ typedef struct _gfxdevice void (*fillbitmap)(struct _gfxdevice*dev, gfxline_t*line, gfximage_t*img, gfxmatrix_t*imgcoord2devcoord, gfxcxform_t*cxform); //cxform? tiling? void (*fillgradient)(struct _gfxdevice*dev, gfxline_t*line, gfxgradient_t*gradient, gfxgradienttype_t type, gfxmatrix_t*gradcoord2devcoord); //? - /* deprecated */ void (*addfont)(struct _gfxdevice*dev, gfxfont_t*font); + void (*addfont)(struct _gfxdevice*dev, gfxfont_t*font); void (*drawchar)(struct _gfxdevice*dev, gfxfont_t*font, int glyph, gfxcolor_t*color, gfxmatrix_t*matrix); diff --git a/lib/gfxpoly.c b/lib/gfxpoly.c index dd97ff43..a687e630 100644 --- a/lib/gfxpoly.c +++ b/lib/gfxpoly.c @@ -911,7 +911,7 @@ static ArtSVP* gfxfillToSVP(gfxline_t*line, int perturb) //#ifdef SHEAR // double shear = find_shear_value(svp); -// gfxline_t*line = gfxpoly_to_gfxline((gfxpoly_t*)svp); +// gfxline_t*line = gfxline_from_gfxpoly((gfxpoly_t*)svp); // gfxline_t*l = line; // while(l) { // l->y += l->x*shear; @@ -963,7 +963,7 @@ ArtSVP* run_intersector(ArtSVP*svp, ArtWindRule rule) return result; } -gfxline_t* gfxpoly_to_gfxline(gfxpoly_t*poly) +gfxline_t* gfxline_from_gfxpoly(gfxpoly_t*poly) { ArtSVP*svp = (ArtSVP*)poly; int size = 0; @@ -998,7 +998,7 @@ gfxline_t* gfxpoly_to_gfxline(gfxpoly_t*poly) } } -gfxpoly_t* gfxpoly_fillToPoly(gfxline_t*line) +gfxpoly_t* gfxpoly_from_fill(gfxline_t*line, double gridsize) { /* I'm not sure whether doing perturbation here is actually a good idea- if that line has been run through the machinery @@ -1098,7 +1098,7 @@ gfxpoly_t* gfxpoly_union(gfxpoly_t*poly1, gfxpoly_t*poly2) return (gfxpoly_t*)svp; } -gfxpoly_t* gfxpoly_strokeToPoly(gfxline_t*line, gfxcoord_t width, gfx_capType cap_style, gfx_joinType joint_style, double miterLimit) +gfxpoly_t* gfxpoly_from_stroke(gfxline_t*line, gfxcoord_t width, gfx_capType cap_style, gfx_joinType joint_style, double miterLimit, double gridsize) { ArtVpath* vec = gfxline_to_ArtVpath(line, 0); msg("<verbose> Casting gfxline of %d segments to a stroke-polygon", gfxline_len(line)); @@ -1122,7 +1122,7 @@ gfxpoly_t* gfxpoly_strokeToPoly(gfxline_t*line, gfxcoord_t width, gfx_capType ca return (gfxpoly_t*)svp; } -gfxline_t* gfxline_circularToEvenOdd(gfxline_t*line) +gfxline_t* gfxpoly_circular_to_evenodd(gfxline_t*line, double gridsize) { msg("<verbose> Converting circular-filled gfxline of %d segments to even-odd filled gfxline", gfxline_len(line)); ArtSVP* svp = gfxfillToSVP(line, 1); @@ -1135,13 +1135,13 @@ gfxline_t* gfxline_circularToEvenOdd(gfxline_t*line) return 0; } - gfxline_t* result = gfxpoly_to_gfxline((gfxpoly_t*)svp_rewinded); + gfxline_t* result = gfxline_from_gfxpoly((gfxpoly_t*)svp_rewinded); art_svp_free(svp); art_svp_free(svp_rewinded); return result; } -gfxpoly_t* gfxpoly_createbox(double x1, double y1,double x2, double y2) +gfxpoly_t* gfxpoly_createbox(double x1, double y1,double x2, double y2, double gridsize) { ArtVpath *vec = art_new (ArtVpath, 5+1); vec[0].code = ART_MOVETO; @@ -1167,7 +1167,7 @@ gfxpoly_t* gfxpoly_createbox(double x1, double y1,double x2, double y2) return (gfxpoly_t*)svp; } -void gfxpoly_free(gfxpoly_t*poly) +void gfxpoly_destroy(gfxpoly_t*poly) { ArtSVP*svp = (ArtSVP*)poly; art_svp_free(svp); diff --git a/lib/gfxpoly/Makefile b/lib/gfxpoly/Makefile index 2065984f..7a8b9cc4 100644 --- a/lib/gfxpoly/Makefile +++ b/lib/gfxpoly/Makefile @@ -37,13 +37,12 @@ stroke.o: stroke.c poly.h convert.h wind.h $(CC) -c stroke.c -o stroke.o GFX=../gfxfont.o ../gfxtools.o ../devices/ops.o ../devices/polyops.o ../devices/text.o ../devices/bbox.o ../devices/render.o ../devices/rescale.o ../devices/record.o - stroke: test_stroke.c $(OBJS) ../libgfxswf.a ../librfxswf.a ../libbase.a - $(CC) test_stroke.c $(OBJS) ../librfxswf.a ../libgfxswf.a $(GFX) ../libbase.a -o stroke $(LIBS) + $(CC) test_stroke.c $(OBJS) ../libgfxswf.a ../librfxswf.a $(GFX) ../libbase.a -o stroke $(LIBS) SWF = ../librfxswf.a ../libpdf.a -lstdc++ test: ../libbase.a test.c $(OBJS) poly.h convert.h $(GFX) - $(CC) test.c $(OBJS) $(SWF) ../libbase.a $(GFX) -o test $(LIBS) + $(CC) test.c $(OBJS) $(SWF) $(GFX) ../libbase.a -o test $(LIBS) clean: rm -f *.o test stroke diff --git a/lib/gfxpoly/test_stroke.c b/lib/gfxpoly/test_stroke.c index d468cb83..0e292cd6 100644 --- a/lib/gfxpoly/test_stroke.c +++ b/lib/gfxpoly/test_stroke.c @@ -1,5 +1,6 @@ #include <math.h> #include "../gfxtools.h" +#include "convert.h" #include "stroke.h" #include "convert.h" diff --git a/lib/modules/swfbits.c b/lib/modules/swfbits.c index 4fa38f55..46435516 100644 --- a/lib/modules/swfbits.c +++ b/lib/modules/swfbits.c @@ -1182,9 +1182,15 @@ TAG* swf_AddImage(TAG*tag, int bitid, RGBA*mem, int width, int height, int quali int has_alpha = swf_ImageHasAlpha(mem,width,height); /* try lossless image */ + +#ifdef NO_LOSSLESS + tag1 = swf_InsertTag(0, /*ST_DEFINEBITSLOSSLESS1/2*/0); + tag1->len = 0x7fffffff; +#else tag1 = swf_InsertTag(0, /*ST_DEFINEBITSLOSSLESS1/2*/0); swf_SetU16(tag1, bitid); swf_SetLosslessImage(tag1, mem, width, height); +#endif #if defined(HAVE_JPEGLIB) /* try jpeg image */ diff --git a/lib/pdf/GFXOutputDev.cc b/lib/pdf/GFXOutputDev.cc index af891cbf..2596d253 100644 --- a/lib/pdf/GFXOutputDev.cc +++ b/lib/pdf/GFXOutputDev.cc @@ -1442,10 +1442,13 @@ void GFXOutputDev::drawChar(GfxState *state, double x, double y, gfxmatrix_t m = this->current_font_matrix; this->transformXY(state, x-originX, y-originY, &m.tx, &m.ty); //m.tx += originX; m.ty += originY; - - msg("<debug> drawChar(%f,%f,c='%c' (%d), u=%d <%d>) CID=%d render=%d glyphid=%d font=%08x",m.tx,m.ty,(charid&127)>=32?charid:'?', charid, u, uLen, font->isCIDFont(), render, glyphid, current_gfxfont); - if((render == RENDER_FILL && !config_drawonlyshapes) || render == RENDER_INVISIBLE) { + msg("<debug> drawChar(%f,%f,c='%c' (%d), u=%d <%d>) CID=%d render=%d glyphid=%d font=%08x",m.tx,m.ty,(charid&127)>=32?charid:'?', charid, u, uLen, font->isCIDFont(), render, glyphid, current_gfxfont); + + if((render == RENDER_FILL && !config_drawonlyshapes) || + (render == RENDER_FILLSTROKE && state->getTransformedLineWidth()<1.0) || + (render == RENDER_INVISIBLE)) { + int space = this->current_fontinfo->space_char; if(config_extrafontdata && space>=0 && m.m00 && !m.m01) { /* space char detection */ @@ -1478,6 +1481,7 @@ void GFXOutputDev::drawChar(GfxState *state, double x, double y, msg("<notice> Some texts will be rendered as shape"); gfxglobals->textmodeinfo = 1; } + gfxline_t*glyph = current_gfxfont->glyphs[glyphid].line; gfxline_t*tglyph = gfxline_clone(glyph); gfxline_transform(tglyph, &m); @@ -1561,10 +1565,11 @@ GBool GFXOutputDev::beginType3Char(GfxState *state, double x, double y, double d gfxmatrix_t m = this->current_font_matrix; this->transformXY(state, 0, 0, &m.tx, &m.ty); - m.m00*=INTERNAL_FONT_SIZE; + + /*m.m00*=INTERNAL_FONT_SIZE; m.m01*=INTERNAL_FONT_SIZE; m.m10*=INTERNAL_FONT_SIZE; - m.m11*=INTERNAL_FONT_SIZE; + m.m11*=INTERNAL_FONT_SIZE;*/ if(!current_fontinfo || (unsigned)charid >= current_fontinfo->num_glyphs || !current_fontinfo->glyphs[charid]) { msg("<error> Invalid charid %d for font", charid); @@ -1658,12 +1663,6 @@ void GFXOutputDev::startPage(int pageNum, GfxState *state, double crop_x1, doubl states[statepos].dashStart = 0; this->last_char_gfxfont = 0; - - if(this->config_linkdatafile) { - FILE*fi = fopen(config_linkdatafile, "ab+"); - fprintf(fi, "[page %d]\n", pageNum); - fclose(fi); - } } @@ -2045,6 +2044,8 @@ void GFXOutputDev::updateFont(GfxState *state) current_gfxfont = this->current_fontinfo->getGfxFont(); device->addfont(device, current_gfxfont); free(id); + + device->addfont(device, current_gfxfont); updateFontMatrix(state); } diff --git a/lib/pdf/InfoOutputDev.h b/lib/pdf/InfoOutputDev.h index 04e98f71..ead6a449 100644 --- a/lib/pdf/InfoOutputDev.h +++ b/lib/pdf/InfoOutputDev.h @@ -105,7 +105,6 @@ class InfoOutputDev: public OutputDev int num_polygons; int num_textfields; - void finish(); void dumpfonts(gfxdevice_t*dev); InfoOutputDev(XRef*xref); diff --git a/lib/pdf/XMLOutputDev.cc b/lib/pdf/XMLOutputDev.cc index d6f1d2d5..9238873b 100644 --- a/lib/pdf/XMLOutputDev.cc +++ b/lib/pdf/XMLOutputDev.cc @@ -59,15 +59,25 @@ void XMLOutputDev::endPage() GString*fontname = new GString(); double fontsize = -99999; double base = -9999; + double color_r = -1; + double color_g = -1; + double color_b = -1; for(i=0;i<len;i++) { TextWord*word = list->get(i); GString*newfont = word->getFontName(); double newsize = word->getFontSize(); double newbase = word->base; + double newcolor_r = word->colorR; + double newcolor_g = word->colorG; + double newcolor_b = word->colorB; if((newfont && newfont->cmp(fontname)) || newsize != fontsize || - newbase != base) + newbase != base || + newcolor_r != color_r || + newcolor_g != color_g || + newcolor_b != color_b + ) { TextFontInfo*info = word->getFontInfo(); if(textTag) @@ -94,18 +104,29 @@ void XMLOutputDev::endPage() if(strstr(name, "serif")) serif = gTrue; } - fprintf(out, "<t font=\"%s\" y=\"%f\" x=\"%f\" style=\"%s%s%s%s\" fontsize=\"%.0fpt\">", + fprintf(out, "<t font=\"%s\" y=\"%f\" x=\"%f\" bbox=\"%f:%f:%f:%f\" style=\"%s%s%s%s\" fontsize=\"%.0fpt\" color=\"%02x%02x%02x\">", name, newbase, (word->rot&1)?word->yMin:word->xMin, + (word->rot&1)?word->yMin:word->xMin, + (word->rot&1)?word->xMin:word->yMin, + (word->rot&1)?word->yMax:word->xMax, + (word->rot&1)?word->xMax:word->yMax, info->isFixedWidth()?"fixed;":"", serif?"serif;":"", italic?"italic;":"", bold?"bold;":"", - newsize); + newsize, + ((int)(newcolor_r*255))&0xff, + ((int)(newcolor_g*255))&0xff, + ((int)(newcolor_b*255))&0xff + ); fontname = newfont->copy(); fontsize = newsize; base = newbase; + color_r = newcolor_r; + color_g = newcolor_g; + color_b = newcolor_b; } char*s = word->getText()->getCString(); while(*s) { diff --git a/lib/rfxswf.c b/lib/rfxswf.c index bba220fd..025bcaf4 100644 --- a/lib/rfxswf.c +++ b/lib/rfxswf.c @@ -93,7 +93,7 @@ char* swf_GetString(TAG*t) U8 swf_GetU8(TAG * t) { swf_ResetReadBits(t); #ifdef DEBUG_RFXSWF - if (t->pos>=t->len) + if ((int)t->pos>=(int)t->len) { fprintf(stderr,"GetU8() out of bounds: TagID = %i\n",t->id); *(int*)0=0; return 0; @@ -106,7 +106,7 @@ U16 swf_GetU16(TAG * t) { U16 res; swf_ResetReadBits(t); #ifdef DEBUG_RFXSWF - if (t->pos>(t->len-2)) + if ((int)t->pos>((int)t->len-2)) { fprintf(stderr,"GetU16() out of bounds: TagID = %i\n",t->id); return 0; } @@ -120,7 +120,7 @@ U32 swf_GetU32(TAG * t) { U32 res; swf_ResetReadBits(t); #ifdef DEBUG_RFXSWF - if (t->pos>(t->len-4)) + if ((int)t->pos>((int)t->len-4)) { fprintf(stderr,"GetU32() out of bounds: TagID = %i\n",t->id); return 0; } @@ -178,7 +178,9 @@ int swf_SetU16(TAG * t,U16 v) void swf_SetS16(TAG * t,int v) { if(v>32767 || v<-32768) { + #ifdef DEBUG_RFXSWF fprintf(stderr, "Warning: S16 overflow: %d\n", v); + #endif } swf_SetU16(t, (S16)v); } @@ -695,7 +697,9 @@ int swf_SetRect(TAG * t,SRECT * r) nbits = swf_CountBits(r->ymin,nbits); nbits = swf_CountBits(r->ymax,nbits); if(nbits>=32) { + #ifdef DEBUG_RFXSWF fprintf(stderr, "rfxswf: Warning: num_bits overflow in swf_SetRect\n"); + #endif nbits=31; } @@ -861,7 +865,9 @@ int swf_SetMatrix(TAG * t,MATRIX * m) nbits = swf_CountBits(m->sy,nbits); if(nbits>=32) { /* TODO: happens on AMD64 systems for normal values? */ + #ifdef DEBUG_RFXSWF fprintf(stderr,"rfxswf: Error: matrix values too large\n"); + #endif nbits = 31; } swf_SetBits(t,nbits,5); @@ -875,7 +881,9 @@ int swf_SetMatrix(TAG * t,MATRIX * m) nbits = swf_CountBits(m->r0,0); nbits = swf_CountBits(m->r1,nbits); if(nbits>=32) { + #ifdef DEBUG_RFXSWF fprintf(stderr,"rfxswf: Error: matrix values too large\n"); + #endif nbits = 31; } swf_SetBits(t,nbits,5); @@ -886,7 +894,9 @@ int swf_SetMatrix(TAG * t,MATRIX * m) nbits = swf_CountBits(m->tx,0); nbits = swf_CountBits(m->ty,nbits); if(nbits>=32) { + #ifdef DEBUG_RFXSWF fprintf(stderr,"rfxswf: Error: matrix values too large\n"); + #endif nbits = 31; } swf_SetBits(t,nbits,5); @@ -1170,7 +1180,9 @@ TAG * swf_ReadTag(reader_t*reader, TAG * prev) { t->data = (U8*)rfx_alloc(t->len); t->memsize = t->len; if (reader->read(reader, t->data, t->len) != t->len) { + #ifdef DEBUG_RFXSWF fprintf(stderr, "rfxswf: Warning: Short read (tagid %d). File truncated?\n", t->id); + #endif free(t->data);t->data=0; free(t); return NULL; @@ -1349,7 +1361,9 @@ void swf_FoldSprite(TAG * t) if(t->id!=ST_DEFINESPRITE) return; if(!t->len) { + #ifdef DEBUG_RFXSWF fprintf(stderr, "Error: Sprite has no ID!"); + #endif return; } if(t->len>4) { diff --git a/lib/rfxswf.h b/lib/rfxswf.h index 454c3f5a..f5868490 100644 --- a/lib/rfxswf.h +++ b/lib/rfxswf.h @@ -931,6 +931,22 @@ int swf_ObjectMove(TAG * t,U16 depth,MATRIX * m,CXFORM * cx); #define PF2_ASBITMAP 0x04 //... +#define BLENDMODE_NORMAL 0 +#define BLENDMODE_NORMAL2 1 +#define BLENDMODE_LAYER 2 +#define BLENDMODE_MULTIPLY 3 +#define BLENDMODE_SCREEN 4 +#define BLENDMODE_LIGHTEN 5 +#define BLENDMODE_DARKEN 6 +#define BLENDMODE_ADD 7 +#define BLENDMODE_SUBSTRACT 8 +#define BLENDMODE_DIFFERENCE 9 +#define BLENDMODE_INVERT 10 +#define BLENDMODE_ALPHA 11 +#define BLENDMODE_ERASE 12 +#define BLENDMODE_OVERLAY 13 +#define BLENDMODE_HARDLIGHT 14 + typedef struct _SWFPLACEOBJECT { U16 depth; U16 id; // may be 0 diff --git a/spec/circularfill.spec.rb b/spec/circularfill.spec.rb index 5d15d2d0..587a2d23 100644 --- a/spec/circularfill.spec.rb +++ b/spec/circularfill.spec.rb @@ -1,29 +1,30 @@ require File.dirname(__FILE__) + '/spec_helper' describe "pdf conversion" do - convert_file "circularfill.pdf" do - pixel_at(194,224).should_be_of_color 0xffffff - pixel_at(169,225).should_be_of_color 0xff0000 - pixel_at(138,225).should_be_of_color 0xffffff - pixel_at(72,162).should_be_of_color 0xff0000 - pixel_at(195,132).should_be_of_color 0xff0000 - pixel_at(69,132).should_be_of_color 0xffffff - pixel_at(310,289).should_be_of_color 0xff0000 - pixel_at(287,200).should_be_of_color 0xff0000 - pixel_at(309,161).should_be_of_color 0xff0000 - pixel_at(287,161).should_be_of_color 0xff0000 - pixel_at(109,336).should_be_of_color 0xff0000 - pixel_at(310,306).should_be_of_color 0xff0000 - pixel_at(282,340).should_be_of_color 0xff0000 - pixel_at(409,252).should_be_of_color 0xff0000 - pixel_at(139,310).should_be_of_color 0xffffff - pixel_at(312,343).should_be_of_color 0xffffff - pixel_at(311,248).should_be_of_color 0xff0000 - pixel_at(102,228).should_be_of_color 0xff0000 - pixel_at(374,281).should_be_of_color 0xff0000 - pixel_at(167,281).should_be_of_color 0xff0000 - pixel_at(409,285).should_be_of_color 0xffffff - pixel_at(166,190).should_be_of_color 0xffffff - pixel_at(138,191).should_be_of_color 0xff0000 - end + + convert_file "circularfill.pdf" do + pixel_at(194,224).should_be_of_color 0xffffff + pixel_at(169,225).should_be_of_color 0xff0000 + pixel_at(138,225).should_be_of_color 0xffffff + pixel_at(72,162).should_be_of_color 0xff0000 + pixel_at(195,132).should_be_of_color 0xff0000 + pixel_at(69,132).should_be_of_color 0xffffff + pixel_at(310,289).should_be_of_color 0xff0000 + pixel_at(287,200).should_be_of_color 0xff0000 + pixel_at(309,161).should_be_of_color 0xff0000 + pixel_at(287,161).should_be_of_color 0xff0000 + pixel_at(109,336).should_be_of_color 0xff0000 + pixel_at(310,306).should_be_of_color 0xff0000 + pixel_at(282,340).should_be_of_color 0xff0000 + pixel_at(409,252).should_be_of_color 0xff0000 + pixel_at(139,310).should_be_of_color 0xffffff + pixel_at(312,343).should_be_of_color 0xffffff + pixel_at(311,248).should_be_of_color 0xff0000 + pixel_at(102,228).should_be_of_color 0xff0000 + pixel_at(374,281).should_be_of_color 0xff0000 + pixel_at(167,281).should_be_of_color 0xff0000 + pixel_at(409,285).should_be_of_color 0xffffff + pixel_at(166,190).should_be_of_color 0xffffff + pixel_at(138,191).should_be_of_color 0xff0000 + end end diff --git a/spec/edit_spec.py b/spec/edit_spec.py index 670e1bf1..9584b051 100755 --- a/spec/edit_spec.py +++ b/spec/edit_spec.py @@ -39,7 +39,12 @@ class TwoPixelCheck(Check): return "pixel at (%d,%d)" % (self.x2,self.y2) class PixelBrighterThan(TwoPixelCheck): - pass + def verifies(self, model): + p1 = model.getPixel(self.x,self.y) + p2 = model.getPixel(self.x2,self.y2) + val1 = p1[0] + p1[1] + p1[2] + val2 = p2[0] + p2[1] + p2[2] + return val1 > val2 class PixelDarkerThan(TwoPixelCheck): pass diff --git a/spec/gradients.spec.rb b/spec/gradients.spec.rb index 62aebbbe..3a9271ca 100644 --- a/spec/gradients.spec.rb +++ b/spec/gradients.spec.rb @@ -1,34 +1,35 @@ require File.dirname(__FILE__) + '/spec_helper' describe "pdf conversion" do - convert_file "gradients.pdf" do - pixel_at(269,324).should_be_brighter_than pixel_at(155,438) - pixel_at(261,388).should_be_brighter_than pixel_at(209,434) - pixel_at(195,329).should_be_brighter_than pixel_at(164,367) - pixel_at(33,318).should_be_brighter_than pixel_at(92,381) - pixel_at(168,310).should_be_brighter_than pixel_at(108,381) - pixel_at(166,455).should_be_brighter_than pixel_at(109,401) - pixel_at(25,454).should_be_brighter_than pixel_at(89,396) - pixel_at(258,210).should_be_brighter_than pixel_at(90,215) - pixel_at(259,225).should_be_brighter_than pixel_at(95,227) - pixel_at(257,240).should_be_brighter_than pixel_at(102,240) - pixel_at(359,121).should_be_brighter_than pixel_at(360,270) - pixel_at(383,119).should_be_brighter_than pixel_at(385,181) - pixel_at(373,167).should_be_brighter_than pixel_at(373,239) - pixel_at(355,409).should_be_brighter_than pixel_at(356,349) - pixel_at(370,377).should_be_brighter_than pixel_at(369,316) - pixel_at(382,333).should_be_brighter_than pixel_at(383,286) - pixel_at(422,115).should_be_brighter_than pixel_at(422,411) - pixel_at(437,190).should_be_brighter_than pixel_at(436,318) - pixel_at(447,276).should_be_brighter_than pixel_at(446,413) - pixel_at(413,101).should_be_the_same_as pixel_at(448,101) - pixel_at(412,166).should_be_the_same_as pixel_at(449,166) - pixel_at(412,246).should_be_the_same_as pixel_at(450,246) - pixel_at(413,332).should_be_the_same_as pixel_at(450,332) - pixel_at(414,400).should_be_the_same_as pixel_at(451,400) - pixel_at(87,245).should_be_the_same_as pixel_at(87,212) - pixel_at(143,245).should_be_the_same_as pixel_at(143,209) - pixel_at(189,246).should_be_the_same_as pixel_at(189,210) - pixel_at(236,244).should_be_the_same_as pixel_at(236,208) - end + + convert_file "gradients.pdf" do + pixel_at(269,324).should_be_brighter_than pixel_at(155,438) + pixel_at(261,388).should_be_brighter_than pixel_at(209,434) + pixel_at(195,329).should_be_brighter_than pixel_at(164,367) + pixel_at(33,318).should_be_brighter_than pixel_at(92,381) + pixel_at(168,310).should_be_brighter_than pixel_at(108,381) + pixel_at(166,455).should_be_brighter_than pixel_at(109,401) + pixel_at(25,454).should_be_brighter_than pixel_at(89,396) + pixel_at(258,210).should_be_brighter_than pixel_at(90,215) + pixel_at(259,225).should_be_brighter_than pixel_at(95,227) + pixel_at(257,240).should_be_brighter_than pixel_at(102,240) + pixel_at(359,121).should_be_brighter_than pixel_at(360,270) + pixel_at(383,119).should_be_brighter_than pixel_at(385,181) + pixel_at(373,167).should_be_brighter_than pixel_at(373,239) + pixel_at(355,409).should_be_brighter_than pixel_at(356,349) + pixel_at(370,377).should_be_brighter_than pixel_at(369,316) + pixel_at(382,333).should_be_brighter_than pixel_at(383,286) + pixel_at(422,115).should_be_brighter_than pixel_at(422,411) + pixel_at(437,190).should_be_brighter_than pixel_at(436,318) + pixel_at(447,276).should_be_brighter_than pixel_at(446,413) + pixel_at(413,101).should_be_the_same_as pixel_at(448,101) + pixel_at(412,166).should_be_the_same_as pixel_at(449,166) + pixel_at(412,246).should_be_the_same_as pixel_at(450,246) + pixel_at(413,332).should_be_the_same_as pixel_at(450,332) + pixel_at(414,400).should_be_the_same_as pixel_at(451,400) + pixel_at(87,245).should_be_the_same_as pixel_at(87,212) + pixel_at(143,245).should_be_the_same_as pixel_at(143,209) + pixel_at(189,246).should_be_the_same_as pixel_at(189,210) + pixel_at(236,244).should_be_the_same_as pixel_at(236,208) + end end diff --git a/spec/imagematrix.spec.rb b/spec/imagematrix.spec.rb index d5c599dd..5559295e 100644 --- a/spec/imagematrix.spec.rb +++ b/spec/imagematrix.spec.rb @@ -1,118 +1,119 @@ require File.dirname(__FILE__) + '/spec_helper' describe "pdf conversion" do - convert_file "imagematrix.pdf" do - pixel_at(22,239).should_be_of_color 0xff00ff - pixel_at(45,240).should_be_of_color 0x0000ff - pixel_at(72,239).should_be_of_color 0xffff00 - pixel_at(98,236).should_be_of_color 0xff0000 - pixel_at(99,312).should_be_of_color 0xffffff - pixel_at(80,312).should_be_of_color 0xff00ff - pixel_at(46,312).should_be_of_color 0x00ffff - pixel_at(26,314).should_be_of_color 0x0000ff - pixel_at(21,385).should_be_of_color 0xffff00 - pixel_at(46,384).should_be_of_color 0xff00ff - pixel_at(71,384).should_be_of_color 0x00ff00 - pixel_at(95,383).should_be_of_color 0x0000ff - pixel_at(97,459).should_be_of_color 0x00ffff - pixel_at(75,460).should_be_of_color 0x0000ff - pixel_at(50,460).should_be_of_color 0xffffff - pixel_at(23,461).should_be_of_color 0x00ff00 - pixel_at(216,436).should_be_of_color 0xff00ff - pixel_at(213,415).should_be_of_color 0x0000ff - pixel_at(214,386).should_be_of_color 0xffff00 - pixel_at(216,360).should_be_of_color 0x00ff00 - pixel_at(234,364).should_be_of_color 0xffffff - pixel_at(235,388).should_be_of_color 0xff00ff - pixel_at(233,416).should_be_of_color 0x00ffff - pixel_at(237,431).should_be_of_color 0x0000ff - pixel_at(260,433).should_be_of_color 0xffff00 - pixel_at(263,414).should_be_of_color 0xff00ff - pixel_at(261,393).should_be_of_color 0x00ff00 - pixel_at(263,365).should_be_of_color 0x0000ff - pixel_at(291,363).should_be_of_color 0x00ffff - pixel_at(288,390).should_be_of_color 0x0000ff - pixel_at(285,412).should_be_of_color 0xffffff - pixel_at(285,437).should_be_of_color 0xff0000 - pixel_at(286,287).should_be_of_color 0x00ffff - pixel_at(265,287).should_be_of_color 0x0000ff - pixel_at(244,290).should_be_of_color 0xffffff - pixel_at(219,290).should_be_of_color 0x00ff00 - pixel_at(209,270).should_be_of_color 0xffff00 - pixel_at(238,266).should_be_of_color 0xff00ff - pixel_at(266,265).should_be_of_color 0x00ff00 - pixel_at(283,265).should_be_of_color 0x0000ff - pixel_at(289,236).should_be_of_color 0xffffff - pixel_at(264,237).should_be_of_color 0xff00ff - pixel_at(238,241).should_be_of_color 0x00ffff - pixel_at(216,235).should_be_of_color 0x0000ff - pixel_at(210,213).should_be_of_color 0xff00ff - pixel_at(238,213).should_be_of_color 0x0000ff - pixel_at(267,211).should_be_of_color 0xffff00 - pixel_at(287,211).should_be_of_color 0xff0000 - pixel_at(257,118).should_be_of_color 0x00ffff - pixel_at(262,96).should_be_of_color 0x0000ff - pixel_at(263,69).should_be_of_color 0xffffff - pixel_at(262,43).should_be_of_color 0xff0000 - pixel_at(285,41).should_be_of_color 0xffff00 - pixel_at(290,67).should_be_of_color 0xff00ff - pixel_at(288,92).should_be_of_color 0x00ff00 - pixel_at(285,115).should_be_of_color 0x0000ff - pixel_at(312,120).should_be_of_color 0xffffff - pixel_at(311,94).should_be_of_color 0xff00ff - pixel_at(310,69).should_be_of_color 0x00ffff - pixel_at(311,45).should_be_of_color 0x0000ff - pixel_at(335,44).should_be_of_color 0xff00ff - pixel_at(335,67).should_be_of_color 0x0000ff - pixel_at(337,94).should_be_of_color 0xffff00 - pixel_at(337,119).should_be_of_color 0x00ff00 - pixel_at(367,310).should_be_of_color 0xff00ff - pixel_at(390,290).should_be_of_color 0x0000ff - pixel_at(406,277).should_be_of_color 0xffff00 - pixel_at(426,260).should_be_of_color 0xff0000 - pixel_at(438,280).should_be_of_color 0xffffff - pixel_at(418,296).should_be_of_color 0xff00ff - pixel_at(404,308).should_be_of_color 0x00ffff - pixel_at(380,324).should_be_of_color 0x0000ff - pixel_at(401,344).should_be_of_color 0xffff00 - pixel_at(415,330).should_be_of_color 0xff00ff - pixel_at(434,314).should_be_of_color 0x00ff00 - pixel_at(451,301).should_be_of_color 0x0000ff - pixel_at(472,316).should_be_of_color 0x00ffff - pixel_at(452,333).should_be_of_color 0x0000ff - pixel_at(434,349).should_be_of_color 0xffffff - pixel_at(415,362).should_be_of_color 0x00ff00 - pixel_at(375,484).should_be_of_color 0xff00ff - pixel_at(360,518).should_be_of_color 0x0000ff - pixel_at(343,552).should_be_of_color 0xffff00 - pixel_at(334,585).should_be_of_color 0x00ff00 - pixel_at(379,574).should_be_of_color 0xffffff - pixel_at(392,538).should_be_of_color 0xff00ff - pixel_at(406,505).should_be_of_color 0x00ffff - pixel_at(420,472).should_be_of_color 0x0000ff - pixel_at(468,456).should_be_of_color 0xffff00 - pixel_at(455,496).should_be_of_color 0xff00ff - pixel_at(438,527).should_be_of_color 0x00ff00 - pixel_at(427,558).should_be_of_color 0x0000ff - pixel_at(515,443).should_be_of_color 0xff0000 - pixel_at(504,480).should_be_of_color 0xffffff - pixel_at(489,512).should_be_of_color 0x0000ff - pixel_at(477,547).should_be_of_color 0x00ffff - pixel_at(520,238).should_be_of_color 0xff0000 - pixel_at(503,222).should_be_of_color 0xffff00 - pixel_at(486,204).should_be_of_color 0x0000ff - pixel_at(463,187).should_be_of_color 0xff00ff - pixel_at(478,168).should_be_of_color 0x0000ff - pixel_at(500,148).should_be_of_color 0xffff00 - pixel_at(516,130).should_be_of_color 0x00ff00 - pixel_at(536,146).should_be_of_color 0xffffff - pixel_at(517,165).should_be_of_color 0xff00ff - pixel_at(501,187).should_be_of_color 0x00ffff - pixel_at(518,198).should_be_of_color 0xff00ff - pixel_at(533,183).should_be_of_color 0x00ff00 - pixel_at(551,163).should_be_of_color 0x0000ff - pixel_at(572,178).should_be_of_color 0x00ffff - pixel_at(553,197).should_be_of_color 0x0000ff - pixel_at(538,216).should_be_of_color 0xffffff - end + + convert_file "imagematrix.pdf" do + pixel_at(22,239).should_be_of_color 0xff00ff + pixel_at(45,240).should_be_of_color 0x0000ff + pixel_at(72,239).should_be_of_color 0xffff00 + pixel_at(98,236).should_be_of_color 0xff0000 + pixel_at(99,312).should_be_of_color 0xffffff + pixel_at(80,312).should_be_of_color 0xff00ff + pixel_at(46,312).should_be_of_color 0x00ffff + pixel_at(26,314).should_be_of_color 0x0000ff + pixel_at(21,385).should_be_of_color 0xffff00 + pixel_at(46,384).should_be_of_color 0xff00ff + pixel_at(71,384).should_be_of_color 0x00ff00 + pixel_at(95,383).should_be_of_color 0x0000ff + pixel_at(97,459).should_be_of_color 0x00ffff + pixel_at(75,460).should_be_of_color 0x0000ff + pixel_at(50,460).should_be_of_color 0xffffff + pixel_at(23,461).should_be_of_color 0x00ff00 + pixel_at(216,436).should_be_of_color 0xff00ff + pixel_at(213,415).should_be_of_color 0x0000ff + pixel_at(214,386).should_be_of_color 0xffff00 + pixel_at(216,360).should_be_of_color 0x00ff00 + pixel_at(234,364).should_be_of_color 0xffffff + pixel_at(235,388).should_be_of_color 0xff00ff + pixel_at(233,416).should_be_of_color 0x00ffff + pixel_at(237,431).should_be_of_color 0x0000ff + pixel_at(260,433).should_be_of_color 0xffff00 + pixel_at(263,414).should_be_of_color 0xff00ff + pixel_at(261,393).should_be_of_color 0x00ff00 + pixel_at(263,365).should_be_of_color 0x0000ff + pixel_at(291,363).should_be_of_color 0x00ffff + pixel_at(288,390).should_be_of_color 0x0000ff + pixel_at(285,412).should_be_of_color 0xffffff + pixel_at(285,437).should_be_of_color 0xff0000 + pixel_at(286,287).should_be_of_color 0x00ffff + pixel_at(265,287).should_be_of_color 0x0000ff + pixel_at(244,290).should_be_of_color 0xffffff + pixel_at(219,290).should_be_of_color 0x00ff00 + pixel_at(209,270).should_be_of_color 0xffff00 + pixel_at(238,266).should_be_of_color 0xff00ff + pixel_at(266,265).should_be_of_color 0x00ff00 + pixel_at(283,265).should_be_of_color 0x0000ff + pixel_at(289,236).should_be_of_color 0xffffff + pixel_at(264,237).should_be_of_color 0xff00ff + pixel_at(238,241).should_be_of_color 0x00ffff + pixel_at(216,235).should_be_of_color 0x0000ff + pixel_at(210,213).should_be_of_color 0xff00ff + pixel_at(238,213).should_be_of_color 0x0000ff + pixel_at(267,211).should_be_of_color 0xffff00 + pixel_at(287,211).should_be_of_color 0xff0000 + pixel_at(257,118).should_be_of_color 0x00ffff + pixel_at(262,96).should_be_of_color 0x0000ff + pixel_at(263,69).should_be_of_color 0xffffff + pixel_at(262,43).should_be_of_color 0xff0000 + pixel_at(285,41).should_be_of_color 0xffff00 + pixel_at(290,67).should_be_of_color 0xff00ff + pixel_at(288,92).should_be_of_color 0x00ff00 + pixel_at(285,115).should_be_of_color 0x0000ff + pixel_at(312,120).should_be_of_color 0xffffff + pixel_at(311,94).should_be_of_color 0xff00ff + pixel_at(310,69).should_be_of_color 0x00ffff + pixel_at(311,45).should_be_of_color 0x0000ff + pixel_at(335,44).should_be_of_color 0xff00ff + pixel_at(335,67).should_be_of_color 0x0000ff + pixel_at(337,94).should_be_of_color 0xffff00 + pixel_at(337,119).should_be_of_color 0x00ff00 + pixel_at(367,310).should_be_of_color 0xff00ff + pixel_at(390,290).should_be_of_color 0x0000ff + pixel_at(406,277).should_be_of_color 0xffff00 + pixel_at(426,260).should_be_of_color 0xff0000 + pixel_at(438,280).should_be_of_color 0xffffff + pixel_at(418,296).should_be_of_color 0xff00ff + pixel_at(404,308).should_be_of_color 0x00ffff + pixel_at(380,324).should_be_of_color 0x0000ff + pixel_at(401,344).should_be_of_color 0xffff00 + pixel_at(415,330).should_be_of_color 0xff00ff + pixel_at(434,314).should_be_of_color 0x00ff00 + pixel_at(451,301).should_be_of_color 0x0000ff + pixel_at(472,316).should_be_of_color 0x00ffff + pixel_at(452,333).should_be_of_color 0x0000ff + pixel_at(434,349).should_be_of_color 0xffffff + pixel_at(415,362).should_be_of_color 0x00ff00 + pixel_at(375,484).should_be_of_color 0xff00ff + pixel_at(360,518).should_be_of_color 0x0000ff + pixel_at(343,552).should_be_of_color 0xffff00 + pixel_at(334,585).should_be_of_color 0x00ff00 + pixel_at(379,574).should_be_of_color 0xffffff + pixel_at(392,538).should_be_of_color 0xff00ff + pixel_at(406,505).should_be_of_color 0x00ffff + pixel_at(420,472).should_be_of_color 0x0000ff + pixel_at(468,456).should_be_of_color 0xffff00 + pixel_at(455,496).should_be_of_color 0xff00ff + pixel_at(438,527).should_be_of_color 0x00ff00 + pixel_at(427,558).should_be_of_color 0x0000ff + pixel_at(515,443).should_be_of_color 0xff0000 + pixel_at(504,480).should_be_of_color 0xffffff + pixel_at(489,512).should_be_of_color 0x0000ff + pixel_at(477,547).should_be_of_color 0x00ffff + pixel_at(520,238).should_be_of_color 0xff0000 + pixel_at(503,222).should_be_of_color 0xffff00 + pixel_at(486,204).should_be_of_color 0x0000ff + pixel_at(463,187).should_be_of_color 0xff00ff + pixel_at(478,168).should_be_of_color 0x0000ff + pixel_at(500,148).should_be_of_color 0xffff00 + pixel_at(516,130).should_be_of_color 0x00ff00 + pixel_at(536,146).should_be_of_color 0xffffff + pixel_at(517,165).should_be_of_color 0xff00ff + pixel_at(501,187).should_be_of_color 0x00ffff + pixel_at(518,198).should_be_of_color 0xff00ff + pixel_at(533,183).should_be_of_color 0x00ff00 + pixel_at(551,163).should_be_of_color 0x0000ff + pixel_at(572,178).should_be_of_color 0x00ffff + pixel_at(553,197).should_be_of_color 0x0000ff + pixel_at(538,216).should_be_of_color 0xffffff + end end diff --git a/spec/layers.spec.rb b/spec/layers.spec.rb index 2594835c..48cbe226 100644 --- a/spec/layers.spec.rb +++ b/spec/layers.spec.rb @@ -1,26 +1,27 @@ require File.dirname(__FILE__) + '/spec_helper' describe "pdf conversion" do - convert_file "layers.pdf" do - pixel_at(67,134).should_be_of_color 0x00ffff - pixel_at(299,182).should_be_of_color 0x00ffff - pixel_at(144,215).should_be_of_color 0x00ffff - pixel_at(206,203).should_be_of_color 0x00ffff - pixel_at(243,196).should_be_of_color 0x00ffff - pixel_at(270,190).should_be_of_color 0x00ffff - pixel_at(114,220).should_be_of_color 0x00ffff - pixel_at(406,161).should_be_of_color 0x00ffff - pixel_at(398,201).should_be_of_color 0x00ffff - pixel_at(438,211).should_be_of_color 0x0000ff - pixel_at(499,216).should_be_of_color 0xffff00 - pixel_at(498,223).should_be_of_color 0x00ffff - pixel_at(515,175).should_be_of_color 0xffff00 - pixel_at(458,185).should_be_of_color 0x0000ff - pixel_at(541,138).should_be_of_color 0xffff00 - pixel_at(433,158).should_be_of_color 0x0000ff - area_at(431,155,485,212).should_be_plain_colored - pixel_at(103,184).should_be_of_color 0x000000 - pixel_at(505,84).should_be_of_color 0xffff00 - pixel_at(314,149).should_be_of_color 0xffffff - end + + convert_file "layers.pdf" do + pixel_at(67,134).should_be_of_color 0x00ffff + pixel_at(299,182).should_be_of_color 0x00ffff + pixel_at(144,215).should_be_of_color 0x00ffff + pixel_at(206,203).should_be_of_color 0x00ffff + pixel_at(243,196).should_be_of_color 0x00ffff + pixel_at(270,190).should_be_of_color 0x00ffff + pixel_at(114,220).should_be_of_color 0x00ffff + pixel_at(406,161).should_be_of_color 0x00ffff + pixel_at(398,201).should_be_of_color 0x00ffff + pixel_at(438,211).should_be_of_color 0x0000ff + pixel_at(499,216).should_be_of_color 0xffff00 + pixel_at(498,223).should_be_of_color 0x00ffff + pixel_at(515,175).should_be_of_color 0xffff00 + pixel_at(458,185).should_be_of_color 0x0000ff + pixel_at(541,138).should_be_of_color 0xffff00 + pixel_at(433,158).should_be_of_color 0x0000ff + area_at(431,155,485,212).should_be_plain_colored + pixel_at(103,184).should_be_of_color 0x000000 + pixel_at(505,84).should_be_of_color 0xffff00 + pixel_at(314,149).should_be_of_color 0xffffff + end end diff --git a/spec/links.spec.rb b/spec/links.spec.rb index 35f92cc7..4e75d0e4 100644 --- a/spec/links.spec.rb +++ b/spec/links.spec.rb @@ -1,8 +1,9 @@ require File.dirname(__FILE__) + '/spec_helper' describe "pdf conversion" do - convert_file "links.pdf" do - area_at(0,0,200,200).should_contain_link("http://www.swftools.org") - area_at(0,0,200,200).should_contain_link("http://www.quiss.org") - end + + convert_file "links.pdf" do + area_at(0,0,200,200).should_contain_link("http://www.swftools.org") + area_at(0,0,200,200).should_contain_link("http://www.quiss.org") + end end diff --git a/spec/miterlimit.spec.rb b/spec/miterlimit.spec.rb index 6241ab9f..2e1fa6f5 100644 --- a/spec/miterlimit.spec.rb +++ b/spec/miterlimit.spec.rb @@ -1,21 +1,22 @@ require File.dirname(__FILE__) + '/spec_helper' describe "pdf conversion" do - convert_file "miterlimit.pdf" do - pixel_at(451,153).should_be_of_color 0x999999 - pixel_at(492,154).should_be_of_color 0x666666 - pixel_at(523,153).should_be_of_color 0x666666 - pixel_at(386,151).should_be_of_color 0x666666 - pixel_at(86,65).should_be_of_color 0x666666 - pixel_at(80,77).should_be_of_color 0x999999 - pixel_at(77,86).should_be_of_color 0x666666 - pixel_at(474,380).should_be_of_color 0xffffff - pixel_at(492,380).should_be_of_color 0xffffff - pixel_at(452,381).should_be_of_color 0x999999 - pixel_at(450,369).should_be_of_color 0x666666 - pixel_at(376,382).should_be_of_color 0x666666 - pixel_at(89,319).should_be_of_color 0x666666 - pixel_at(119,314).should_be_of_color 0x999999 - pixel_at(142,305).should_be_of_color 0x666666 - end + + convert_file "miterlimit.pdf" do + pixel_at(451,153).should_be_of_color 0x999999 + pixel_at(492,154).should_be_of_color 0x666666 + pixel_at(523,153).should_be_of_color 0x666666 + pixel_at(386,151).should_be_of_color 0x666666 + pixel_at(86,65).should_be_of_color 0x666666 + pixel_at(80,77).should_be_of_color 0x999999 + pixel_at(77,86).should_be_of_color 0x666666 + pixel_at(474,380).should_be_of_color 0xffffff + pixel_at(492,380).should_be_of_color 0xffffff + pixel_at(452,381).should_be_of_color 0x999999 + pixel_at(450,369).should_be_of_color 0x666666 + pixel_at(376,382).should_be_of_color 0x666666 + pixel_at(89,319).should_be_of_color 0x666666 + pixel_at(119,314).should_be_of_color 0x999999 + pixel_at(142,305).should_be_of_color 0x666666 + end end diff --git a/spec/pattern.spec.rb b/spec/pattern.spec.rb index fb8636bb..c6040447 100644 --- a/spec/pattern.spec.rb +++ b/spec/pattern.spec.rb @@ -1,8 +1,9 @@ require File.dirname(__FILE__) + '/spec_helper' describe "pdf conversion" do - convert_file "pattern.pdf" do - area_at(425,190,500,224).should_not_be_plain_colored - area_at(517,192,583,225).should_be_plain_colored - end + + convert_file "pattern.pdf" do + area_at(425,190,500,224).should_not_be_plain_colored + area_at(517,192,583,225).should_be_plain_colored + end end diff --git a/spec/simpletext.spec.rb b/spec/simpletext.spec.rb index 874ce590..4ff96b8a 100644 --- a/spec/simpletext.spec.rb +++ b/spec/simpletext.spec.rb @@ -1,13 +1,14 @@ require File.dirname(__FILE__) + '/spec_helper' -describe "pdf conversion" do - convert_file "simpletext.pdf" do - pixel_at(109,133).should_be_of_color 0x000000 - pixel_at(154,139).should_be_brighter_than pixel_at(151,139) - pixel_at(53,136).should_be_darker_than pixel_at(58,166) - pixel_at(97,164).should_be_the_same_as pixel_at(208,256) - area_at(215,80,333,156).should_be_plain_colored - area_at(46,126,180,158).should_not_be_plain_colored - area_at(38,118,170,152).should_contain_text 'Hello World' - end +describe "pdf conversion" do + + convert_file "simpletext.pdf" do + pixel_at(109,133).should_be_of_color 0x000000 + pixel_at(154,139).should_be_brighter_than pixel_at(151,139) + pixel_at(53,136).should_be_darker_than pixel_at(58,166) + pixel_at(97,164).should_be_the_same_as pixel_at(208,256) + area_at(215,80,333,156).should_be_plain_colored + area_at(46,126,180,158).should_not_be_plain_colored + area_at(38,118,170,152).should_contain_text 'Hello World' + end end diff --git a/spec/smalltext.spec.rb b/spec/smalltext.spec.rb index eb656467..aee2b243 100644 --- a/spec/smalltext.spec.rb +++ b/spec/smalltext.spec.rb @@ -1,15 +1,16 @@ require File.dirname(__FILE__) + '/spec_helper' describe "pdf conversion" do - convert_file "smalltext.pdf" do - area_at(37,93,44,103).should_not_be_plain_colored - area_at(77,94,86,104).should_not_be_plain_colored - area_at(117,94,123,104).should_not_be_plain_colored - area_at(157,94,165,103).should_not_be_plain_colored - area_at(37,139,45,155).should_not_be_plain_colored - area_at(76,139,85,154).should_not_be_plain_colored - area_at(116,142,125,152).should_not_be_plain_colored - area_at(155,145,167,151).should_not_be_plain_colored - area_at(27,110,180,115).should_be_plain_colored - end + + convert_file "smalltext.pdf" do + area_at(37,93,44,103).should_not_be_plain_colored + area_at(77,94,86,104).should_not_be_plain_colored + area_at(117,94,123,104).should_not_be_plain_colored + area_at(157,94,165,103).should_not_be_plain_colored + area_at(37,139,45,155).should_not_be_plain_colored + area_at(76,139,85,154).should_not_be_plain_colored + area_at(116,142,125,152).should_not_be_plain_colored + area_at(155,145,167,151).should_not_be_plain_colored + area_at(27,110,180,115).should_be_plain_colored + end end diff --git a/spec/textarea.spec.rb b/spec/textarea.spec.rb index dcaeea69..df269d7b 100644 --- a/spec/textarea.spec.rb +++ b/spec/textarea.spec.rb @@ -1,10 +1,11 @@ require File.dirname(__FILE__) + '/spec_helper' describe "pdf conversion" do - convert_file "textarea.pdf" do - area_at(460,94,610,106).should_contain_text '97924ff65f9dfc75450ba' - area_at(467,373,525,384).should_contain_text '29cf24e47' - area_at(474,592,543,601).should_contain_text '0afa27099a' - area_at(59,798,131,808).should_contain_text '4c28e489b4' - end + + convert_file "textarea.pdf" do + area_at(460,94,610,106).should_contain_text '97924ff65f9dfc75450ba' + area_at(467,373,525,384).should_contain_text '29cf24e47' + area_at(474,592,543,601).should_contain_text '0afa27099a' + area_at(59,798,131,808).should_contain_text '4c28e489b4' + end end diff --git a/spec/textposition.spec.rb b/spec/textposition.spec.rb index 73e1103f..5a3ee860 100644 --- a/spec/textposition.spec.rb +++ b/spec/textposition.spec.rb @@ -1,126 +1,127 @@ require File.dirname(__FILE__) + '/spec_helper' describe "pdf conversion" do - convert_file "textposition.pdf" do - pixel_at(109,352).should_be_of_color 0xffffff - pixel_at(115,346).should_be_of_color 0xffffff - pixel_at(132,368).should_be_of_color 0xffffff - pixel_at(141,375).should_be_of_color 0xffffff - pixel_at(149,380).should_be_of_color 0xffffff - pixel_at(156,386).should_be_of_color 0xffffff - pixel_at(176,403).should_be_of_color 0xffffff - pixel_at(189,409).should_be_of_color 0xffffff - pixel_at(196,421).should_be_of_color 0xffffff - pixel_at(204,428).should_be_of_color 0xffffff - pixel_at(16,164).should_be_of_color 0x000000 - pixel_at(28,167).should_be_of_color 0x000000 - pixel_at(30,152).should_be_of_color 0xffffff - pixel_at(29,139).should_be_of_color 0x000000 - pixel_at(42,194).should_be_of_color 0x000000 - pixel_at(42,182).should_be_of_color 0xffffff - pixel_at(28,196).should_be_of_color 0x000000 - pixel_at(31,183).should_be_of_color 0xffffff - pixel_at(50,193).should_be_of_color 0x000000 - pixel_at(52,183).should_be_of_color 0xffffff - pixel_at(63,194).should_be_of_color 0x000000 - pixel_at(63,178).should_be_of_color 0xffffff - pixel_at(63,149).should_be_of_color 0xffffff - pixel_at(62,139).should_be_of_color 0x000000 - pixel_at(99,141).should_be_of_color 0x000000 - pixel_at(98,171).should_be_of_color 0xffffff - pixel_at(99,194).should_be_of_color 0x000000 - pixel_at(113,168).should_be_of_color 0x000000 - pixel_at(113,152).should_be_of_color 0xffffff - pixel_at(113,189).should_be_of_color 0xffffff - pixel_at(126,169).should_be_of_color 0xffffff - pixel_at(136,167).should_be_of_color 0xffffff - pixel_at(135,195).should_be_of_color 0x000000 - pixel_at(125,194).should_be_of_color 0x000000 - pixel_at(135,141).should_be_of_color 0x000000 - pixel_at(113,141).should_be_of_color 0x000000 - pixel_at(74,169).should_be_of_color 0xffffff - pixel_at(310,437).should_be_of_color 0x000000 - pixel_at(313,442).should_be_of_color 0xffffff - pixel_at(320,430).should_be_of_color 0xffffff - pixel_at(363,423).should_be_of_color 0xffffff - pixel_at(383,419).should_be_of_color 0xffffff - pixel_at(405,413).should_be_of_color 0xffffff - pixel_at(416,407).should_be_of_color 0x000000 - pixel_at(435,404).should_be_of_color 0x000000 - pixel_at(458,403).should_be_of_color 0xffffff - pixel_at(474,394).should_be_of_color 0xffffff - pixel_at(489,385).should_be_of_color 0xffffff - pixel_at(499,393).should_be_of_color 0xffffff - pixel_at(525,381).should_be_of_color 0xffffff - pixel_at(545,376).should_be_of_color 0xffffff - pixel_at(415,278).should_be_of_color 0xffffff - pixel_at(409,271).should_be_of_color 0xffffff - pixel_at(432,256).should_be_of_color 0xffffff - pixel_at(440,250).should_be_of_color 0xffffff - pixel_at(449,243).should_be_of_color 0xffffff - pixel_at(458,237).should_be_of_color 0xffffff - pixel_at(472,228).should_be_of_color 0xffffff - pixel_at(476,221).should_be_of_color 0xffffff - pixel_at(489,214).should_be_of_color 0xffffff - pixel_at(497,202).should_be_of_color 0xffffff - pixel_at(504,196).should_be_of_color 0xffffff - pixel_at(243,262).should_be_of_color 0xffffff - pixel_at(242,255).should_be_of_color 0xffffff - pixel_at(253,257).should_be_of_color 0xffffff - pixel_at(129,370).should_be_of_color 0xffffff - pixel_at(367,419).should_be_of_color 0xffffff - pixel_at(387,412).should_be_of_color 0xffffff - pixel_at(232,188).should_be_of_color 0xffffff - pixel_at(233,262).should_be_of_color 0xffffff - pixel_at(207,253).should_be_of_color 0xffffff - pixel_at(264,254).should_be_of_color 0xffffff - pixel_at(290,256).should_be_of_color 0xffffff - pixel_at(303,252).should_be_of_color 0xffffff - pixel_at(317,256).should_be_of_color 0xffffff - pixel_at(326,256).should_be_of_color 0xffffff - pixel_at(317,188).should_be_of_color 0xffffff - pixel_at(325,193).should_be_of_color 0xffffff - pixel_at(289,193).should_be_of_color 0xffffff - pixel_at(252,194).should_be_of_color 0xffffff - pixel_at(206,197).should_be_of_color 0xffffff - pixel_at(206,188).should_be_of_color 0xffffff - pixel_at(222,123).should_be_of_color 0xffffff - pixel_at(231,118).should_be_of_color 0xffffff - pixel_at(245,128).should_be_of_color 0xffffff - pixel_at(260,124).should_be_of_color 0xffffff - pixel_at(285,124).should_be_of_color 0xffffff - pixel_at(295,123).should_be_of_color 0xffffff - pixel_at(305,118).should_be_of_color 0xffffff - pixel_at(316,118).should_be_of_color 0xffffff - pixel_at(343,128).should_be_of_color 0xffffff - pixel_at(343,118).should_be_of_color 0xffffff - pixel_at(303,198).should_be_of_color 0xffffff - pixel_at(43,136).should_be_of_color 0xffffff - pixel_at(53,135).should_be_of_color 0xffffff - area_at(17,177,76,197).should_not_be_plain_colored - area_at(74,134,141,162).should_not_be_plain_colored - area_at(77,173,141,196).should_not_be_plain_colored - area_at(219,119,346,128).should_not_be_plain_colored - area_at(110,347,117,354).should_not_be_plain_colored - area_at(129,366,138,373).should_not_be_plain_colored - area_at(139,373,149,381).should_not_be_plain_colored - area_at(166,396,176,403).should_not_be_plain_colored - area_at(187,413,197,420).should_not_be_plain_colored - area_at(199,422,208,429).should_not_be_plain_colored - area_at(317,430,347,434).should_not_be_plain_colored - area_at(353,420,382,425).should_not_be_plain_colored - area_at(396,408,427,414).should_not_be_plain_colored - area_at(430,400,461,404).should_not_be_plain_colored - area_at(478,389,503,395).should_not_be_plain_colored - area_at(513,381,539,385).should_not_be_plain_colored - area_at(203,189,330,197).should_not_be_plain_colored - area_at(204,253,331,261).should_not_be_plain_colored - area_at(410,271,415,277).should_not_be_plain_colored - area_at(423,261,428,266).should_not_be_plain_colored - area_at(440,246,445,257).should_not_be_plain_colored - area_at(460,228,465,235).should_not_be_plain_colored - area_at(475,217,483,223).should_not_be_plain_colored - area_at(489,206,493,212).should_not_be_plain_colored - area_at(502,197,505,202).should_not_be_plain_colored - end + + convert_file "textposition.pdf" do + pixel_at(109,352).should_be_of_color 0xffffff + pixel_at(115,346).should_be_of_color 0xffffff + pixel_at(132,368).should_be_of_color 0xffffff + pixel_at(141,375).should_be_of_color 0xffffff + pixel_at(149,380).should_be_of_color 0xffffff + pixel_at(156,386).should_be_of_color 0xffffff + pixel_at(176,403).should_be_of_color 0xffffff + pixel_at(189,409).should_be_of_color 0xffffff + pixel_at(196,421).should_be_of_color 0xffffff + pixel_at(204,428).should_be_of_color 0xffffff + pixel_at(16,164).should_be_of_color 0x000000 + pixel_at(28,167).should_be_of_color 0x000000 + pixel_at(30,152).should_be_of_color 0xffffff + pixel_at(29,139).should_be_of_color 0x000000 + pixel_at(42,194).should_be_of_color 0x000000 + pixel_at(42,182).should_be_of_color 0xffffff + pixel_at(28,196).should_be_of_color 0x000000 + pixel_at(31,183).should_be_of_color 0xffffff + pixel_at(50,193).should_be_of_color 0x000000 + pixel_at(52,183).should_be_of_color 0xffffff + pixel_at(63,194).should_be_of_color 0x000000 + pixel_at(63,178).should_be_of_color 0xffffff + pixel_at(63,149).should_be_of_color 0xffffff + pixel_at(62,139).should_be_of_color 0x000000 + pixel_at(99,141).should_be_of_color 0x000000 + pixel_at(98,171).should_be_of_color 0xffffff + pixel_at(99,194).should_be_of_color 0x000000 + pixel_at(113,168).should_be_of_color 0x000000 + pixel_at(113,152).should_be_of_color 0xffffff + pixel_at(113,189).should_be_of_color 0xffffff + pixel_at(126,169).should_be_of_color 0xffffff + pixel_at(136,167).should_be_of_color 0xffffff + pixel_at(135,195).should_be_of_color 0x000000 + pixel_at(125,194).should_be_of_color 0x000000 + pixel_at(135,141).should_be_of_color 0x000000 + pixel_at(113,141).should_be_of_color 0x000000 + pixel_at(74,169).should_be_of_color 0xffffff + pixel_at(310,437).should_be_of_color 0x000000 + pixel_at(313,442).should_be_of_color 0xffffff + pixel_at(320,430).should_be_of_color 0xffffff + pixel_at(363,423).should_be_of_color 0xffffff + pixel_at(383,419).should_be_of_color 0xffffff + pixel_at(405,413).should_be_of_color 0xffffff + pixel_at(416,407).should_be_of_color 0x000000 + pixel_at(435,404).should_be_of_color 0x000000 + pixel_at(458,403).should_be_of_color 0xffffff + pixel_at(474,394).should_be_of_color 0xffffff + pixel_at(489,385).should_be_of_color 0xffffff + pixel_at(499,393).should_be_of_color 0xffffff + pixel_at(525,381).should_be_of_color 0xffffff + pixel_at(545,376).should_be_of_color 0xffffff + pixel_at(415,278).should_be_of_color 0xffffff + pixel_at(409,271).should_be_of_color 0xffffff + pixel_at(432,256).should_be_of_color 0xffffff + pixel_at(440,250).should_be_of_color 0xffffff + pixel_at(449,243).should_be_of_color 0xffffff + pixel_at(458,237).should_be_of_color 0xffffff + pixel_at(472,228).should_be_of_color 0xffffff + pixel_at(476,221).should_be_of_color 0xffffff + pixel_at(489,214).should_be_of_color 0xffffff + pixel_at(497,202).should_be_of_color 0xffffff + pixel_at(504,196).should_be_of_color 0xffffff + pixel_at(243,262).should_be_of_color 0xffffff + pixel_at(242,255).should_be_of_color 0xffffff + pixel_at(253,257).should_be_of_color 0xffffff + pixel_at(129,370).should_be_of_color 0xffffff + pixel_at(367,419).should_be_of_color 0xffffff + pixel_at(387,412).should_be_of_color 0xffffff + pixel_at(232,188).should_be_of_color 0xffffff + pixel_at(233,262).should_be_of_color 0xffffff + pixel_at(207,253).should_be_of_color 0xffffff + pixel_at(264,254).should_be_of_color 0xffffff + pixel_at(290,256).should_be_of_color 0xffffff + pixel_at(303,252).should_be_of_color 0xffffff + pixel_at(317,256).should_be_of_color 0xffffff + pixel_at(326,256).should_be_of_color 0xffffff + pixel_at(317,188).should_be_of_color 0xffffff + pixel_at(325,193).should_be_of_color 0xffffff + pixel_at(289,193).should_be_of_color 0xffffff + pixel_at(252,194).should_be_of_color 0xffffff + pixel_at(206,197).should_be_of_color 0xffffff + pixel_at(206,188).should_be_of_color 0xffffff + pixel_at(222,123).should_be_of_color 0xffffff + pixel_at(231,118).should_be_of_color 0xffffff + pixel_at(245,128).should_be_of_color 0xffffff + pixel_at(260,124).should_be_of_color 0xffffff + pixel_at(285,124).should_be_of_color 0xffffff + pixel_at(295,123).should_be_of_color 0xffffff + pixel_at(305,118).should_be_of_color 0xffffff + pixel_at(316,118).should_be_of_color 0xffffff + pixel_at(343,128).should_be_of_color 0xffffff + pixel_at(343,118).should_be_of_color 0xffffff + pixel_at(303,198).should_be_of_color 0xffffff + pixel_at(43,136).should_be_of_color 0xffffff + pixel_at(53,135).should_be_of_color 0xffffff + area_at(17,177,76,197).should_not_be_plain_colored + area_at(74,134,141,162).should_not_be_plain_colored + area_at(77,173,141,196).should_not_be_plain_colored + area_at(219,119,346,128).should_not_be_plain_colored + area_at(110,347,117,354).should_not_be_plain_colored + area_at(129,366,138,373).should_not_be_plain_colored + area_at(139,373,149,381).should_not_be_plain_colored + area_at(166,396,176,403).should_not_be_plain_colored + area_at(187,413,197,420).should_not_be_plain_colored + area_at(199,422,208,429).should_not_be_plain_colored + area_at(317,430,347,434).should_not_be_plain_colored + area_at(353,420,382,425).should_not_be_plain_colored + area_at(396,408,427,414).should_not_be_plain_colored + area_at(430,400,461,404).should_not_be_plain_colored + area_at(478,389,503,395).should_not_be_plain_colored + area_at(513,381,539,385).should_not_be_plain_colored + area_at(203,189,330,197).should_not_be_plain_colored + area_at(204,253,331,261).should_not_be_plain_colored + area_at(410,271,415,277).should_not_be_plain_colored + area_at(423,261,428,266).should_not_be_plain_colored + area_at(440,246,445,257).should_not_be_plain_colored + area_at(460,228,465,235).should_not_be_plain_colored + area_at(475,217,483,223).should_not_be_plain_colored + area_at(489,206,493,212).should_not_be_plain_colored + area_at(502,197,505,202).should_not_be_plain_colored + end end diff --git a/spec/textselectspaces.spec.rb b/spec/textselectspaces.spec.rb index 8e126a5c..2299b9c8 100644 --- a/spec/textselectspaces.spec.rb +++ b/spec/textselectspaces.spec.rb @@ -1,7 +1,8 @@ require File.dirname(__FILE__) + '/spec_helper' describe "pdf conversion" do - convert_file "textselectspaces.pdf" do + + convert_file "textselectspaces.pdf" do area_at(32,22,257,46).should_contain_text 'The quick brown fox' area_at(32,53,226,77).should_contain_text 'The quick brown fox' area_at(31,84,198,108).should_contain_text 'Thequickbrownfox' diff --git a/spec/transpstack.spec.rb b/spec/transpstack.spec.rb index 8f6226f2..8219f1d5 100644 --- a/spec/transpstack.spec.rb +++ b/spec/transpstack.spec.rb @@ -1,7 +1,8 @@ require File.dirname(__FILE__) + '/spec_helper' describe "pdf conversion" do - convert_file "transpstack.pdf" do + + convert_file "transpstack.pdf" do pixel_at(15,15).should_be_of_color 0xffffff pixel_at(4,50).should_be_of_color 0xff0000 pixel_at(21,52).should_be_of_color 0x00ff00 diff --git a/src/pdf2swf.c b/src/pdf2swf.c index 43441874..c50a3de3 100644 --- a/src/pdf2swf.c +++ b/src/pdf2swf.c @@ -748,6 +748,8 @@ int main(int argn, char *argv[]) pagenum = 0; gfxdevice_t*out = create_output_device();; + pdf->prepare(pdf, out); + for(pagenr = 1; pagenr <= pdf->num_pages; pagenr++) { if(is_in_range(pagenr, pagerange)) { diff --git a/src/swfcombine.c b/src/swfcombine.c index 48847c25..378bf064 100644 --- a/src/swfcombine.c +++ b/src/swfcombine.c @@ -1385,6 +1385,7 @@ int main(int argn, char *argv[]) swf_WriteSWF(fi, &newswf); } close(fi); - return 0; + + return 0; //ok } |