diff options
author | David Nalesnik <david.nalesnik@gmail.com> | 2012-07-17 17:17:59 -0500 |
---|---|---|
committer | Phil Holmes <mail@philholmes.net> | 2012-07-24 17:52:41 +0100 |
commit | f7085cf9b2ff111b7d30c8a59e367c771a7e3c52 (patch) | |
tree | 02352e0d6253fa04131caea68fb7bf064939f777 /input | |
parent | a229fafa17dfdc0638326fab4368fffcfbf38d2a (diff) |
Function for overriding broken spanners
The music function \alterBroken is intended to facilitate overrides
applied independently to the pieces of broken spanners--one of the
perennial difficulties faced by users of LilyPond (addressed in
Extending 2.6:"Difficult Tweaks"). The function aims at generalization
by allowing the user to specify the name of the spanner and the property
to be overridden.
The function will override unbroken spanners, but it will ignore
non-spanners with a warning.
The function calls \override and may be prefaced by \once (or followed by
a \revert of the relevant property).
Diffstat (limited to 'input')
-rw-r--r-- | input/regression/alter-broken.ly | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/input/regression/alter-broken.ly b/input/regression/alter-broken.ly new file mode 100644 index 0000000000..4f03f4d6e7 --- /dev/null +++ b/input/regression/alter-broken.ly @@ -0,0 +1,45 @@ +\version "2.15.42" + +\header { + texidoc = "The command @code{\\alterBroken} may be used to override the +pieces of a broken spanner independently. The following example demonstrates +its usage with a variety of data types." +} + +\layout { + ragged-right = ##t +} + +#(ly:expect-warning (_ "not a spanner name")) + +\relative c'' { + \alterBroken Slur #'positions #'((3 . 3) (5 . 5)) + \alterBroken Slur #'color #'((0 0 1) (1 0 0)) + \alterBroken Slur #'dash-definition #'( ((0 1 0.4 0.75)) + ((0 0.5 0.4 0.75) (0.5 1 1 1)) ) + d4( d' b g + \break + d d' b g) + \alterBroken "Staff.OttavaBracket" #'padding #'(1 3) + % Spaces in spanner's name are disregarded. + \alterBroken "Staff . OttavaBracket" #'style #'(line dashed-line) + \ottava #1 + % It is possible to use procedures as arguments. + \alterBroken Hairpin #'stencil #`( + ,ly:hairpin::print + ,(lambda (grob) + (ly:stencil-rotate (ly:hairpin::print grob) -5 0 0))) + c\< d e + % Since `NoteHead' is not the name of a spanner, the following has no + % effect on layout. A warning (suppressed here) is issued. + \alterBroken NoteHead #'color #`(,red ,blue) + \alterBroken Tie #'color #`(() ,blue) + \alterBroken Tie #'control-points #'( + ((1 . 3) (2 . 4) (3 . 4) (4 . 3)) + ((3 . 3) (4 . 4) (5 . 4) (6 . 3)) + ) + f~ + \break + f c a f\! + \ottava #0 +} |