lilypond-user
[Top][All Lists]
Advanced

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

Re: automatic \bar "||:"?


From: Neil Puttock
Subject: Re: automatic \bar "||:"?
Date: Sat, 13 Dec 2008 20:27:03 +0000

2008/12/13 Nick Payne <address@hidden>:
> I get the repeat barlines without having to explicitly specify them.

Hehe, I almost posted the same thing, until I realized I'd left out
the \layout block. :)

Mark, there are two options here:

1. amend bar-glyph-alist in output-lib.scm;
2. copy the above and bar-line::calc-glyph-name to a .ly file, and
override 'glyph-name:

#(define my-bar-glyph-alist
  '((":|:" . (":|" . "|:"))
    (":|.|:" . (":|" . "|:"))
    (":|.:" . (":|" . "|:"))
    ("||:" . ("||" . "|:"))
    ("dashed" . ("dashed" . '()))
    ("|" . ("|" . ()))
    ("||:" . ("||" . "|:"))
    ("|s" . (() . "|"))
    ; amended this entry
    ("|:" . ("||" . "|:"))
    ("|." . ("|." . ()))

    ;; hmm... should we end with a bar line here?
    (".|" . ("|" . ".|"))
    (":|" . (":|" . ()))
    ("||" . ("||" . ()))
    (".|." . (".|." . ()))
    ("|.|" . ("|.|" . ()))
    ("" . ("" . ""))
    (":" . (":" . ""))
    ("." . ("." . ()))
    ("empty" . (() . ()))
    ("brace" . (() . "brace"))
    ("bracket" . (() . "bracket"))
    ))

#(define (my-bar-line::calc-glyph-name grob)
   (let* (
          ; inlined this from lily-library.scm, since it isn't public
          (index-cell (lambda (cell dir)
                        (if (equal? dir 1)
                            (cdr cell)
                            (car cell))))
          (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))

{
  \override Staff.BarLine #'glyph-name = #my-bar-line::calc-glyph-name
  b'1 \break
  \repeat volta 2 { b' }
}

Regards,
Neil




reply via email to

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