Hi Harm,

On Wed, Dec 12, 2012 at 6:24 PM, Thomas Morley
<thomasmorle...@googlemail.com> wrote:
> 2012/12/11 Paul Morris <p...@paulwmorris.com>:
>> Below is a revised version
> [...]
>
> 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 saw that hardcoded value and wrote the following code which arrives
at 1.251178 (though that value uses only half the stem's extent).
Haven't tried it with other heads/styles.

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

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

Reply via email to