WEB: Found more hardcoded names, yay! Fix linking to essay, images in essay.
[lilypond/patrick.git] / lily / dots.cc
blobf2a88b95e96f2ac14ede85be03279cf4bf36d02a
1 /*
2 dots.cc -- implement Dots
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
9 #include "dots.hh"
11 #include "item.hh"
12 #include "output-def.hh"
13 #include "font-interface.hh"
14 #include "lookup.hh"
15 #include "staff-symbol-referencer.hh"
16 #include "international.hh"
18 MAKE_SCHEME_CALLBACK (Dots, print, 1);
19 SCM
20 Dots::print (SCM d)
22 Grob *sc = unsmob_grob (d);
23 Stencil mol;
25 SCM c = sc->get_property ("dot-count");
27 if (scm_is_number (c))
29 SCM scm_style = sc->get_property ("style");
30 string style ="";
31 if (scm_is_symbol (scm_style))
32 style = ly_symbol2string (scm_style);
33 string idx = "dots.dot" + style;
34 Stencil d = Font_interface::get_default_font (sc)->find_by_name (idx);
35 if (d.is_empty ())
37 sc->warning (_f ("dot `%s' not found", idx.c_str ()));
38 return SCM_EOL;
40 Real dw = d.extent (X_AXIS).length ();
43 we need to add a real blank box, to assure that
44 side-positioning doth not cancel the left-most padding. */
47 TODO: this should be handled by side-position padding.
49 mol = Lookup::blank (Box (Interval (0, 0),
50 Interval (0, 0)));
52 for (int i = scm_to_int (c); i--;)
54 d.translate_axis (2 * dw, X_AXIS);
55 mol.add_at_edge (X_AXIS, RIGHT, d, dw);
58 return mol.smobbed_copy ();
61 ADD_INTERFACE (Dots,
62 "The dots to go with a notehead or rest. @code{direction}"
63 " sets the preferred direction to move in case of staff line"
64 " collisions. @code{style} defaults to undefined, which is"
65 " normal 19th/20th century traditional style. Set"
66 " @code{style} to @code{vaticana} for ancient type dots.",
68 /* properties */
69 "direction "
70 "dot-count "
71 "style "