Change short-indent behaviour.
[lilypond.git] / lily / lookup.cc
blob62e0d9731786d78c03da4f7bcefe0cc3ae8cf4e7
1 /*
2 lookup.cc -- implement simple Lookup methods.
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
8 Jan Nieuwenhuizen <janneke@gnu.org>
9 */
11 #include "lookup.hh"
13 #include <cmath>
14 #include <cctype>
15 using namespace std;
17 #include "line-interface.hh"
18 #include "warn.hh"
19 #include "dimensions.hh"
20 #include "bezier.hh"
21 #include "string-convert.hh"
22 #include "file-path.hh"
23 #include "main.hh"
24 #include "lily-guile.hh"
25 #include "font-metric.hh"
27 Stencil
28 Lookup::dot (Offset p, Real radius)
30 SCM at = (scm_list_n (ly_symbol2scm ("dot"),
31 scm_from_double (p[X_AXIS]),
32 scm_from_double (p[Y_AXIS]),
33 scm_from_double (radius),
34 SCM_UNDEFINED));
35 Box box;
36 box.add_point (p - Offset (radius, radius));
37 box.add_point (p + Offset (radius, radius));
38 return Stencil (box, at);
41 Stencil
42 Lookup::beam (Real slope, Real width, Real thick, Real blot)
44 Box b;
46 Offset p;
48 p = Offset (0, thick / 2);
49 b.add_point (p);
50 p += Offset (1, -1) * (blot / 2);
52 SCM points = SCM_EOL;
54 points = scm_cons (scm_from_double (p[X_AXIS]),
55 scm_cons (scm_from_double (p[Y_AXIS]),
56 points));
58 p = Offset (0, -thick / 2);
59 b.add_point (p);
60 p += Offset (1, 1) * (blot / 2);
62 points = scm_cons (scm_from_double (p[X_AXIS]),
63 scm_cons (scm_from_double (p[Y_AXIS]),
64 points));
66 p = Offset (width, width * slope - thick / 2);
67 b.add_point (p);
68 p += Offset (-1, 1) * (blot / 2);
70 points = scm_cons (scm_from_double (p[X_AXIS]),
71 scm_cons (scm_from_double (p[Y_AXIS]),
72 points));
74 p = Offset (width, width * slope + thick / 2);
75 b.add_point (p);
76 p += Offset (-1, -1) * (blot / 2);
78 points = scm_cons (scm_from_double (p[X_AXIS]),
79 scm_cons (scm_from_double (p[Y_AXIS]),
80 points));
82 SCM expr = scm_list_n (ly_symbol2scm ("polygon"),
83 ly_quote_scm (points),
84 scm_from_double (blot),
85 SCM_BOOL_T,
86 SCM_UNDEFINED);
88 return Stencil (b, expr);
91 Stencil
92 Lookup::dashed_slur (Bezier b, Real thick, Real dash_period, Real dash_fraction)
94 SCM l = SCM_EOL;
96 Real on = dash_fraction * dash_period;
97 Real off = dash_period - on;
99 for (int i = 4; i--;)
100 l = scm_cons (ly_offset2scm (b.control_[i]), l);
102 SCM at = (scm_list_n (ly_symbol2scm ("dashed-slur"),
103 scm_from_double (thick),
104 scm_from_double (on),
105 scm_from_double (off),
106 ly_quote_scm (l),
107 SCM_UNDEFINED));
109 Box box (b.extent (X_AXIS), b.extent (Y_AXIS));
110 return Stencil (box, at);
113 Stencil
114 Lookup::rotated_box (Real slope, Real width, Real thick, Real blot)
116 vector<Offset> pts;
117 Offset rot (1, slope);
119 thick -= 2*blot;
120 width -= 2*blot;
121 rot /= sqrt (1 + slope*slope);
122 pts.push_back (Offset (0, -thick / 2) * rot);
123 pts.push_back (Offset (width, -thick / 2) * rot);
124 pts.push_back (Offset (width, thick / 2) * rot);
125 pts.push_back (Offset (0, thick / 2) * rot);
126 return Lookup::round_filled_polygon (pts, blot);
129 Stencil
130 Lookup::horizontal_line (Interval w, Real th)
132 SCM at = scm_list_n (ly_symbol2scm ("draw-line"),
133 scm_from_double (th),
134 scm_from_double (w[LEFT]),
135 scm_from_double (0),
136 scm_from_double (w[RIGHT]),
137 scm_from_double (0),
138 SCM_UNDEFINED);
140 Box box;
141 box[X_AXIS] = w;
142 box[Y_AXIS] = Interval (-th / 2, th / 2);
144 return Stencil (box, at);
147 Stencil
148 Lookup::blank (Box b)
150 return Stencil (b, scm_from_locale_string (""));
153 Stencil
154 Lookup::filled_box (Box b)
156 return round_filled_box (b, 0.0);
160 * round filled box:
162 * __________________________________
163 * / \ ^ / \ ^
164 * | |blot | |
165 * | | |dia | | |
166 * | |meter | |
167 * |\ _ _ / v \ _ _ /| |
168 * | | |
169 * | | | Box
170 * | <------>| | extent
171 * | blot | | (Y_AXIS)
172 * | diameter| |
173 * | | |
174 * | _ _ _ _ | |
175 * |/ \ / \| |
176 * | | |
177 * | | | | |
178 * | | |
179 * x\_____/______________\_____/|_____v
180 * |(0, 0) |
181 * | |
182 * | |
183 * |<-------------------------->|
184 * Box extent (X_AXIS)
186 Stencil
187 Lookup::round_filled_box (Box b, Real blotdiameter)
189 if (b.x ().length () < blotdiameter)
190 blotdiameter = b.x ().length ();
191 if (b.y ().length () < blotdiameter)
192 blotdiameter = b.y ().length ();
194 SCM at = (scm_list_n (ly_symbol2scm ("round-filled-box"),
195 scm_from_double (-b[X_AXIS][LEFT]),
196 scm_from_double (b[X_AXIS][RIGHT]),
197 scm_from_double (-b[Y_AXIS][DOWN]),
198 scm_from_double (b[Y_AXIS][UP]),
199 scm_from_double (blotdiameter),
200 SCM_UNDEFINED));
202 return Stencil (b, at);
206 * Create Stencil that represents a filled polygon with round edges.
208 * LIMITATIONS:
210 * (a) Only outer (convex) edges are rounded.
212 * (b) This algorithm works as expected only for polygons whose edges
213 * do not intersect. For example, the polygon ((0, 0), (q, 0), (0,
214 * q), (q, q)) has an intersection at point (q/2, q/2) and therefore
215 * will give a strange result. Even non-adjacent edges that just
216 * touch each other will in general not work as expected for non-null
217 * blotdiameter.
219 * (c) Given a polygon ((x0, y0), (x1, y1), ... , (x (n-1), y (n-1))),
220 * if there is a natural number k such that blotdiameter is greater
221 * than the maximum of { | (x (k mod n), y (k mod n)) - (x ((k+1) mod n),
222 * y ((k+1) mod n)) |, | (x (k mod n), y (k mod n)) - (x ((k+2) mod n),
223 * y ((k+2) mod n)) |, | (x ((k+1) mod n), y ((k+1) mod n)) - (x ((k+2)
224 * mod n), y ((k+2) mod n)) | }, then the outline of the rounded
225 * polygon will exceed the outline of the core polygon. In other
226 * words: Do not draw rounded polygons that have a leg smaller or
227 * thinner than blotdiameter (or set blotdiameter to a sufficiently
228 * small value -- maybe even 0.0)!
230 * NOTE: Limitations (b) and (c) arise from the fact that round edges
231 * are made by moulding sharp edges to round ones rather than adding
232 * to a core filled polygon. For details of these two different
233 * approaches, see the thread upon the ledger lines patch that started
234 * on March 25, 2002 on the devel mailing list. The below version of
235 * round_filled_polygon () sticks to the moulding model, which the
236 * majority of the list participants finally voted for. This,
237 * however, results in the above limitations and a much increased
238 * complexity of the algorithm, since it has to compute a shrinked
239 * polygon -- which is not trivial define precisely and unambigously.
240 * With the other approach, one simply could move a circle of size
241 * blotdiameter along all edges of the polygon (which is what the
242 * postscript routine in the backend effectively does, but on the
243 * shrinked polygon). --jr
245 Stencil
246 Lookup::round_filled_polygon (vector<Offset> const &points,
247 Real blotdiameter)
249 /* TODO: Maybe print a warning if one of the above limitations
250 applies to the given polygon. However, this is quite complicated
251 to check. */
253 const Real epsilon = 0.01;
255 #ifndef NDEBUG
256 /* remove consecutive duplicate points */
257 for (vsize i = 0; i < points.size (); i++)
259 int next = (i + 1) % points.size ();
260 Real d = (points[i] - points[next]).length ();
261 if (d < epsilon)
262 programming_error ("Polygon should not have duplicate points");
264 #endif
266 /* special cases: degenerated polygons */
267 if (points.size () == 0)
268 return Stencil ();
269 if (points.size () == 1)
270 return dot (points[0], 0.5 * blotdiameter);
271 if (points.size () == 2)
272 return Line_interface::make_line (blotdiameter, points[0], points[1]);
274 /* shrink polygon in size by 0.5 * blotdiameter */
275 vector<Offset> shrunk_points;
276 shrunk_points.resize (points.size ());
277 bool ccw = 1; // true, if three adjacent points are counterclockwise ordered
278 for (vsize i = 0; i < points.size (); i++)
280 int i0 = i;
281 int i1 = (i + 1) % points.size ();
282 int i2 = (i + 2) % points.size ();
283 Offset p0 = points[i0];
284 Offset p1 = points[i1];
285 Offset p2 = points[i2];
286 Offset p10 = p0 - p1;
287 Offset p12 = p2 - p1;
288 if (p10.length () != 0.0)
289 { // recompute ccw
290 Real phi = p10.arg ();
291 // rotate (p2 - p0) by (-phi)
292 Offset q = complex_multiply (p2 - p0, complex_exp (Offset (1.0, -phi)));
294 if (q[Y_AXIS] > 0)
295 ccw = 1;
296 else if (q[Y_AXIS] < 0)
297 ccw = 0;
298 else {} // keep ccw unchanged
300 else {} // keep ccw unchanged
301 Offset p10n = (1.0 / p10.length ()) * p10; // normalize length to 1.0
302 Offset p12n = (1.0 / p12.length ()) * p12;
303 Offset p13n = 0.5 * (p10n + p12n);
304 Offset p14n = 0.5 * (p10n - p12n);
305 Offset p13;
306 Real d = p13n.length () * p14n.length (); // distance p3n to line (p1..p0)
307 if (d < epsilon)
308 // special case: p0, p1, p2 are on a single line => build
309 // vector orthogonal to (p2-p0) of length 0.5 blotdiameter
311 p13[X_AXIS] = p10[Y_AXIS];
312 p13[Y_AXIS] = -p10[X_AXIS];
313 p13 = (0.5 * blotdiameter / p13.length ()) * p13;
315 else
316 p13 = (0.5 * blotdiameter / d) * p13n;
317 shrunk_points[i1] = p1 + ((ccw) ? p13 : -p13);
320 /* build scm expression and bounding box */
321 SCM shrunk_points_scm = SCM_EOL;
322 Box box;
323 for (vsize i = 0; i < shrunk_points.size (); i++)
325 SCM x = scm_from_double (shrunk_points[i][X_AXIS]);
326 SCM y = scm_from_double (shrunk_points[i][Y_AXIS]);
327 shrunk_points_scm = scm_cons (x, scm_cons (y, shrunk_points_scm));
328 box.add_point (points[i]);
330 SCM polygon_scm = scm_list_n (ly_symbol2scm ("polygon"),
331 ly_quote_scm (shrunk_points_scm),
332 scm_from_double (blotdiameter),
333 SCM_BOOL_T,
334 SCM_UNDEFINED);
336 Stencil polygon = Stencil (box, polygon_scm);
337 shrunk_points.clear ();
338 return polygon;
342 TODO: deprecate?
344 Stencil
345 Lookup::frame (Box b, Real thick, Real blot)
347 Stencil m;
348 Direction d = LEFT;
349 for (Axis a = X_AXIS; a < NO_AXES; a = Axis (a + 1))
351 Axis o = Axis ((a + 1)%NO_AXES);
354 Box edges;
355 edges[a] = b[a][d] + 0.5 * thick * Interval (-1, 1);
356 edges[o][DOWN] = b[o][DOWN] - thick / 2;
357 edges[o][UP] = b[o][UP] + thick / 2;
359 m.add_stencil (round_filled_box (edges, blot));
361 while (flip (&d) != LEFT);
363 return m;
367 Make a smooth curve along the points
369 Stencil
370 Lookup::slur (Bezier curve, Real curvethick, Real linethick)
372 Real alpha = (curve.control_[3] - curve.control_[0]).arg ();
373 Bezier back = curve;
374 Offset perp = curvethick * complex_exp (Offset (0, alpha + M_PI / 2)) * 0.5;
375 back.reverse ();
376 back.control_[1] += perp;
377 back.control_[2] += perp;
379 curve.control_[1] -= perp;
380 curve.control_[2] -= perp;
382 SCM scontrols[8];
384 for (int i = 0; i < 4; i++)
385 scontrols[i] = ly_offset2scm (back.control_[i]);
386 for (int i = 0; i < 4; i++)
387 scontrols[i + 4] = ly_offset2scm (curve.control_[i]);
390 Need the weird order b.o. the way PS want its arguments
392 int indices[] = {5, 6, 7, 4, 1, 2, 3, 0};
393 SCM list = SCM_EOL;
394 for (int i = 8; i--;)
395 list = scm_cons (scontrols[indices[i]], list);
397 SCM at = (scm_list_n (ly_symbol2scm ("bezier-sandwich"),
398 ly_quote_scm (list),
399 scm_from_double (linethick),
400 SCM_UNDEFINED));
401 Box b (curve.extent (X_AXIS),
402 curve.extent (Y_AXIS));
404 b[X_AXIS].unite (back.extent (X_AXIS));
405 b[Y_AXIS].unite (back.extent (Y_AXIS));
407 b.widen (0.5 * linethick, 0.5 * linethick);
408 return Stencil (b, at);
412 * Bezier Sandwich:
414 * .|
415 * . |
416 * top . |
417 * . curve |
418 * . |
419 * . |
420 * . |
421 * | |
422 * | .|
423 * | .
424 * | bottom .
425 * | . curve
426 * | .
427 * | .
428 * | .
429 * | .
430 * |.
434 Stencil
435 Lookup::bezier_sandwich (Bezier top_curve, Bezier bottom_curve)
438 Need the weird order b.o. the way PS want its arguments
440 SCM list = SCM_EOL;
441 list = scm_cons (ly_offset2scm (bottom_curve.control_[3]), list);
442 list = scm_cons (ly_offset2scm (bottom_curve.control_[0]), list);
443 list = scm_cons (ly_offset2scm (bottom_curve.control_[1]), list);
444 list = scm_cons (ly_offset2scm (bottom_curve.control_[2]), list);
445 list = scm_cons (ly_offset2scm (top_curve.control_[0]), list);
446 list = scm_cons (ly_offset2scm (top_curve.control_[3]), list);
447 list = scm_cons (ly_offset2scm (top_curve.control_[2]), list);
448 list = scm_cons (ly_offset2scm (top_curve.control_[1]), list);
450 SCM horizontal_bend = scm_list_n (ly_symbol2scm ("bezier-sandwich"),
451 ly_quote_scm (list),
452 scm_from_double (0.0),
453 SCM_UNDEFINED);
455 Interval x_extent = top_curve.extent (X_AXIS);
456 x_extent.unite (bottom_curve.extent (X_AXIS));
457 Interval y_extent = top_curve.extent (Y_AXIS);
458 y_extent.unite (bottom_curve.extent (Y_AXIS));
459 Box b (x_extent, y_extent);
461 return Stencil (b, horizontal_bend);
465 TODO: junk me.
467 Stencil
468 Lookup::accordion (SCM s, Real staff_space, Font_metric *fm)
470 Stencil m;
471 string sym = ly_scm2string (scm_car (s));
472 string reg = ly_scm2string (scm_car (scm_cdr (s)));
474 if (sym == "Discant")
476 Stencil r = fm->find_by_name ("accordion.accDiscant");
477 m.add_stencil (r);
478 if (reg.substr (0, 1) == "F")
480 Stencil d = fm->find_by_name ("accordion.accDot");
481 d.translate_axis (staff_space * 2.5 PT, Y_AXIS);
482 m.add_stencil (d);
483 reg = reg.substr (1);
485 int eflag = 0x00;
486 if (reg.substr (0, 3) == "EEE")
488 eflag = 0x07;
489 reg = reg.substr (3);
491 else if (reg.substr (0, 2) == "EE")
493 eflag = 0x05;
494 reg = reg.substr (2);
496 else if (reg.substr (0, 2) == "Eh")
498 eflag = 0x04;
499 reg = reg.substr (2);
501 else if (reg.substr (0, 1) == "E")
503 eflag = 0x02;
504 reg = reg.substr (1);
506 if (eflag & 0x02)
508 Stencil d = fm->find_by_name ("accordion.accDot");
509 d.translate_axis (staff_space * 1.5 PT, Y_AXIS);
510 m.add_stencil (d);
512 if (eflag & 0x04)
514 Stencil d = fm->find_by_name ("accordion.accDot");
515 d.translate_axis (staff_space * 1.5 PT, Y_AXIS);
516 d.translate_axis (0.8 * staff_space PT, X_AXIS);
517 m.add_stencil (d);
519 if (eflag & 0x01)
521 Stencil d = fm->find_by_name ("accordion.accDot");
522 d.translate_axis (staff_space * 1.5 PT, Y_AXIS);
523 d.translate_axis (-0.8 * staff_space PT, X_AXIS);
524 m.add_stencil (d);
526 if (reg.substr (0, 2) == "SS")
528 Stencil d = fm->find_by_name ("accordion.accDot");
529 d.translate_axis (0.5 * staff_space PT, Y_AXIS);
530 d.translate_axis (0.4 * staff_space PT, X_AXIS);
531 m.add_stencil (d);
532 d.translate_axis (-0.8 * staff_space PT, X_AXIS);
533 m.add_stencil (d);
534 reg = reg.substr (2);
536 if (reg.substr (0, 1) == "S")
538 Stencil d = fm->find_by_name ("accordion.accDot");
539 d.translate_axis (0.5 * staff_space PT, Y_AXIS);
540 m.add_stencil (d);
541 reg = reg.substr (1);
544 else if (sym == "Freebase")
546 Stencil r = fm->find_by_name ("accordion.accFreebase");
547 m.add_stencil (r);
548 if (reg.substr (0, 1) == "F")
550 Stencil d = fm->find_by_name ("accordion.accDot");
551 d.translate_axis (staff_space * 1.5 PT, Y_AXIS);
552 m.add_stencil (d);
553 reg = reg.substr (1);
555 if (reg == "E")
557 Stencil d = fm->find_by_name ("accordion.accDot");
558 d.translate_axis (staff_space * 0.5 PT, Y_AXIS);
559 m.add_stencil (d);
562 else if (sym == "Bayanbase")
564 Stencil r = fm->find_by_name ("accordion.accBayanbase");
565 m.add_stencil (r);
566 if (reg.substr (0, 1) == "T")
568 Stencil d = fm->find_by_name ("accordion.accDot");
569 d.translate_axis (staff_space * 2.5 PT, Y_AXIS);
570 m.add_stencil (d);
571 reg = reg.substr (1);
573 /* include 4' reed just for completeness. You don't want to use this. */
574 if (reg.substr (0, 1) == "F")
576 Stencil d = fm->find_by_name ("accordion.accDot");
577 d.translate_axis (staff_space * 1.5 PT, Y_AXIS);
578 m.add_stencil (d);
579 reg = reg.substr (1);
581 if (reg.substr (0, 2) == "EE")
583 Stencil d = fm->find_by_name ("accordion.accDot");
584 d.translate_axis (staff_space * 0.5 PT, Y_AXIS);
585 d.translate_axis (0.4 * staff_space PT, X_AXIS);
586 m.add_stencil (d);
587 d.translate_axis (-0.8 * staff_space PT, X_AXIS);
588 m.add_stencil (d);
589 reg = reg.substr (2);
591 if (reg.substr (0, 1) == "E")
593 Stencil d = fm->find_by_name ("accordion.accDot");
594 d.translate_axis (staff_space * 0.5 PT, Y_AXIS);
595 m.add_stencil (d);
596 reg = reg.substr (1);
599 else if (sym == "Stdbase")
601 Stencil r = fm->find_by_name ("accordion.accStdbase");
602 m.add_stencil (r);
603 if (reg.substr (0, 1) == "T")
605 Stencil d = fm->find_by_name ("accordion.accDot");
606 d.translate_axis (staff_space * 3.5 PT, Y_AXIS);
607 m.add_stencil (d);
608 reg = reg.substr (1);
610 if (reg.substr (0, 1) == "F")
612 Stencil d = fm->find_by_name ("accordion.accDot");
613 d.translate_axis (staff_space * 2.5 PT, Y_AXIS);
614 m.add_stencil (d);
615 reg = reg.substr (1);
617 if (reg.substr (0, 1) == "M")
619 Stencil d = fm->find_by_name ("accordion.accDot");
620 d.translate_axis (staff_space * 2 PT, Y_AXIS);
621 d.translate_axis (staff_space PT, X_AXIS);
622 m.add_stencil (d);
623 reg = reg.substr (1);
625 if (reg.substr (0, 1) == "E")
627 Stencil d = fm->find_by_name ("accordion.accDot");
628 d.translate_axis (staff_space * 1.5 PT, Y_AXIS);
629 m.add_stencil (d);
630 reg = reg.substr (1);
632 if (reg.substr (0, 1) == "S")
634 Stencil d = fm->find_by_name ("accordion.accDot");
635 d.translate_axis (staff_space * 0.5 PT, Y_AXIS);
636 m.add_stencil (d);
637 reg = reg.substr (1);
640 /* ugh maybe try to use regular font for S.B. and B.B and only use one font
641 for the rectangle */
642 else if (sym == "SB")
644 Stencil r = fm->find_by_name ("accordion.accSB");
645 m.add_stencil (r);
647 else if (sym == "BB")
649 Stencil r = fm->find_by_name ("accordion.accBB");
650 m.add_stencil (r);
652 else if (sym == "OldEE")
654 Stencil r = fm->find_by_name ("accordion.accOldEE");
655 m.add_stencil (r);
657 else if (sym == "OldEES")
659 Stencil r = fm->find_by_name ("accordion.accOldEES");
660 m.add_stencil (r);
662 return m;
665 Stencil
666 Lookup::repeat_slash (Real w, Real s, Real t)
668 #if 0 /* TODO */
669 vector<Offset> points;
670 Real blotdiameter = 0.0;
672 Offset p1 (0, 0);
673 Offset p2 (w, w * s);
675 return Lookup::round_filled_polygon (points, blotdiameter);
676 #endif
678 SCM wid = scm_from_double (w);
679 SCM sl = scm_from_double (s);
680 SCM thick = scm_from_double (t);
681 SCM slashnodot = scm_list_n (ly_symbol2scm ("repeat-slash"),
682 wid, sl, thick, SCM_UNDEFINED);
684 Box b (Interval (0, w + sqrt (sqr (t / s) + sqr (t))),
685 Interval (0, w * s));
687 return Stencil (b, slashnodot); // http://slashnodot.org
690 Stencil
691 Lookup::bracket (Axis a, Interval iv, Real thick, Real protrude, Real blot)
693 Box b;
694 Axis other = Axis ((a + 1)%2);
695 b[a] = iv;
696 b[other] = Interval (-1, 1) * thick * 0.5;
698 Stencil m = round_filled_box (b, blot);
700 b[a] = Interval (iv[UP] - thick, iv[UP]);
701 Interval oi = Interval (-thick / 2, thick / 2 + fabs (protrude));
702 oi *= sign (protrude);
703 b[other] = oi;
704 m.add_stencil (round_filled_box (b, blot));
705 b[a] = Interval (iv[DOWN], iv[DOWN] + thick);
706 m.add_stencil (round_filled_box (b, blot));
708 return m;
711 Stencil
712 Lookup::triangle (Interval iv, Real thick, Real protrude)
714 Box b;
715 b[X_AXIS] = Interval (0, iv.length ());
716 b[Y_AXIS] = Interval (min (0., protrude), max (0.0, protrude));
718 vector<Offset> points;
719 points.push_back (Offset (iv[LEFT], 0));
720 points.push_back (Offset (iv[RIGHT], 0));
721 points.push_back (Offset (iv.center (), protrude));
723 return points_to_line_stencil (thick, points);
729 Stencil
730 Lookup::points_to_line_stencil (Real thick, vector<Offset> const &points)
732 Stencil ret;
733 for (vsize i = 1; i < points.size (); i++)
735 if (points[i-1].is_sane () && points[i].is_sane ())
737 Stencil line
738 = Line_interface::make_line (thick, points[i-1], points[i]);
739 ret.add_stencil (line);
742 return ret;