X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=pdf2swf%2Fswfoutput.cc;h=8a129bc719e8cd815f108e23c13170c006d43e81;hb=baad9b2b637cabbc94f94d2140656d8c84261e1c;hp=407907be7dea1e4ad5ec31944ccff137e9e1e78a;hpb=8fd13edea1571f100db08fc5c19d08808a6ead1b;p=swftools.git diff --git a/pdf2swf/swfoutput.cc b/pdf2swf/swfoutput.cc index 407907b..8a129bc 100644 --- a/pdf2swf/swfoutput.cc +++ b/pdf2swf/swfoutput.cc @@ -92,16 +92,18 @@ static void transform (plotxy*p0,struct swfmatrix*m) } // write a move-to command into the swf -static void moveto(TAG*tag, plotxy p0) +static int moveto(TAG*tag, plotxy p0) { int rx = (int)(p0.x*20); int ry = (int)(p0.y*20); if(rx!=swflastx || ry!=swflasty || fillstylechanged) { swf_ShapeSetMove (tag, shape, rx,ry); fillstylechanged = 0; + swflastx=rx; + swflasty=ry; + return 1; } - swflastx=rx; - swflasty=ry; + return 0; } // write a line-to command into the swf @@ -146,17 +148,29 @@ static void line(TAG*tag, plotxy p0, plotxy p1, struct swfmatrix*m) static void spline(TAG*tag,plotxy p0,plotxy p1,plotxy p2,plotxy p3,struct swfmatrix*m) { double d; - struct qspline q[16]; + struct qspline q[128]; int num; int t; transform(&p0,m); transform(&p1,m); transform(&p2,m); transform(&p3,m); - - num = approximate(p0,p1,p2,p3,q); + cspline c; + c.start = p3; + c.control1 = p2; + c.control2 = p1; + c.end = p0; + + if(storefont) { + /* fonts use a different approximation than shapes */ + num = cspline_approximate(&c, q, 10.0, APPROXIMATE_RECURSIVE_BINARY); + //num = cspline_approximate(&c, q, 10.0, APPROXIMATE_INFLECTION); + } else { + num = cspline_approximate(&c, q, 1.0, APPROXIMATE_RECURSIVE_BINARY); + } for(t=0;t=0) endshape();