[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lilypond-user
Subject:    Re: Bar lines at beginning of a line
From:       "Robin Bannister" <rcb () dataway ! ch>
Date:       2009-04-28 16:28:00
Message-ID: EEDADD12A9814794B632E593DA859E5F () pchai
[Download RAW message or body]

Boris Lau wrote: 
> I thought it would be quite natural if this would do the job:
> \override Staff.BarLine #'break-visibility = #'#(#t #t #t)
> but it doesn't. 

Certainly a reasonable expectation.  
This is normally #'#(#t #t #f), but there are cases when Lilypond 
switches over to #'#(#t #t #t) automatically, as when a 
\repeat volta follows a \break.  
This ensures that the repeat's "|:"  gets printed on the left.

But convention doesn't want regular barlines on the left, and
Lilypond provides them with a sort of aptosis; they are automatically 
zapped before they even reach the break-visibility filter. 


A simple method would be to make the stencil ignore all that:
     
   #(define (always-single-print grob) 
     (set! (ly:grob-property grob 'glyph-name) "|")
     (ly:bar-line::print  grob))
and then     
    \override Staff.BarLine #'stencil = #always-single-print
     
But this ignores repeats, etc too, so maybe it's too simple. 
     
     
Another approach for barlines on the left is to banish the aptosis.  
This is what the attached was-empty.ly tries to do. 
It is rather cumbersome and inflexible, 
but at least it leaves the other barline types unharmed.  


Cheers,
Robin
  
  
["was-empty.ly" (text/lilypond-source)]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#(define was-empty "|") 

% cribbed from output-lib.scm version 2.12
#(define my-bar-glyph-alist
  `((":|:" . (":|" . "|:"))
    (":|.|:" . (":|" . "|:"))
    (":|.:" . (":|" . "|:"))
    ("||:" . ("||" . "|:"))
    ("dashed" . ("dashed" . '())) 
    ("|" . ("|" . ,was-empty))
    ("||:" . ("||" . "|:"))
    ("|s" . (() . "|"))
    ("|:" . ("|" . "|:"))
    ("|." . ("|." . ,was-empty))
    
    (".|" . ("|" . ".|"))
    (":|" . (":|" . ,was-empty))
    ("||" . ("||" . ,was-empty))
    (".|." . (".|." . ,was-empty))
    ("|.|" . ("|.|" . ,was-empty))
    ("" . ("" . ""))
    (":" . (":" . ""))
    ("." . ("." . ()))
    ("'" . ("'" . ()))
    ("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))
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    
\version "2.12"

sevenSeas = { c'1 c'1 c'1 c'1 c'1 c'1 c'1 }
  
\new DrumStaff \with {
  \remove Clef_engraver
  drumStyleTable = #percussion-style
  \override StaffSymbol #'line-count = #1
  \override BarLine #'break-visibility = #'#(#t #t #t)
  }
{
  \override Staff.BarLine #'glyph-name = #my-calc-glyph-name % apply
  \override Staff.BarLine #'bar-size = #3
  \override Score.RehearsalMark #'font-size = 1
  
  \sevenSeas \break 
  \sevenSeas \break 
  \sevenSeas \break \time 2/2
  \sevenSeas \break \time 4/4
  \repeat volta 2 \sevenSeas \break \time 2/2
  \repeat volta 2 \sevenSeas \break 
}



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic