lilypond-user
[Top][All Lists]
Advanced

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

Re: Retrieving 'tweaks from a grob


From: David Kastrup
Subject: Re: Retrieving 'tweaks from a grob
Date: Mon, 25 Jul 2016 17:10:39 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Urs Liska <address@hidden> writes:

> Hi all,
>
> in the ScholarLY package we're attaching a (newly defined) property
> 'input-annotation to a grob, either through an implicit \once \override
> or a \tweak, depending on the invocation syntax:
>
> The attached file
>     annotate.ly
> shows both ways, first the override, then the tweak. Today I finally
> realized that the "tweaked" ones are not processed properly, that is,
> while they are attached to the grob they aren't retrieved in the later
> engraver processing.
>
> The output of \displayMusic (attachment display-music) shows the
> different ways the annotations are attached to the grobs:
>
> The first one provides an explicit override, and so 'input-annotation is
> a property of the following note. This can be retrieved with
> ly:grob-property (which works in
> https://github.com/openlilylib/scholarly/blob/master/annotate/engraver.ily#L66).
>
> The second one is the result of an implicit \tweak where it is fond in
> the 'tweaks property of the music expression.
>
> So, my question is: if I'm iterating over the grobs in an engraver's
> acknowledger (as per the link above), how can I first determine if the
> grob('s music) has a 'tweaks property and second retrieve that
> property?

Don't do that.  The acknowledger is the place for _setting_ properties,
and of course a first acknowledger has no chance to see properties set
by a second acknowledger.  Instead, use the acknowledger to _record_ the
grobs.  Then you use the process-acknowledged hook to actually process
them.  This includes looking at properties (like the ones set by the
Tweak_engraver).

> I have been able to retrieve the thing through selecting from a
> ly:grob-alist-chain, but that seems cumbersome and error-prone. There
> must be an easier way. However, ly:music-property which should be the
> way to go here doesn't seem possible because I (think I) can't
> reference the "music" argument here.

You can usually get the event-cause of a grob (which may or may not
exist) and then use ly:event-property from there.

But it seems much saner to just go through the process-acknowledged
route/hook.

> OMG, I have the impression this request is completely uncomprehensible ...

At least your code and example output is completely useless because it
relies on external packages which you do not either quote or reference.

-- 
David Kastrup



reply via email to

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