[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unexpected behaviour of script-stencil-hack
From: |
Thomas Morley |
Subject: |
Re: Unexpected behaviour of script-stencil-hack |
Date: |
Wed, 15 Oct 2014 01:15:14 +0200 |
Hi David,
2014-10-15 0:54 GMT+02:00 David Nalesnik <address@hidden>:
> Hi Harm,
>
> On Tue, Oct 14, 2014 at 5:38 PM, Thomas Morley <address@hidden>
> wrote:
>>
>> Hi folks,
>>
>> consider the following code.
>>
>>
>>
>> \version "2.19.13"
>> %\version "2.16.0"
>>
>> add-to-script =
>> #(define-event-function (parser location mrkp music)(markup? ly:music?)
>> #{
>> \tweak #'stencil
>> #(lambda (grob)
>> (let (
>> ;(X-offset (ly:grob-property grob 'X-offset))
>> )
>> (ly:stencil-combine-at-edge
>> (ly:script-interface::print grob)
>> X
>> RIGHT
>> (grob-interpret-markup grob (markup #:normal-text mrkp))
>> 0)))
>> $music
>> #})
>>
>> { c''1 \add-to-script \markup "xxxxxxxxxxxxx" \trill }
>>
>>
>>
>> Hacking Script 'stencil I add markup to the default-stencil. Works as
>> expected.
>>
>> Though, regard the local binding for X-offset.
>> With 2.19.13:
>> Commenting it will center the whole new Script-stencil above the parent.
>> Uncomment it and you see the default Script-glyph in unchanged
>> position and the additions right to it.
>>
>> That's unexpected, at least for me and doesn't happen with 2.16 (don't
>> have 2.18 on this machine)
>>
>> Why does this happen? X-offset is _never_ called in the body!
>> Shouldn't be the new stencil always be centered, because self-alignment-X
>> is 0?
>> I would expect a different alignment only, if I change the values for
>> X-offset and/or self-alignment-X myself.
>
>
> The function ly:grob-property evaluates callbacks.
Partly understood.
Yes, I do want the data.
Though why does it makes a difference?
Seems there _is_ a difference, I don't fully understand, between
getting the calculated data (via ly:grob-property-data as you describe
below) and evaluating the callback.
And why it does not happen with 2.16?
> If you define X-offset
> using ly:grob-property-data you'll see no change.
Thanks for the hint!
I'll need to dig in deeper ...
>
> I actually have a patch to add to the docstring of ly:grob-property
> something about this. I was wondering--too obscure? No, I don't think so!
+1
> This used to cause me no end of trouble with Y-offset callbacks.
The code above is the boiled down tiny version of
http://lists.gnu.org/archive/html/lilypond-user/2014-10/msg00400.html
The alignment has driven me crazy for several hours ...
>
> Best,
> David
Thanks,
Harm