lilypond-user
[Top][All Lists]

## Re: Extending the width of a glissando

 From: Lukas-Fabian Moser Subject: Re: Extending the width of a glissando Date: Mon, 20 Sep 2021 15:36:31 +0200 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

Hi Peter,

One thing puzzles me about the documentation when it comes to placement - it continually refers to the 'reference point' for an object.  I sort of understand what it means, but it doesn't seem to be defined anywhere. For instance - to rotate a hairpin you have to specify the co-ordinates of the centre of rotation relative to its reference point. But where is the reference point for a hairpin? The start, the middle, the end? (The phrase is also used in other contests, such as octave placement in NR section 1.1.1, to add to the confusion).

If I understand it correctly, the "reference point" of a layout object should be its relative (0,0) coordinate. It is possible to display that point using a small function:

\version "2.23.4"

showReferencePoint =
#(define-music-function (path) (symbol-list?)
#{
\override \$path .stencil =
#(grob-transformer
'stencil
(lambda (grob orig)
(ly:stencil-outline
orig
(stencil-with-color (make-line-stencil 0.2 -0.5 -0.5 0.5 0.5) red)
(stencil-with-color (make-line-stencil 0.2 -0.5 0.5 0.5 -0.5) red))
orig)))
#})

\layout {
\showReferencePoint Score.TimeSignature
\showReferencePoint Score.Clef
}

{
\showReferencePoint Hairpin
a4\< d'4\!

a4\< d'4\!

\bar "||"

\showReferencePoint DynamicText
c'1\f
\once \override DynamicText.X-offset = 0
% Now the reference point of the "f" is aligned with the reference point
c'1\f

\bar "||"
\showReferencePoint Rest
r8
\tweak Y-offset 1 r
}

But I'm a bit wary of the statement in http://lilypond.org/doc/v2.23/Documentation/notation/rotating-objects.html#rotating-layout-objects that the .rotate property uses x/y-coordinates relative to the object's reference point. It rather seems to me (if I read grob.cc and stencil.cc in the source correctly) that the .rotation property uses the same coordinate system as ly:stencil-rotate does, namely

(0,0) = center of object
(-1,-1) = lower left corner
(1,1) = upper right corner.

This also explains the example regarding rotating hairpins: -1 0 is center-left (which also happens to be the reference point of a Hairpin).

(Of course, studying the effect of setting .rotation for a layout object is complicated by the fact that LilyPond's spacing engine might move the object around after rotating.)

Question to the experts: Am I right in thinking that the documentation is misleading here?

Lukas