On 17/04/12 00:58, [email protected] wrote:
Hello Everyone,
I would like to add a custom grob to my list of available bar lines. I am
currently doing the following to create custom bar lines.
%Define the new stencil
repeatLeftStencil =
#(ly:make-stencil
`(path 0.5
`(rmoveto 0 -2
rlineto 0 4
rlineto 1 2
rmoveto -1 -6
rlineto 1 -2
))
(cons -0.5 2)
(cons -4 4))
%assign the stencil to a variable
repeatLeft = { \once \override Staff.BarLine #'stencil = \repeatLeftStencil }
So then when I want to use the custom grob I just insert \repeatLeft
before the \bar "|" and it overrides the default barline.
What I would prefer to do would be to define the shorthand \bar "|\" (or
something like that) to call my custom grob instead of having to override
it each time I want to use it.
Could anyone direct me to documentation on how I would go about adding my
custom grob to the list of available barline types?
Here's scheme code (can't remember who I got it from) for creating a
dashed double bar line - I needed it for a Fine occurring in the middle
of a measure:
\version "2.15.32"
barDoubled = #(define-music-function (parser location glyph) (string?)
(define (bar-gap-bar grob)
(let* (
(layout (ly:grob-layout grob))
(weight (ly:output-def-lookup layout 'line-thickness 0.1))
(raw-gap (ly:grob-property grob 'thin-kern))
(gap (* raw-gap weight))
)
(ly:stencil-combine-at-edge (ly:bar-line::print grob)
X RIGHT (ly:bar-line::print grob) gap)))
#{
\bar $glyph
\once \override Score.BarLine #'stencil = $bar-gap-bar
#}
)
\relative c' {
\once \override Score.RehearsalMark #'break-visibility =
#begin-of-line-visible
\mark\markup\normalsize { \musicglyph #"scripts.segno" }
\override Score.RehearsalMark #'self-alignment-X = #RIGHT
c4 c c c
c c \barDoubled "dashed" \mark\markup\normalsize { Fine } c c
c c c c
c c c c
\mark\markup\normalsize { D.S. al Fine }
\bar "|."
}
Nick
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user