From: Mike Solomon Date: Wed, 28 Dec 2011 09:22:39 +0000 (+0100) Subject: Centers tremoli on double stems in TabVoice contexts. X-Git-Tag: release/2.15.24-1~30 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;ds=inline;h=297e9f6f16be3a451f2381c00e7f44ac61232154;p=lilypond.git Centers tremoli on double stems in TabVoice contexts. --- diff --git a/input/regression/tablature-double-stem-tremolo.ly b/input/regression/tablature-double-stem-tremolo.ly new file mode 100644 index 0000000000..fd76588ac9 --- /dev/null +++ b/input/regression/tablature-double-stem-tremolo.ly @@ -0,0 +1,11 @@ +\version "2.15.24" + +\header { + texidoc = "Tremoli applied to double stems in a @code{TabVoice} +should be centered on the double stem. +" +} +\new TabVoice \relative c' { + \tabFullNotation + a2:32 +} \ No newline at end of file diff --git a/ly/property-init.ly b/ly/property-init.ly index 3f0c1185f0..37a68917e7 100644 --- a/ly/property-init.ly +++ b/ly/property-init.ly @@ -448,6 +448,7 @@ tabFullNotation = { \revert TabVoice.Stem #'transparent \revert TabVoice.Flag #'transparent \override TabVoice.Stem #'stencil = #tabvoice::draw-double-stem-for-half-notes + \override TabVoice.Stem #'X-extent = #tabvoice::make-double-stem-width-for-half-notes \set autoBeaming = ##t \revert NoteColumn #'ignore-collision % beams, dots diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 157055779a..35d82c3f37 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -1997,9 +1997,16 @@ (stencil . ,ly:stem-tremolo::print) (style . ,ly:stem-tremolo::calc-style) (X-extent . ,ly:stem-tremolo::width) + (X-offset . ,(ly:make-simple-closure + `(,+ + ,(ly:make-simple-closure + (list ly:self-alignment-interface::centered-on-x-parent)) + ,(ly:make-simple-closure + (list ly:self-alignment-interface::x-aligned-on-self))))) (Y-offset . ,ly:stem-tremolo::calc-y-offset) (meta . ((class . Item) - (interfaces . (stem-tremolo-interface)))))) + (interfaces . (self-alignment-interface + stem-tremolo-interface)))))) (StringNumber . ( diff --git a/scm/tablature.scm b/scm/tablature.scm index c26af257c8..5dd774aac8 100644 --- a/scm/tablature.scm +++ b/scm/tablature.scm @@ -78,6 +78,16 @@ ;; if stems are drawn, it is nice to have a double stem for ;; (dotted) half notes to distinguish them from quarter notes: +(define-public (tabvoice::make-double-stem-width-for-half-notes grob) + (let ((X-extent (ly:stem::width grob))) + + ;; is the note a (dotted) half note? + (if (= 1 (ly:grob-property grob 'duration-log)) + ;; yes -> return double stem width + (cons (car X-extent) (+ 0.5 (* 2 (cdr X-extent)))) + ;; no -> return simple stem width + X-extent))) + (define-public (tabvoice::draw-double-stem-for-half-notes grob) (let ((stem (ly:stem::print grob)))