From: David Kastrup Date: Wed, 26 Sep 2012 13:06:56 +0000 (+0200) Subject: Issue 2859: Provide \hide and \omit functions for transparent and void glyphs X-Git-Tag: release/2.17.4-1~8 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=44240869b4d78df01ce4751fe7aae4b8d4e9d947;p=lilypond.git Issue 2859: Provide \hide and \omit functions for transparent and void glyphs 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 } { g' } --- diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index 26db17c5ed..801bde42b1 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -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}.")