Fixes Issue 1504, allowing feather beam line breaking.
[lilypond/patrick.git] / lily / dots.cc
blob8319118752c781ec16fc01f69fa7f62a035c44a0
1 /*
2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 1997--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
20 #include "dots.hh"
22 #include "item.hh"
23 #include "output-def.hh"
24 #include "font-interface.hh"
25 #include "lookup.hh"
26 #include "staff-symbol-referencer.hh"
27 #include "international.hh"
29 MAKE_SCHEME_CALLBACK (Dots, print, 1);
30 SCM
31 Dots::print (SCM d)
33 Grob *sc = unsmob_grob (d);
34 Stencil mol;
36 SCM c = sc->get_property ("dot-count");
38 if (scm_is_number (c))
40 SCM scm_style = sc->get_property ("style");
41 string style ="";
42 if (scm_is_symbol (scm_style))
43 style = ly_symbol2string (scm_style);
44 string idx = "dots.dot" + style;
45 Stencil d = Font_interface::get_default_font (sc)->find_by_name (idx);
46 if (d.is_empty ())
48 sc->warning (_f ("dot `%s' not found", idx.c_str ()));
49 return SCM_EOL;
51 Real dw = d.extent (X_AXIS).length ();
54 we need to add a real blank box, to assure that
55 side-positioning doth not cancel the left-most padding. */
58 TODO: this should be handled by side-position padding.
60 mol = Lookup::blank (Box (Interval (0, 0),
61 Interval (0, 0)));
63 for (int i = scm_to_int (c); i--;)
65 d.translate_axis (2 * dw, X_AXIS);
66 mol.add_at_edge (X_AXIS, RIGHT, d, dw);
69 return mol.smobbed_copy ();
72 ADD_INTERFACE (Dots,
73 "The dots to go with a notehead or rest. @code{direction}"
74 " sets the preferred direction to move in case of staff line"
75 " collisions. @code{style} defaults to undefined, which is"
76 " normal 19th/20th century traditional style. Set"
77 " @code{style} to @code{vaticana} for ancient type dots.",
79 /* properties */
80 "direction "
81 "dot-count "
82 "style "