[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
circle around stem
From: |
Orm Finnendahl |
Subject: |
circle around stem |
Date: |
Fri, 8 Jul 2022 16:22:22 +0200 |
Hi,
trying to define an overwrite to draw a circle around a stem I came
up with the code below. Unfortunately it doesn't automagically work
for all use cases as can be seen in the attached image: The code
doesn't take the number of flags into account. I know that the stem
length can be altered with a tweak, but I'd prefer this to be
corrected without manual intervention. Is there a way within the
damp-stem function to force a minimum stem-length depending on the
number of flags if notes aren't beamed?
--
Orm
8<-----------------------------------------------------------------------
#(define (damp-stem grob)
(if (ly:stencil? (ly:stem::print grob))
(let* ((stencil (ly:stem::print grob))
(X-ext (ly:stencil-extent stencil X))
(Y-ext (ly:stencil-extent stencil Y))
(dir (ly:grob-property grob 'direction))
(width (interval-length X-ext))
(len (interval-length Y-ext))
(y-offs (if (= dir 1) 1.29 (- len 1.29))))
(ly:stencil-translate
(grob-interpret-markup grob
(markup
(#:path width
(list (list 'moveto -0 0)
(list 'lineto -0 len)))
(#:hspace -1.13)
(#:circle
(#:path 0.15
(list
(list 'moveto 0 y-offs))))))
(cons 0 (interval-start Y-ext))))
#f))
damp = { \once \override Stem.stencil = #damp-stem }
{\autoBeamOff
\override Stem.stencil = #damp-stem c'4 c'8 c'16 c'32 c'64 s32 c''4 c''8 c''16
c''32 c''64 }
8<-----------------------------------------------------------------------
damp.png
Description: PNG image
- circle around stem,
Orm Finnendahl <=