[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Automatic setting custom bar lines
From: |
Thomas Morley |
Subject: |
Re: Automatic setting custom bar lines |
Date: |
Sun, 12 Feb 2012 23:08:57 +0100 |
Hi Hannes,
2012/2/12 Hannes Kuhnert <address@hidden>:
> Is it possible to change the style of the automatic bar lines only?
try:
%%{
\version "2.12.3"
customDefaultBarLine =
\override Staff.BarLine #'stencil =
#(lambda (grob)
(let ((default-bar-glyph? (equal? (ly:grob-property grob 'glyph) "|")))
(if default-bar-glyph?
(begin
(ly:grob-set-property! grob 'bar-size 2)
(ly:grob-set-property! grob 'extra-offset '(0 . 1))
(ly:bar-line::print grob))
(ly:bar-line::print grob))))
\new Voice \relative c'' {
\customDefaultBarLine
c1 \bar "" c1 c c \bar ":|:" \break
c1 c1 \bar "||" c c \bar ":|:" \break
\repeat volta 2 {
c1 c1 c c }
\bar "|."
}
%}
% with "2.14.2" and higher use:
%{
\version "2.14.2"
%\version "2.15.29"
#(define (custom-default-bar grob)
(lambda (grob)
(let ((default-bar-glyph? (equal? (ly:grob-property grob 'glyph) "|")))
(if default-bar-glyph?
(begin
(ly:grob-set-property! grob 'bar-extent '(0 . 2))
(ly:bar-line::print grob))
(ly:bar-line::print grob)))))
customDefaultBarLine = \override Staff.BarLine #'stencil = #custom-default-bar
% You may want to put it in \layout like:
% \layout {
% \context {
% \Staff
% \override BarLine #'stencil = #custom-default-bar
% }
% }
\new Staff \relative c'' {
% If you don't want to put it in \layout use it like:
\customDefaultBarLine
c1 \bar "" c1 c c \bar ":|:" \break
c1 c1 \bar "||" c c \bar ":|:" \break
\repeat volta 2 {
c1 c1 c c \bar ":|:" } \break
c1 \bar ":|S|:" c1 \bar "S" c \bar "|."
}
%}
I added a (commented) version for "2.14.2" and higher.
Feel free to add it to the LSR if you think it's worth to.
HTH,
Harm