Hi,

adding sth to a NoteHead-stencil via stencil-override returns a weird
output with stemmed NoteHeads.

In the code below I added a box around the default-note-head and the
stem is moving away.
Is there any possibility to restore the original 'stem-attachment in
an automated way?

\version "2.15.39"

#(set-global-staff-size 30)

xy =
\override NoteHead #'stencil =
  #(lambda (grob)
    (let* ((stil (ly:note-head::print grob))
           (stil-1 (grob-interpret-markup grob (markup #:box #:stencil stil)))
           (st-pos (ly:grob-property grob 'stem-attachment)))
  ;; This duplicates the default
  (ly:grob-set-property! grob 'stem-attachment (cons (car st-pos) (cdr st-pos)))
  stil-1))

\relative c'' {
        \xy
        \override Stem #'color = #red
        \override Stem #'layer = #-10
        g4
}

In the attached png you can see how it should look in the second line,
tweaked manually.

Cheers,
  Harm

<<attachment: stem-attachment.png>>

_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to