lilypond-user
[Top][All Lists]
Advanced

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

Re: Set a property in before-line-breaking


From: Urs Liska
Subject: Re: Set a property in before-line-breaking
Date: Tue, 4 Apr 2017 16:58:08 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0


Am 04.04.2017 um 13:48 schrieb Urs Liska:
> Hi,
>
> one more time a question about the order of operations.
>
> In the following MWE I use ly:grob-set-property! in the
> before-line-breaking callback to set the X-offset property of the
> NoteHead's parent NoteColumn.
>
> This has the expected effect and visually offsets the note column
> accordingly, but when I read out the property with ly:grob-property in
> the after-line-breaking callback (the stencil callback that I actually
> use behaves the same) it returns '(), i.e. "unset".
>
>
> \version "2.19.54"
>
> {
>   \override NoteHead.before-line-breaking =
>   #(lambda (nh)
>      (let ((nc (ly:grob-parent nh Y)))
>        (ly:grob-set-property! nc 'X-offset 4)))
>   \override NoteHead.after-line-breaking =
>   #(lambda (nh)
>      (let ((nc (ly:grob-parent nh Y)))
>        (ly:message "offset : ~a" (ly:grob-property nc 'X-offset))))
>   c'1
> }
>  
> I'm somewhat confused that at the later point in time the property
> seemingly isn't present although it obviously does what I expect it to do.
>
> The background is: I need to offset the note column to make space for an
> object left to it. As I can't do that automatically I want to write out
> a message telling the user to what value he has to set the x offset.
> This setting of the x offset happens during before-line-breaking, they
> can't use \override in the input files. With the behaviour as I see it I
> can only say "please add N to your current X-offset" (instead of "set
> X-offset to M").
>
> Any explanations or suggestions?
>
> TIA
> Urs
>

Just for the record: I've found a workaround by saving the offset in the
before-line-breaking function, so I can add that value later to report
the correct data. But it's still confusing ...

Urs

-- 
address@hidden
https://openlilylib.org
http://lilypondblog.org




reply via email to

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