Very instructive discussion.
So I feel sorry to come back to some poor basic questions...
And back again to these new glyphs :
\version "2.19.16"
%#(set-global-staff-size 25)
#(define-markup-command (flip layout props arg) (markup?)
(interpret-markup layout props
(markup #:concat (#:null #:scale (cons -1 1) #:line (arg)))))
newStilRightDown = \markup {
\override #'(filled . #t)
\path #0.01 #'(
(moveto 0.00 -0.50)
(curveto 0.00 -0.10 0.00 0.50 0.60 0.50)
(curveto 1.56 0.50 1.62 -0.50 1.00 -0.50)
(curveto 0.56 -0.50 0.58 -0.19 0.70 0.00)
(curveto 0.78 0.13 0.80 0.45 0.50 0.45)
(curveto 0.06 0.45 0.08 -0.13 0.08 -0.50)
(closepath))
}
newStilLeftDown = \markup\flip\concat { \hspace #-.04 \newStilRightDown }
newStilLeftUp = \markup\rotate #180 \newStilRightDown
newStilRightUp = \markup\flip\concat { \newStilLeftUp \hspace #-.04 }
#(define alt-notehead
(lambda (grob)
(let ((stem (ly:grob-object grob 'stem)))
(if (ly:grob? stem) ;; perhaps unnecessary, but let's be safe
(if (eq? (ly:grob-property stem 'direction) DOWN)
(grob-interpret-markup grob newStilRightDown)
(grob-interpret-markup grob newStilLeftUp))))))
#(define new-alt-notehead
(lambda (grob)
(let ((stem (ly:grob-object grob 'stem)))
(if (ly:grob? stem) ;; perhaps unnecessary, but let's be safe
(if (eq? (ly:grob-property stem 'direction) DOWN)
;;; Nonsense here:
(let ((note-heads (ly:grob-object grob 'note-heads)))
(if (eq? (ly:grob-property note-heads 'X-offset) < 0)
(grob-interpret-markup grob newStilLeftDown)
(grob-interpret-markup grob newStilRightDown)))
;;; Nonsense here:
;(if (< 0 (ly:note-head::stem-x-shift))
;(grob-interpret-markup grob newStilLeftUp)
(grob-interpret-markup grob newStilRightUp))))))
{
\override NoteHead.stem-attachment = #'(1 . 0.95)
\override Stem.thickness = #1.0
\override NoteHead.stencil = #alt-notehead
%\override NoteHead.stencil = #new-alt-notehead
<c''
%% wanted flip:
\tweak stencil #(lambda (grob) (grob-interpret-markup grob newStilLeftDown))
d''
e''>
<a'
%% wanted flip:
\tweak stencil #(lambda (grob) (grob-interpret-markup grob newStilRightUp))
g'
f'>
}(I've added some tweaks to show a better output.)
Basically, I need four note heads instead of one: the idea of 'new-alt-notehead' is to determine whether its X-offset is negative or positive in order to chose the right noteHead .
After many too many trials I feel a little lost.
Any idea ?