On 4 March 2010 18:39, Caio Barros <[email protected]> wrote:
> Ok, the grid lines seems to align with the NoteHeads, but how do I draw them
> dashed?

There's currently no support for dashed lines, but it's possible to
force grid lines to use a dashed barline via a custom print callback:

#(define-public (grid-line-dashed grob)
   (let ((elts (ly:grob-object grob 'elements)))

     (if (ly:grob-array? elts)
         (let ((common (ly:grob-common-refpoint-of-array grob elts Y))
               (iv empty-interval))

           (for-each (lambda (idx)
                       (let ((point (ly:grob-array-ref elts idx)))
                         (set! iv
                               (interval-union
                                iv (ly:grob-extent point common Y)))))
                     (iota (ly:grob-array-length elts)))

           (if (interval-sane? iv)
               (let ((thick (* (ly:grob-property grob 'thickness 1)
                               (ly:staff-symbol-line-thickness grob))))

                 (set! iv (interval-translate
                           iv (- (ly:grob-relative-coordinate grob common Y))))
                 (set! (ly:grob-property grob 'bar-size) (interval-length iv))
                 (set! (ly:grob-property grob 'glyph-name) "dashed")
                 (ly:stencil-translate-axis
                  (ly:bar-line::print grob)
                  (- (+ (interval-length iv)
                        (/ (ly:staff-symbol-staff-space grob) 2)))
                  Y))
               empty-stencil))
         (begin
           (ly:grob-suicide! grob)
           '()))))

\layout {
  \context {
    \Voice
    \consists "Grid_point_engraver"
    gridInterval = #(ly:make-moment 1 4)

  }
  \context {
    \Score
    \consists "Grid_line_span_engraver"
    \override GridLine #'stencil = #grid-line-dashed
  }
}

\score {
  \new ChoirStaff <<
    \new Staff \relative c'' {
      \stemUp
      c4. d8 e8 f g4
    }
    \new Staff \relative c {
      \clef bass
      \stemDown
      c4 g' f e
    }
  >>
}

Regards,
Neil


_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to