+ startshape(output);
+ }
+}
+
+void drawT1toRect(struct swfoutput*output, double x, double y, struct swfmatrix* m, T1_OUTLINE*outline, int num, int line_cap, int line_join, double line_width)
+{
+ plotxy d1,d2,p1,p2,p3,p4;
+
+ d1.x = (outline->dest.x/(float)0xffff);
+ d1.y = (outline->dest.y/(float)0xffff);
+ d2 = getPivot(outline, 0, line_width, 0, 0);
+
+ assert(line_cap != LINE_CAP_ROUND);
+ if(line_cap == LINE_CAP_SQUARE) {
+ x -= +d2.y;
+ y -= -d2.x;
+ d1.x += +2*d2.y;
+ d1.y += -2*d2.x;
+ }
+
+ p1.x = x + d2.x;
+ p1.y = y + d2.y;
+ p2.x = x + d2.x + d1.x;
+ p2.y = y + d2.y + d1.y;
+ p3.x = x - d2.x + d1.x;
+ p3.y = y - d2.y + d1.y;
+ p4.x = x - d2.x;
+ p4.y = y - d2.y;
+
+ line(tag, p1,p2, m);
+ line(tag, p2,p3, m);
+ line(tag, p3,p4, m);
+ line(tag, p4,p1, m);
+}
+
+void drawShortPathWithStraightEnds(struct swfoutput*output, double x, double y, struct swfmatrix* m, T1_OUTLINE*outline, int num, int line_cap, int line_join, double line_width)
+{
+ T1_OUTLINE*tmp=outline;
+ double xx=x,yy=y;
+ int stop=0;
+ assert(shapeid>=0);
+
+ startFill();
+ drawT1toRect(output, x, y, m,outline, num, line_cap, line_join, line_width);
+
+ while(tmp->link && tmp->link->type!=T1_PATHTYPE_MOVE) {
+ xx += (tmp->dest.x/(float)0xffff);
+ yy += (tmp->dest.y/(float)0xffff);
+ tmp = tmp->link;
+ }
+
+ assert(tmp->type == T1_PATHTYPE_LINE);
+ assert(outline->type == T1_PATHTYPE_LINE);
+
+ if(tmp!=outline) {
+
+ if(outline->link == tmp) {
+ /* the two straight line segments (which are everything we
+ need to draw) are very likely to overlap. To avoid that
+ they cancel each other out at the end points, start a new
+ shape for the second one */
+ endshape();startshape(output);
+ startFill();
+ }
+
+ drawT1toRect(output, xx, yy, m, tmp, num, line_cap, line_join, line_width);
+
+ if(outline->link != tmp)
+ {
+ stopFill();stop=1;
+ int save= tmp->type;
+ tmp->type = T1_PATHTYPE_MOVE;
+ x += (outline->dest.x/(float)0xffff);
+ y += (outline->dest.y/(float)0xffff);
+ outline = outline->link;
+ drawShortPath(output, x, y, m, outline);
+ tmp->type = save;
+ }