From: hanwen Date: Thu, 30 Mar 2006 10:33:00 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: release/2.8.2~27 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c773d93c826bf3e52298abfabf9f5e82a729bf0a;p=lilypond.git *** empty log message *** --- diff --git a/ChangeLog b/ChangeLog index 33fe45fd52..f00b59cb4e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-03-30 Joe Neeman + + * lily/stem-tremolo.cc (print): for whole notes (and breves, etc.) + position the tremolo based on the position of the notehead. + + * input/regression/stem-tremolo.ly: add example of unbeamed eighth + notes and update the texidoc line with the new positioning rules. + 2006-03-30 Han-Wen Nienhuys * lily/ttf.cc (print_trailer): oops. Backport brown paper bag bugfix. diff --git a/input/regression/stem-tremolo.ly b/input/regression/stem-tremolo.ly index 738649dda4..6cc2729daf 100644 --- a/input/regression/stem-tremolo.ly +++ b/input/regression/stem-tremolo.ly @@ -5,7 +5,13 @@ Stem tremolos or rolls are tremolo signs that look like beam segments crossing stems. If the stem is in a beam, the tremolo must be parallel to the beam. If the stem is invisible (e.g. on a whole note), the -tremolo must be centered on the note. +tremolo must be centered on the note. If the note has a flag (eg. an +unbeamed 8th note), the tremolo should be shortened if the stem is up +and tilted extra if the stem is down. + +The tremolos should be positioned a fixed distance from the end of the +stems unless there is no stem, in which case they should be positioned +a fixed distance from the note head. " } @@ -27,7 +33,7 @@ tremolo must be centered on the note. c,16:32 c: c c a16:32 a: a a c8:16 g: d: a: c8:32 f: b: e: - \transpose c c { f''8:256[ f'8: f'':] } + f8:256[ f,8: f':] f: \noBeam f,,: \noBeam c16:32 \noBeam c'': } diff --git a/lily/stem-tremolo.cc b/lily/stem-tremolo.cc index 05de18bab7..b3ea13d30d 100644 --- a/lily/stem-tremolo.cc +++ b/lily/stem-tremolo.cc @@ -175,6 +175,7 @@ Stem_tremolo::print (SCM grob) Spanner *beam = Stem::get_beam (stem); Direction stemdir = get_grob_direction (stem); + bool whole_note = Stem::duration_log (stem) <= 0; if (stemdir == 0) stemdir = UP; @@ -183,8 +184,11 @@ Stem_tremolo::print (SCM grob) ? Beam::get_beam_translation (beam) : 0.81; + /* for a whole note, we position relative to the notehead, so we want the + stencil aligned on the flag closest to the head */ + Direction stencil_dir = whole_note ? -stemdir : stemdir; Stencil mol = raw_stencil (me, robust_scm2double (me->get_property ("slope"), - 0.25), stemdir); + 0.25), stencil_dir); Interval mol_ext = mol.extent (Y_AXIS); Real ss = Staff_symbol_referencer::staff_space (me); @@ -207,6 +211,14 @@ Stem_tremolo::print (SCM grob) if (stemdir == UP) end_y -= stemdir * beam_translation * 0.5; } + if (whole_note) + { + /* we shouldn't position relative to the end of the stem since the stem + is invisible */ + vector nhp = Stem::note_head_positions (stem); + Real note_head = (stemdir == UP ? nhp.back () : nhp[0]); + end_y = note_head + stemdir * 2.0; + } mol.translate_axis (end_y, Y_AXIS); return mol.smobbed_copy ();