lilypond-user
[Top][All Lists]
Advanced

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

Re: Bar line at beginning of piece


From: ornello
Subject: Re: Bar line at beginning of piece
Date: Fri, 28 Jan 2011 07:45:12 -0800 (PST)

Thanks Graham,


Graham Percival-3 wrote:
> 
> I suggest
>   \partial 64 s64
>   \bar "||"
> and I'm pretty certain it'll work if you put it in all staves.
> 

this leaves an additional space between time signature and bar line which I
wanted to avoid using the grace (which has no duration).

I have now found another solution following an idea described here:
http://lists.gnu.org/archive/html/lilypond-user/2009-04/msg00908.html

It overrides the bar-line::calc-glyph-name in output-lib.scm which is
responsible of removing the "||" bar:

======================

\version "2.12.2"

% cribbed from output-lib.scm version 2.12
#(define my-bar-glyph-alist
  '((":|:" . (":|" . "|:"))
    (":|.|:" . (":|" . "|:"))
    (":|.:" . (":|" . "|:"))
    ("||:" . ("||" . "|:"))
    ("dashed" . ("dashed" . '())) 
    ("|" . ("|" . ()))
    ("||:" . ("||" . "|:"))
    ("|s" . (() . "|"))
    ("|:" . ("|" . "|:"))
    ("|." . ("|." . ()))
    
    ;; hmm... should we end with a bar line here?
    (".|" . ("|" . ".|"))
    (":|" . (":|" . ()))
    ;;    ("||" . ("||" . ()))
    ("||" . ("||" . "||")) ;; allow || at beginning of line
    (".|." . (".|." . ()))
    ("|.|" . ("|.|" . ()))
    ("" . ("" . ""))
    (":" . (":" . ""))
    ("." . ("." . ()))
    ("'" . ("'" . ()))
    ("empty" . (() . ()))
    ("brace" . (() . "brace"))
    ("bracket" . (() . "bracket")) 
    ))
    
#(define (index-cell cell dir)
  (if (equal? dir 1) (cdr cell) (car cell)))
    
#(define (my-calc-glyph-name grob)
  (let* (
    (glyph (ly:grob-property grob 'glyph))
    (dir (ly:item-break-dir grob))
    (result (assoc glyph  my-bar-glyph-alist))
    (glyph-name (if (= dir CENTER)
       glyph
       (if (and result (string? (index-cell (cdr result) dir)))
        (index-cell (cdr result) dir)
        #f))))
   glyph-name))

{
\new Staff \with {
  \override BarLine #'break-visibility = #'#(#t #t #t)
  }
{
\override Staff.BarLine #'glyph-name = #my-calc-glyph-name % apply
\time 4/4
%\grace s
%\partial 128 s128 
\bar "||"
c''4
}
}

======================

It would be really helpful if one could override the behaviour defined in
'bar-glyph-alist' without having to redefine 'calc-glyph-name'.
-- 
View this message in context: 
http://old.nabble.com/Bar-line-at-beginning-of-piece-tp30786694p30788162.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.




reply via email to

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