While tuplet brackets should not be printed for tuplets consisting
of only one note (e.g. a note with tremolo!), the tuplet number still
needs to be printed and can not be ignored. Otherwise the timing would
look messed up.
Since the tuplet number also uses the dimensions calculated by the tuplet
bracket, the tuplet bracket at least needs to calculate it's theoretical
size, too, even though it will not be printed for single-note tuplets. The
check to kill zero-length tuplet brackets has thus been moved from
calc_positions to print in Tuplet_bracket.
In the print function we mustn't kill the bracket (which
will also kill the number), but only hide the bracket.
Also added a test case.
--- /dev/null
+
+\header {
+
+ texidoc = "Show tuplet numbers also on single-note tuplets (otherwise the timing would look messed up!), but don't show a bracket. Make sure that tuplets without any notes don't show any number, either."
+
+}
+\version "2.11.41"
+
+\paper { ragged-right = ##t
+indent = 0.0 }
+
+\new Staff <<
+ \new Voice \relative c'' {
+ \times 4/6 { c2.:8 } \times 2/3 { g4.:8 } \times 2/3 { a,4.:8 } \times 4/6 {} \bar"|."
+ }
+>>
+
else if (bracket == ly_symbol2scm ("if-no-beam"))
bracket_visibility = !par_beam;
else if (bracket == ly_symbol2scm ("if-no-beam"))
bracket_visibility = !par_beam;
+ /* Don't print a tuplet bracket and number if no control-points were calculated */
SCM cpoints = me->get_property ("control-points");
if (scm_ilength (cpoints) < 2)
{
me->suicide ();
return SCM_EOL;
}
SCM cpoints = me->get_property ("control-points");
if (scm_ilength (cpoints) < 2)
{
me->suicide ();
return SCM_EOL;
}
+ /* if the tuplet does not span any time, i.e. a single-note tuplet, hide
+ the bracket, but still let the number be displayed */
+ if (robust_scm2moment (me->get_bound (LEFT)->get_column ()->get_property ("when"), Moment (0))
+ == robust_scm2moment (me->get_bound (RIGHT)->get_column ()->get_property ("when"), Moment (0)))
+ {
+ bracket_visibility = false;
+ }
Drul_array<Offset> points;
points[LEFT] = ly_scm2offset (scm_car (cpoints));
Drul_array<Offset> points;
points[LEFT] = ly_scm2offset (scm_car (cpoints));
{
Spanner *me = unsmob_spanner (smob);
{
Spanner *me = unsmob_spanner (smob);
- /*
- Don't print if it doesn't span time.
- */
- if (robust_scm2moment (me->get_bound (LEFT)->get_column ()->get_property ("when"), Moment (0))
- == robust_scm2moment (me->get_bound (RIGHT)->get_column ()->get_property ("when"), Moment (0)))
- {
- me->suicide ();
- return SCM_EOL;
- }
-
Real dy = 0.0;
Real offset = 0.0;
calc_position_and_height (me, &offset, &dy);
Real dy = 0.0;
Real offset = 0.0;
calc_position_and_height (me, &offset, &dy);
- /*
- Don't print if it doesn't span time.
- */
- if (robust_scm2moment (tuplet->get_bound (LEFT)->get_column ()->get_property ("when"), Moment (0))
- == robust_scm2moment (tuplet->get_bound (RIGHT)->get_column ()->get_property ("when"), Moment (0)))
- {
- me->suicide ();
- return SCM_EOL;
- }
-
SCM stc_scm = Text_interface::print (smob);
Stencil *stc = unsmob_stencil (stc_scm);
SCM stc_scm = Text_interface::print (smob);
Stencil *stc = unsmob_stencil (stc_scm);