Hi all,
See herewith the structure I'd like to achieve.
Ideally, I'd like the startBar to be dashed.
This coding:
http://lilypond.1069038.n5.nabble.com/dashed-initial-barline-with-SystemStartBar-td51231.html
works great until I add \RemoveEmptyStaves which gives an error.
Any idea?
TIA, cheers,
Pierre
\version "2.19.84"

#(define (make-round-filled-box x1 x2 y1 y2 blot-diameter)
  (ly:make-stencil (list 'round-filled-box (- x1) x2 (- y1) y2 blot-diameter)
                   (cons x1 x2)
                   (cons y1 y2)))

#(define-public (make-dashed-system-start-bar grob extent thickness)
   (let* ((blot (ly:output-def-lookup (ly:grob-layout grob) 'blot-diameter))
         (line-thickness (ly:staff-symbol-line-thickness grob))
         (staff-space (ly:staff-symbol-staff-space grob))
         (height (interval-length extent))
         (gap (ly:grob-property grob 'gap 0.5))
         (dash-size (- 1.0 gap))
         ;(num (ceiling (/ (* 1.5 height) (+ dash-size staff-space))))
         (num (ceiling height))
         (factors
           (map
             (lambda (x) (* x dash-size))
             (iota (* 2 (- num 2)))))
         (scaling (/ (- (+ height line-thickness) (* 3.0 dash-size))
                     (car (reverse factors))))
         (stencil
           (ly:stencil-add
             (ly:stencil-translate-axis
               (make-round-filled-box 0 thickness
                                      (/ dash-size -2) 0 blot)
               (+ (interval-end extent)(* 0.5 line-thickness))
               Y)
             (ly:stencil-translate-axis
               (make-round-filled-box 0 thickness 0
                                      (/ dash-size 2) blot)
               (- (interval-start extent) (* 0.5 line-thickness))
               Y))))
    (define (helper args)
      (set! stencil
            (ly:stencil-add
              stencil
              (ly:stencil-translate-axis
                (make-round-filled-box 0 thickness
                                       (car args) (cadr args) blot)
                (+ (* 1.5 dash-size) (- (interval-start extent) (* 0.5 line-thickness)))
                Y)))
      (if (null? (cddr args))
          stencil
          (helper (cddr args))))
    (set! factors (map (lambda (x) (* scaling x)) factors))
    (if (zero? num)
        empty-stencil
        (helper factors))))


dashedStart = \override Score.SystemStartBar.stencil =
 #(lambda (grob)
   (let*((stencil (ly:system-start-delimiter::print grob))
       (stencil-y-extent (ly:stencil-extent stencil Y))
       (line-thickness (ly:staff-symbol-line-thickness grob))
       (new-stencil-extent (interval-widen stencil-y-extent (* -0.5 line-thickness)))
       (thickness (ly:grob-property grob 'thickness))
       (grob-thickness (* line-thickness thickness)))
       (make-dashed-system-start-bar grob new-stencil-extent grob-thickness)))
 
 
 \score {
   << 
     \new Staff { \repeat volta 2 { \repeat unfold 5 { 1 \break } 1 } 1\bar "|." }
     \new Staff { \repeat unfold 3 c'1 s1*4 }
   >>
   \layout {
     %\daschedStart %% <= uncomment here gives error
     \context {
      \Staff
      \RemoveEmptyStaves
    }
   }
 }

Attachment: dashed_pps.pdf
Description: Adobe PDF document

Reply via email to