[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: change custom notehead for different stem direction
From: |
Lukas-Fabian Moser |
Subject: |
Re: change custom notehead for different stem direction |
Date: |
Wed, 8 Sep 2021 16:49:00 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 |
Hi Orm,
Am 08.09.21 um 13:23 schrieb Orm Finnendahl:
below is a working example for the record. You can tweak the
linewidth changing "setlinewidth 1" in flpizzleft and flpizzright or
the angles/proportions of the lines in the line containing the moveto,
lineto and stroke. Even if you don't know Postscript it should be
fairly obvious. When changing the linewidth you might have to adjust
the connection points for the stems accordingly.
Motivated in part by recent discussions on -devel on whether or not
there's a long-term need for \postscript support, I rewrote your code
without postscript, stream-lining a bit along the way:
\version "2.22.0"
flpizz =
\markup
\with-dimensions #'(0 . 0.9) #'(-0.4 . 0.4)
\path #0.2 #'((moveto 0.9 0.4)
(lineto 0 0)
(lineto 0.9 -0.4))
%{
% Uncomment if \flpizzleft and \flpizzright are both needed e.g. in markups
#(define-markup-command (Xflip layout props arg) (markup?)
"Flips a markup horizontally keeping its extents (absolute positions)"
(let* ((orig (interpret-markup layout props arg))
(extent (ly:stencil-extent orig X)))
(ly:stencil-translate-axis
(ly:stencil-scale orig -1 1)
(+ (car extent) (cdr extent))
X)))
flpizzleft = \flpizz
flpizzright = \markup \Xflip \flpizzleft
%}
flutepizz = \temporary {
\override NoteHead.stencil =
#(lambda (grob)
(let*
((notehead (grob-interpret-markup grob flpizz))
(notecolumn (ly:grob-parent grob X))
(stem (ly:grob-object notecolumn 'stem))
(direction (ly:grob-property stem 'direction)))
(if (positive? direction)
(ly:stencil-scale notehead -1 1)
notehead)))
\override NoteHead.stem-attachment = #'(1.223 . -0.1)
}
flutepizzOff = \undo\flutepizz
{
\flutepizz c''4 f'16 c' d' cis'' \flutepizzOff d''4
}
Lukas