Am Sonntag, 23. Dezember 2007 schrieb Reinhold Kainhofer:
> Hi,
> Schubert's Stabat Mater (D.383) contains lots of measures (3/4 time), where
> each beat is a eighth-tremolo using an additional triplet, ie. in lilypond
> notation:
>   \times 2/3 { a4.:8 } \times 4/6 {a2.:8} | ....
>
> If I use this in lilypond, it gets the timing correct, but unfortunately
> the tuplet (which appears only on a single printed note) does NOT display
> any tuplet number... 

Okay, I now took a look at the code and in Tuplet_number::print, there is a 
hardcoded check that kills the tuplet number if the tuplet "does not take up 
any time". In my eyes, this is wrong, since then there is no visual 
indication of a tuplet and the timing appears totally wrong (e.g. three 
dotted quarter notes in a e/4 measure!).

Attached is a patch, which fixes this problem by removing the check for 
zero-length in the tuplet number (but of course the tuplet bracket should not 
be shown for single-note tuplets).
Since the tuplet number uses the positions calculated by 
Tuplet_bracket::calc_positions, I removed the check there, too. 
Okay to apply?

I'm also attaching a simple example to show the new output. The only 
difference to the output without the patch are the "6" and the "3" in the 
first measure, of course.

Cheers,
Reinhold

-- 
------------------------------------------------------------------
Reinhold Kainhofer, Vienna University of Technology, Austria
email: [EMAIL PROTECTED], http://reinhold.kainhofer.com/
 * Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at/
 * K Desktop Environment, http://www.kde.org, KOrganizer maintainer
 * Chorvereinigung "Jung-Wien", http://www.jung-wien.at/
\version "2.11.40"

\relative c' {
  \times 4/6 {c2.:8} \times 2/3 {c4.:8} \times 2/3 {c4.:8} | 
  \times 4/6 {c8 c c c c c} \times 2/3 {c8 c c} \times 2/3 {c8 c c} 
}

Attachment: single_note_tuplet.pdf
Description: Adobe PDF document

From 1e2726f5ba65c049648a4c2c7a6ed906affe1d24 Mon Sep 17 00:00:00 2001
From: Reinhold Kainhofer <[EMAIL PROTECTED]>
Date: Mon, 25 Feb 2008 18:32:46 +0100
Subject: [PATCH] Show TupletBrackets also on single notes

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.

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.
---
 lily/tuplet-bracket.cc |   16 +++++-----------
 lily/tuplet-number.cc  |   10 ----------
 2 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc
index cfae0b9..956da75 100644
--- a/lily/tuplet-bracket.cc
+++ b/lily/tuplet-bracket.cc
@@ -280,8 +280,12 @@ Tuplet_bracket::print (SCM smob)
   else if (bracket == ly_symbol2scm ("if-no-beam"))
     bracket_visibility = !par_beam;
   
+  /* Don't print a tuplet bracket if no control-points were calculated or the tuplet 
+     does not span any time, i.e. a single-note tuplet */
   SCM cpoints =  me->get_property ("control-points");
-  if (scm_ilength (cpoints) < 2)
+  if (scm_ilength (cpoints) < 2 ||
+      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;
@@ -686,16 +690,6 @@ Tuplet_bracket::calc_positions (SCM 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);
diff --git a/lily/tuplet-number.cc b/lily/tuplet-number.cc
index 22d857b..78697ca 100644
--- a/lily/tuplet-number.cc
+++ b/lily/tuplet-number.cc
@@ -35,16 +35,6 @@ Tuplet_number::print (SCM smob)
       return SCM_EOL;
     }
 
-  /*
-    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);
 
-- 
1.5.4.2

_______________________________________________
lilypond-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to