lilypond-user
[Top][All Lists]
Advanced

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

Re: Splayed stems


From: address@hidden
Subject: Re: Splayed stems
Date: Tue, 20 Dec 2011 08:57:32 +0100

On Dec 20, 2011, at 12:21 AM, Keith OHara wrote:

> Caio Barros <caio.barros <at> gmail.com> writes:
>>> We have a snippet http://lsr.dsi.unimi.it/LSR/Item?id=505
>> Thanks. It is close indeed.
> 
> You might want to omit the extra splayed stem.  The chord is
> still ugly, but draws less attention to its ugliness.
> 
> \relative g''' { < ges! g! \tweak #'X-offset #1.2 a>4 e d c }
> 


w00t !

#(define note-head-shift 2)

#(define (positioning-done grob)
  (let ((nh (ly:grob-array->list (ly:grob-object grob 'note-heads))))
    (for-each
      (lambda (x y)
      (ly:grob-translate-axis! x (* note-head-shift y) X))
      nh (iota (length nh))))
  0.0)

#(define (stencil grob)
 (let*
   ((pc (ly:grob-parent (ly:grob-parent grob X) X))
    (dir (ly:grob-property grob 'direction))
    (half-space (* 0.5 (ly:staff-symbol-staff-space grob)))
    (y1 (* half-space (ly:stem::calc-stem-begin-position grob)))
    (y2 (* half-space (ly:stem::calc-stem-end-position grob)))
    (nh (ly:grob-array->list (ly:grob-object grob 'note-heads)))
    (x (ly:grob-relative-coordinate (car nh) pc X))
    (thick (* (ly:grob-property grob 'thickness)
              (ly:staff-symbol-line-thickness grob))))
    (apply
      ly:stencil-add
      (map (lambda (nh)
             (let ((my-x (car (ly:grob-extent nh pc X))))
               (make-line-stencil thick x y2 my-x y1)))
           nh))))

\relative c' {
  \override Stem #'positioning-done = #positioning-done
  \override Stem #'stencil = #stencil
  <d d d> <d d d d d> <d d d> <d d d d d d d>
}

\relative c'' {
  \override Stem #'positioning-done = #positioning-done
  \override Stem #'stencil = #stencil
  <d d d> <d d d d d> <d d d> <d d d d d d d>
}

Cheers,
MS



reply via email to

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