lilypond-user
[Top][All Lists]
Advanced

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

Re: More about stencil


From: Aaron Hill
Subject: Re: More about stencil
Date: Sun, 13 Feb 2022 13:49:52 -0800

On 2022-02-13 11:43 am, Rip _Mus wrote:
Hello everyone,
thanks to your many suggestions, I was able to get a little into the
perspective of modifying the stencils.
I created a stencil modification that adds a small arrow (sort of a
glissando) to the left of the note or accident.
However, I cannot understand why the ascending arrows let the stem no
longer attached to the notehead. Do you have any ideas?

Modifying the NoteHead stencil as you are doing changes its extents, thus affects the attachment point. One option is to add the arrow to the final stencil but preserve the original extents:

%%%%
  (ly:stencil-outline
    (ly:stencil-combine-at-edge arr X RIGHT note 0)
    note)
%%%%

(The above approach might result in collisions.)

Another option would be to utilize Fingering as a host grob, as that already handles alignment with notes whether or not accidentals are present:

(Below also I show an alternate method for defining the arrows, so that a shared symbol is simply rotated. Custom extents are specified so that the arrows align as desired.)

%%%%
double-right-arrow =
#(ly:stencil-add
  (make-line-stencil 0.1 -0.9 0.1 -0.1 0.1)
  (make-line-stencil 0.1 -0.9 -0.1 -0.1 -0.1)
  (make-line-stencil 0.15 -0.3 0.3 0 0)
  (make-line-stencil 0.15 -0.3 -0.3 0 0))

glis-su-arrow =
#(ly:make-stencil
  (ly:stencil-expr
   (ly:stencil-rotate double-right-arrow 45 RIGHT CENTER))
  '(-0.7 . -0.2) '(-0.3 . 0.7))

glis-giu-arrow =
#(ly:make-stencil
  (ly:stencil-expr
   (ly:stencil-rotate double-right-arrow -45 RIGHT CENTER))
  '(-0.7 . -0.2) '(-0.7 . 0.3))

glis-giu =
#(define-music-function
  (note) (ly:music?)
  (ly:music-set-property! note 'articulations
   (cons
    (make-music 'FingeringEvent 'digit 1
     'tweaks (list (cons (quote stencil) glis-giu-arrow)))
    (ly:music-property note 'articulations '())))
  #{ \once \set fingeringOrientations = #'(left)
     #(make-event-chord (list note)) #})

glis-su =
#(define-music-function
  (note) (ly:music?)
  (ly:music-set-property! note 'articulations
   (cons
    (make-music 'FingeringEvent 'digit 1
     'tweaks (list (cons (quote stencil) glis-su-arrow)))
    (ly:music-property note 'articulations '())))
  #{ \once \set fingeringOrientations = #'(left)
     #(make-event-chord (list note)) #})

\new Staff {
  \relative c' {
    \once \override Score.FootnoteItem.annotation-line = ##f
\footnote "*" #'(-0.2 . -1) "* glissando at the end of previous note" NoteHead
    \stemDown \glis-giu f2 \glis-su b |
    \glis-giu fis4 \glis-su bes2.
    \glis-giu c32 \glis-su c c c c c c c
    \glis-giu c \stemUp \glis-giu c
  }
}
%%%%

Since Fingerings must be inside a chord (i.e. <>) construct in order to respect fingeringOrientations, the music functions above have to do some manipulation of the argument. Depending on how you intend on using these arrows in context, it might be worth the time to invent a custom grob instead rather than cannibalize something built-in.


-- Aaron Hill



reply via email to

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