lilypond-user
[Top][All Lists]
Advanced

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

Re: Overriding bar-line behaviour


From: Matthias Hüsken
Subject: Re: Overriding bar-line behaviour
Date: Thu, 17 Feb 2011 15:29:52 +0100
User-agent: KMail/1.9.10

> > What I'd like to achieve:
> > When ending a bar with the repetition sign ":|",
> > I need double lines ("||") at the beginning of the next bar.
>
> It looks as though you actually mean ending/beginning lines, not bars.

Basically, yes.

> > [...]
> > (":||" . (":|" . "||"))
> > [...]
> > Unfortunately, this does not work:
> > LilyPond leaves the  end of the line [...] empty,
> > as well as the beginning of the next line.
>
> Lilypond's barline.cc doesn't recognise your bartype string ":||"
> and quietly sets the bartype to empty before continuing.
> So unless you extend the C++ hardcoding you are limited
> to the bartypes listed in the bar-line-interface documentation.

Well, I do not think the problem actually lies in the C++ code but in the way 
I tried to override bar-glyph-alist - when I change the code in 
scm/output-lib.scm, it does work... even with \bar ":||".

> If you will be using explicit line breaks like in your snippet I would
> suggest a \once-like approach as in the attached barRightrepeatDouble.ly.

This solution works perfectly, thanks a lot! What I actually use is this code:

barCustom =
#(define-music-function (parser location one two) (string? string?)
#{
    \once \override Score.BarLine #'break-visibility = #all-visible
    \once \override Score.BarLine #'glyph-name = #(lambda(grob)
        (if (not (= (ly:item-break-dir grob) RIGHT)) $one $two))
#})

and then e.g. \barCustom ":|" "||"

There is only one detail that need additional attention: It is not possbile to 
change the bar lines at the beginning of the first line with this method. I 
found the following workaround:

% start first line with repeat
\bar "|:"
% start first line with "thick" double lines
\bar ".|"
% start first line with "thin" double lines
\once \override Score.BarLine #'glyph-name = "||" \bar "|:"


Thanks again for finding a solution!

Matthias




reply via email to

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