X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Farpeggio.cc;h=fcb32debcbdd6107ee5987b2427d49839f63135c;hb=5b4b0d6e9a197e8f9eb085b7c2ad78b8be3e5cfc;hp=80858426bc6eb43bc7f12e2f77a83aec4351d8b3;hpb=0ef916567cbdf84627f6d35e33390457703f53b5;p=lilypond.git diff --git a/lily/arpeggio.cc b/lily/arpeggio.cc index 80858426bc..fcb32debcb 100644 --- a/lily/arpeggio.cc +++ b/lily/arpeggio.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 2000--2007 Jan Nieuwenhuizen + (c) 2000--2008 Jan Nieuwenhuizen */ #include "arpeggio.hh" @@ -97,6 +97,16 @@ Arpeggio::print (SCM smob) Font_metric *fm = Font_interface::get_default_font (me); Stencil squiggle = fm->find_by_name ("scripts.arpeggio"); + /* + Compensate for rounding error which may occur when a chord + reaches the center line, resulting in an extra squiggle + being added to the arpeggio stencil. This value is appreciably + larger than the rounding error, which is in the region of 1e-16 + for a global-staff-size of 20, but small enough that it does not + interfere with smaller staff sizes. + */ + const Real epsilon = 1e-3; + Stencil arrow; if (dir) { @@ -104,9 +114,10 @@ Arpeggio::print (SCM smob) heads[dir] -= dir * arrow.extent (Y_AXIS).length (); } - for (Real y = heads[LEFT]; y < heads[RIGHT]; - y += squiggle.extent (Y_AXIS).length ()) - mol.add_at_edge (Y_AXIS, UP, squiggle, 0.0); + while (mol.extent (Y_AXIS).length () + epsilon < heads.length ()) + { + mol.add_at_edge (Y_AXIS, UP, squiggle, 0.0); + } mol.translate_axis (heads[LEFT], Y_AXIS); if (dir)