lilypond-user
[Top][All Lists]
Advanced

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

Re: Tweaking notehead direction in chords


From: Paul Morris
Subject: Re: Tweaking notehead direction in chords
Date: Wed, 12 Dec 2012 19:39:57 -0500

On Dec 12, 2012, at 7:24 PM, Thomas Morley <address@hidden> wrote:

> Hi Paul,
> 
> I had a look at the LSR-snippet
> http://lsr.dsi.unimi.it/LSR/Item?id=861
> 
> It's no problem to make it work with 2.14.2 just adding a $-sign
> before offsets in the music-function.
> 
> But you will have noticed that after applying the function an
> additional override for 'stem-attachment is necessary in many cases.
> You should show how to do this. At least for some examples.
> 
> In general I'd prefer to have a more automated way for offsetting the 
> NoteHeads.
> The hardcoded value of 1.251178 will change for different NoteHeads and 
> styles.
> 
> I'll continue to think about it. ;)
> 
> 
> Regards,
>  Harm


Hi Harm,

Thanks for taking a look at it and for the tip on using a $-sign for 2.14.2.  I 
was also thinking about the best way to correct the 'stem-attachment values.  
It would be nice if that could be automatic.

I had emailed David Nalesnik to ask about posting his code to the LSR, and he 
also had the concern about the hard-coded 1.251178.  He sent me the following 
which automatically calculates the offset amount based on the width of the 
NoteHead, so I will update the snippet with this revision.

#(define ((shift offsets) grob)
(let* ((note-heads (ly:grob-array->list (ly:grob-object grob 'note-heads)))
       (stem (ly:grob-object grob 'stem))
       (stem-ext (ly:grob-property stem 'X-extent)))
  (for-each
    (lambda (p q)
      (let ((head-ext (interval-length (ly:grob-property p 'X-extent))))
        (ly:grob-translate-axis! p (* q (- head-ext (cdr stem-ext))) X)))
    note-heads offsets)))

displaceHeads =
#(define-music-function (parser location offsets) (list?)
#{
  \once \override NoteColumn #'before-line-breaking = #(shift offsets)
#}
)

Regards,
-Paul


reply via email to

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