From 0000bf354336882a1cb6d627570db840e5c05a27 Mon Sep 17 00:00:00 2001 From: Joe Neeman Date: Sun, 10 Feb 2008 12:26:46 +0100 Subject: [PATCH] Slightly better extent-estimation for stems. Particularly effects the spacing of grace notes (eg. in bug 571). --- lily/stem.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lily/stem.cc b/lily/stem.cc index 6016eebbb4..31311f101d 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -241,6 +241,7 @@ Stem::pure_height (SCM smob, SCM start, SCM end) return ly_interval2scm (iv); Real ss = Staff_symbol_referencer::staff_space (me); + Real rad = Staff_symbol_referencer::staff_radius (me); if (!to_boolean (me->get_property ("cross-staff"))) { @@ -255,12 +256,15 @@ Stem::pure_height (SCM smob, SCM start, SCM end) if (!hp.is_empty ()) iv.translate (hp[dir] * ss / 2); - } - /* at a minimum, make the pure-height cover the staff symbol */ - Real rad = Staff_symbol_referencer::staff_radius (me); - iv.add_point (-rad * ss); - iv.add_point (rad * ss); + /* extend the stem (away from the head) to cover the staff */ + if (dir == UP) + iv[UP] = max (iv[UP], rad * ss); + else + iv[DOWN] = min (iv[DOWN], -rad * ss); + } + else + iv = Interval (-rad * ss, rad * ss); return ly_interval2scm (iv); } -- 2.39.5