lilypond-user
[Top][All Lists]
Advanced

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

Re: Unexpected behaviour of script-stencil-hack


From: David Nalesnik
Subject: Re: Unexpected behaviour of script-stencil-hack
Date: Tue, 14 Oct 2014 17:54:41 -0500

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.  If you define X-offset using ly:grob-property-data you'll see no change.

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!  This used to cause me no end of trouble with Y-offset callbacks.

Best,
David 

reply via email to

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