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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#(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 
}

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to