]> git.donarmstrong.com Git - lilypond.git/blobdiff - input/lsr/marking-notes-of-spoken-parts-with-a-cross-on-the-stem.ly
Merge branch 'master' of carldsorensen@git.sv.gnu.org:/srv/git/lilypond into ralph
[lilypond.git] / input / lsr / marking-notes-of-spoken-parts-with-a-cross-on-the-stem.ly
index 761c06334245a0a5f56d90bbd4408aea969b5f3b..9c73e9cde6dfde7cc0d3b92181d6597c1fa7b3cb 100644 (file)
@@ -1,6 +1,6 @@
 %% Do not edit this file; it is auto-generated from input/new
 %% This file is in the public domain.
-\version "2.11.66"
+\version "2.12.0"
 
 \header {
   lsrtags = "editorial-annotations, vocal-music"
@@ -8,9 +8,7 @@
   texidoc = "
 This example shows how to put crosses on stems. Mark the beginning
 of a spoken section with the @code{\\speakOn} keyword, and end it
-with the @code{\\speakOff} keyword.  Remember to end cross sections
-before entering any rest: this function also adds crosses to the
-invisible stems of rests.
+with the @code{\\speakOff} keyword.
 "
   doctitle = "Marking notes of spoken parts with a cross on the stem"
 } % begin verbatim
@@ -18,14 +16,18 @@ invisible stems of rests.
 
 speakOn = {
   \override Stem #'stencil = #(lambda (grob)
-  (ly:stencil-combine-at-edge
-    (ly:stem::print grob)
-    Y
-    (- (ly:grob-property grob 'direction))
-    (grob-interpret-markup grob
-      (markup #:hspace -1.025 #:fontsize -4
-        #:musicglyph "noteheads.s2cross"))
-    -2.3 0))
+    (let* ((x-parent (ly:grob-parent grob X))
+           (is-rest? (ly:grob? (ly:grob-object x-parent 'rest))))
+      (if is-rest?
+        empty-stencil
+        (ly:stencil-combine-at-edge
+          (ly:stem::print grob)
+          Y
+          (- (ly:grob-property grob 'direction))
+          (grob-interpret-markup grob
+            (markup #:hspace -1.025 #:fontsize -4
+              #:musicglyph "noteheads.s2cross"))
+          -2.3 0))))
 }
 
 speakOff = {