From def419dfd961fee6fd0bf49321ae130143b618af Mon Sep 17 00:00:00 2001 From: Mike Solomon Date: Tue, 26 Jul 2011 17:05:36 +0200 Subject: [PATCH] Gives tremoli a pure height function to fix horizontal spacing. Now, tremoli do not collide with neighboring noteheads in tight spacing situations. --- input/regression/stem-tremolo-note-column.ly | 12 ++++++++++++ lily/include/stem-tremolo.hh | 2 +- lily/stem-tremolo.cc | 6 +++--- scm/define-grobs.scm | 2 +- scm/safe-lily.scm | 1 - 5 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 input/regression/stem-tremolo-note-column.ly diff --git a/input/regression/stem-tremolo-note-column.ly b/input/regression/stem-tremolo-note-column.ly new file mode 100644 index 0000000000..b09bd024fc --- /dev/null +++ b/input/regression/stem-tremolo-note-column.ly @@ -0,0 +1,12 @@ +\version "2.15.6" +\header{ + texidoc="Stem tremolos count in a note column's horizontal skyline. +" +} + + +\relative c'' { + \autoBeamOff + \override NoteHead #'stencil = #(ly:make-stencil '() '(0 . 0) '(0 . 0)) + \repeat unfold 8 { b8:32 } +} diff --git a/lily/include/stem-tremolo.hh b/lily/include/stem-tremolo.hh index f3f5931adc..adc2c0c0b4 100644 --- a/lily/include/stem-tremolo.hh +++ b/lily/include/stem-tremolo.hh @@ -31,9 +31,9 @@ public: DECLARE_SCHEME_CALLBACK (calc_slope, (SCM)); 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)); + DECLARE_SCHEME_CALLBACK (pure_height, (SCM, SCM, SCM)); static Stencil raw_stencil (Grob *, Real slope, Direction stemdir); static Stencil translated_stencil (Grob*, Real slope); static Stencil untranslated_stencil (Grob*, Real slope); diff --git a/lily/stem-tremolo.cc b/lily/stem-tremolo.cc index 4d1678889a..5a115835ef 100644 --- a/lily/stem-tremolo.cc +++ b/lily/stem-tremolo.cc @@ -146,16 +146,16 @@ Stem_tremolo::raw_stencil (Grob *me, Real slope, Direction stemdir) -MAKE_SCHEME_CALLBACK (Stem_tremolo, height, 1); +MAKE_SCHEME_CALLBACK (Stem_tremolo, pure_height, 3); SCM -Stem_tremolo::height (SCM smob) +Stem_tremolo::pure_height (SCM smob, SCM, SCM) { Grob *me = unsmob_grob (smob); /* Cannot use the real slope, since it looks at the Beam. */ - Stencil s1 (translated_stencil (me, 0.35)); + Stencil s1 (untranslated_stencil (me, 0.35)); return ly_interval2scm (s1.extent (Y_AXIS)); } diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index a5c03a5275..65b59bb01b 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -1936,7 +1936,6 @@ (stencil . ,ly:stem-tremolo::print) (style . ,ly:stem-tremolo::calc-style) (X-extent . ,ly:stem-tremolo::width) - (Y-extent . ,ly:stem-tremolo::height) (meta . ((class . Item) (interfaces . (stem-tremolo-interface)))))) @@ -2586,6 +2585,7 @@ (,ly:arpeggio::brew-chord-bracket . ,ly:arpeggio::pure-height) (,ly:arpeggio::brew-chord-slur . ,ly:arpeggio::pure-height) (,ly:hairpin::print . ,ly:hairpin::pure-height) + (,ly:stem-tremolo::print . ,ly:stem-tremolo::pure-height) (,ly:volta-bracket-interface::print . ,volta-bracket-interface::pure-height))) ;; ly:grob::stencil-extent is safe if the print callback is safe too diff --git a/scm/safe-lily.scm b/scm/safe-lily.scm index 60ac97920b..52e4bdeeb7 100644 --- a/scm/safe-lily.scm +++ b/scm/safe-lily.scm @@ -195,7 +195,6 @@ ly:stem::height ly:stem::offset-callback ly:stem::print - ly:stem-tremolo::height ly:stem-tremolo::print ly:sustain-pedal::print ly:system-start-delimiter::print -- 2.39.5