lilypond-user
[Top][All Lists]
Advanced

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

How to restore default-stem-attachment with note-head-stencil-override?


From: Thomas Morley
Subject: How to restore default-stem-attachment with note-head-stencil-override?
Date: Wed, 18 Jul 2012 20:00:59 +0200

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
Description: PNG image


reply via email to

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