lilypond-user
[Top][All Lists]
Advanced

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

Re: Extending the width of a glissando


From: Jean Abou Samra
Subject: Re: Extending the width of a glissando
Date: Mon, 20 Sep 2021 20:27:56 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0



Le 20/09/2021 à 15:36, Lukas-Fabian Moser a écrit :

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
          (ly:stencil-add
           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\!

  \once \showReferencePoint NoteHead
  a4\< d'4\!

  \bar "||"

  \showReferencePoint NoteHead
  \showReferencePoint DynamicText
  c'1\f
  \once \override DynamicText.X-offset = 0
  % Now the reference point of the "f" is aligned with the reference point
  % of the notehead.
  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?


That is also my understanding. The rotation property works on a stencil
using its own extents, performing the equivalent of ly:stencil-rotate,
not ly:stencil-rotate-absolute. After that, LilyPond places the stencil
using the newly created extents. The placement on the staff can depend
or not on these extents, e.g. that of a Clef won't but that of a Hairpin
will.

The term “reference point” is a bit ambiguous. LilyPond places every
object relative to its parents, displacing it by X-offset and Y-offset.
If you are writing an [XY]-offset callback, you might think of the
reference point as being the point where the object would be placed
if its X-offset and Y-offset were 0. On top of that, the object is
drawn using a stencil, which carries its own extents. If you are writing
a stencil callback, you can think of the reference point as being
the point where a point stencil (having extents '(0 . 0) and '(0 . 0))
would be placed, i.e. taking X-offset and Y-offset into account
this time. It is the latter notion that applies here.

Best,
Jean




reply via email to

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