- (let ((stem (ly:stem::print grob)))
-
- ;; is the note a (dotted) half note?
- (if (= 1 (ly:grob-property grob 'duration-log))
- ;; yes -> draw double stem
- (ly:stencil-combine-at-edge stem X RIGHT stem 0.5)
- ;; no -> draw simple stem
- stem)))
+ (let ((stem-stencil (ly:stem::print grob)))
+ ;; does the stem exist and is it on a (dotted) half note?
+ (if (and (ly:stencil? stem-stencil)
+ (= 1 (ly:grob-property grob 'duration-log)))
+
+ ;; yes -> draw double stem
+ (let* ((separation (ly:grob-property grob 'double-stem-separation 0.5))
+ (half-separation (/ separation 2)))
+ (ly:stencil-add
+ (ly:stencil-translate-axis stem-stencil (- half-separation) X)
+ (ly:stencil-translate-axis stem-stencil half-separation X)))
+ ;; no -> draw simple stem (or none at all)
+ stem-stencil)))