lilypond-user
[Top][All Lists]
Advanced

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

Re: Access grob name?


From: Simon Albrecht
Subject: Re: Access grob name?
Date: Thu, 17 Sep 2015 14:49:34 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0

On 17.09.2015 14:20, David Kastrup wrote:
Simon Albrecht <address@hidden> writes:

Hello,

I’ve written a music function which applies some tweaks on dynamics to
offset them. Unfortunately, it’s not possible to use the offset music
function on X-offset, because it is a mutable property.
What does that mean?  Any relation to issue 4516 here?

Obviously. I try to work around the technical limitation that you described in your last comment there.
Sorry for describing a superficial point of view again:
1. I need to tweak Y-offset of e.g. DynamicText.
2. If I use \tweak, the default calculation is _replaced_ by the new value. This makes it unpredictable, because the resulting offset, relative to the position without a tweak, is not equal to the value which I used in tweaking. 3. Thus I’d like to use \offset, so my offset is _added_ to the value returned by the default calculation.

But IIUC, the latter is impossible (? currently?) because the calculation is done only after the \offset could be applied. Is that anywhere near correct?


Thus I have to add a displacement for DynamicText so that it is not
aligned to its baseline, but to the ‘center’ like normally.  Now, it
would help if the music function could find out by itself whether to
apply this displacement, depending on which grob it is applied to. As
an example (attached also): %%%%%%%%%% \version "2.19.27"

test =
#(define-music-function (ev) (ly:music?)
    (tweak 'color red ev))

{
   c''-\test \> g'-\test \f
}
%%%%%%%%%%
How can I modify the function so that only the DynamicText is colored,
the Hairpin isn’t?
Uh, (tweak '(DynamicText color) red ev) maybe?  Seems rather
straightforward.

Oh, of course. My example was too simple then. Let’s say: I want to color all objects red, only DynamicText should be blue :-) Coined on offsets: Both need to be offset, but DynamicText needs an additional displacement.

Yours, Simon



reply via email to

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