lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding Bar Line types


From: Nick Payne
Subject: Re: Adding Bar Line types
Date: Tue, 17 Apr 2012 08:17:10 +1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1

On 17/04/12 00:58, address@hidden 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]