From 489ffb188ae02237fa0a22763d08841a669dc2a4 Mon Sep 17 00:00:00 2001 From: Joe Neeman Date: Sun, 22 Apr 2007 09:29:43 +1000 Subject: [PATCH] Fix 352. Ensure that stem-tremolos have a width so they are included in the skyline. --- lily/include/stem-tremolo.hh | 1 + lily/stem-tremolo.cc | 14 ++++++++++++++ scm/define-grobs.scm | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lily/include/stem-tremolo.hh b/lily/include/stem-tremolo.hh index 36cb146efe..b6512b9960 100644 --- a/lily/include/stem-tremolo.hh +++ b/lily/include/stem-tremolo.hh @@ -21,6 +21,7 @@ public: DECLARE_SCHEME_CALLBACK (calc_width, (SCM)); DECLARE_SCHEME_CALLBACK (print, (SCM)); DECLARE_SCHEME_CALLBACK (height, (SCM)); + DECLARE_SCHEME_CALLBACK (width, (SCM)); DECLARE_SCHEME_CALLBACK (calc_style, (SCM)); static Stencil raw_stencil (Grob *, Real slope, Direction stemdir); static Stencil translated_stencil (Grob*, Real slope); diff --git a/lily/stem-tremolo.cc b/lily/stem-tremolo.cc index a718b7f69d..b91b18fd5a 100644 --- a/lily/stem-tremolo.cc +++ b/lily/stem-tremolo.cc @@ -149,6 +149,20 @@ Stem_tremolo::height (SCM smob) return ly_interval2scm (s1.extent (Y_AXIS)); } +MAKE_SCHEME_CALLBACK (Stem_tremolo, width, 1); +SCM +Stem_tremolo::width (SCM smob) +{ + Grob *me = unsmob_grob (smob); + + /* + Cannot use the real slope, since it looks at the Beam. + */ + Stencil s1 (untranslated_stencil (me, 0.35)); + + return ly_interval2scm (s1.extent (X_AXIS)); +} + Real Stem_tremolo::vertical_length (Grob *me) { diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 196b550158..9b75b09afe 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -1622,8 +1622,8 @@ (StemTremolo . ( (Y-extent . ,ly:stem-tremolo::height) + (X-extent . ,ly:stem-tremolo::width) (stencil . ,ly:stem-tremolo::print) - (X-extent . #f) (slope . ,ly:stem-tremolo::calc-slope) (beam-width . ,ly:stem-tremolo::calc-width) ; staff-space (style . ,ly:stem-tremolo::calc-style) -- 2.39.5