lilypond-user
[Top][All Lists]
Advanced

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

Re: VoltaBracket end line missing - Was: invisible barlines


From: Mats Bengtsson
Subject: Re: VoltaBracket end line missing - Was: invisible barlines
Date: Tue, 22 Jan 2008 10:17:53 +0100
User-agent: Thunderbird 2.0.0.5 (X11/20070716)

Unfortunately, the list of bar line types that gives a vertical ending of the volta bracket is hard coded in the implementation and, even worse, it checked
the bar line type before it has gone through the calc-glyph-name function.
Fortunately, the latter problem was trivial to fix, so your code should work
as you expect it in the next version, 2.11.38.

   /Mats

Risto Vääräniemi wrote:
Hi,

On Jan 17, 2008 3:30 PM, Mats Bengtsson wrote:
Below, you can find a complicated alternative solution that adds a new
bar type with this behaviour, so you could say \bar "e|:".

Thanks for the tip, Mats.

I was experimenting with custom bar lines based on Mats' example. The
piece I'm working on has two alternate endings, one for a cappella
performance and the other when there's an orchestra. The a cappella
ending is presented first and it ends with an \bar "|.". The orchestra
ending starts on the next line / system and it begins with a \bar
"||". Therefore I created a special bar line: \bar "|.||" with
#(define my-bar-glyph-alist'( stuff removed ("|.||" . ("|." . "||"))
stuff removed )).
So far so good.

The problem arises with the volta bracket I'm using for marking the
endings. If I use the special bar line the first volta bracket doesn't
have the vertical end line. With a standard \bar "|." I get it. I
guess there's no way to get it without digging deep into LP's source
code. Is there?

Possible feature request:
If a volta bracket ends at a custom bar line, which has either "|." or
":|" as the first symbol the ending vertical line should be printed.

One more thing... If I use my custom bar line and don't enter a line /
system break the bar line disappears completely.

-Risto

%%%%%%% Start code %%%%%%%%
\version "2.11.37"

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

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

#(define (index-cell cell dir)
 (if (equal? dir 1)
     (cdr cell)
     (car cell)))

#(define (bar-line::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))

#(define-public (bar-line::my-calc-break-visibility grob)
 (let* ((glyph (ly:grob-property grob 'glyph))
        (result (assoc glyph my-bar-glyph-alist)))
   (if result
       (vector (string? (cadr result)) #t (string? (cddr result)))
       #(#f #f #f))))

\paper
{
    ragged-right = ##t
    indent = #(* mm 0)
}
{
    \override Score.VoltaBracket #'font-encoding = #'latin1
    \override Score.VoltaBracket #'font-family = #'roman
    \override Score.VoltaBracket #'font-series = #'bold

    c'1
        \set Score.repeatCommands = #'((volta "a capp." ))
    c'  \bar "|.||" \break
        \set Score.repeatCommands = #'((volta #f))
        \set Score.repeatCommands = #'((volta "with orchestra" ))
    c' c'
        \set Score.repeatCommands = #'((volta #f))
    \bar "|."
}

\layout
{
    \context
    {
        \Score
            \override BarLine #'glyph-name =
                #bar-line::my-calc-glyph-name
            \override BarLine #'break-visibility =
                #bar-line::my-calc-break-visibility
    }
}
%%%%%%%%%% END %%%%%%%%%%
------------------------------------------------------------------------


--
=============================================
        Mats Bengtsson
        Signal Processing
        Signals, Sensors and Systems
        Royal Institute of Technology
        SE-100 44  STOCKHOLM
        Sweden
        Phone: (+46) 8 790 8463                         
       Fax:   (+46) 8 790 7260
        Email: address@hidden
        WWW: http://www.s3.kth.se/~mabe
=============================================





reply via email to

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