]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 2859: Provide \hide and \omit functions for transparent and void glyphs
authorDavid Kastrup <dak@gnu.org>
Wed, 26 Sep 2012 13:06:56 +0000 (15:06 +0200)
committerDavid Kastrup <dak@gnu.org>
Fri, 5 Oct 2012 08:47:49 +0000 (10:47 +0200)
Both functions take either a grob name to override, or a music
expression to tweak (that is, the type of the argument decides whether
this results in an override or a tweak).

\hide sets #'transparent for the affected grob to ##t,
\omit sets #'stencil for the affected grob to ##f.

Example uses are
\new Voice \with { \omit StringNumber } { c'\4 }
{ <c' \hide g'~> g' }

ly/music-functions-init.ly

index 26db17c5ede8ce07e9b72f78fa7d05c0f82a7cbf..801bde42b1fc60e6a0a83e62a119f964c9d935af 100644 (file)
@@ -475,6 +475,18 @@ given through @var{ratio}.")
     \revert NoteHead #'stencil
   #})
 
+hide =
+#(define-music-function (parser location item) (string-or-music?)
+   (_i "Set @var{item}'s @samp{transparent} property to @code{#t},
+making it invisible while still retaining its dimensions.
+
+If @var{item} is a string, the result is an override for the grob name
+specified by it.  If @var{item} is a music expression, the result is
+the same music expression with an appropriate tweak applied to it.")
+   (if (string? item)
+       #{ \override $item #'transparent = ##t #}
+       #{ \tweak #'transparent ##t $item #}))
+
 inStaffSegno =
 #(define-music-function (parser location) ()
    (_i "Put the segno variant 'varsegno' at this position into the staff,
@@ -664,6 +676,18 @@ octaveCheck =
    (make-music 'RelativeOctaveCheck
                'pitch pitch))
 
+omit =
+#(define-music-function (parser location item) (string-or-music?)
+   (_i "Set @var{item}'s @samp{stencil} property to @code{#f},
+effectively omitting it without taking up space.
+
+If @var{item} is a string, the result is an override for the grob name
+specified by it.  If @var{item} is a music expression, the result is
+the same music expression with an appropriate tweak applied to it.")
+   (if (string? item)
+       #{ \override $item #'stencil = ##f #}
+       #{ \tweak #'stencil ##f $item #}))
+
 once =
 #(define-music-function (parser location music) (ly:music?)
    (_i "Set @code{once} to @code{#t} on all layout instruction events in @var{music}.")