2012/7/21 Thomas Morley <thomasmorle...@googlemail.com>:
> 2012/7/21 Keith OHara <k-ohara5...@oco.net>:
>> On Fri, 20 Jul 2012 15:25:53 -0700, Thomas Morley
>> <thomasmorle...@googlemail.com> wrote:
>>
>>>
>>> thanks for all your hints.
>>> I'm coming up now with the code below.
>>>
>>
>> I see, car and cdr extract pointers to the nodes of a tuple.  So to me it
>> looks like your data flow was not quite right.  You want the new
>> stem-attachment to be proportional to the old, so multiply by the elements
>> of the old stem-attachment, x with x, and y with y.
>>
>>
>> restoreStemAttachment =
>> \override NoteHead #'stencil =
>>   #(lambda (grob)
>>     (let* ((stencil (ly:note-head::print grob))
>>            (new-stil (grob-interpret-markup grob (markup #:box #:stencil
>> stencil)))
>>            (stem-attach (ly:grob-property grob 'stem-attachment))
>>
>>            (x-length-stil (interval-length (ly:stencil-extent stencil X)))
>>            (x-length-new-stil (interval-length (ly:stencil-extent new-stil
>> X)))
>>            (x-coord (* (car stem-attach) (/ x-length-stil
>> x-length-new-stil)))
>>
>>
>>            (y-length-stil (interval-length (ly:stencil-extent stencil Y)))
>>            (y-length-new-stil (interval-length (ly:stencil-extent new-stil
>> Y)))
>>            (y-coord (* (cdr stem-attach) (/ y-length-stil
>> y-length-new-stil))))
>>
>>
>>   (ly:grob-set-property! grob 'stem-attachment (cons x-coord y-coord))
>> new-stil))
>>
>
> Works like a charm.
>
> Thanks a lot,
>   Harm

Same mail again. Forgot to answer all,

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

Reply via email to