[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: change custom notehead for different stem direction
From: |
Orm Finnendahl |
Subject: |
Re: change custom notehead for different stem direction |
Date: |
Wed, 8 Sep 2021 10:47:11 +0200 |
Hi Lukas,
thanks, that's perfect! I'll provide a working example to share as
soon as I've finished the code.
Best,
Orm
Am Mittwoch, den 08. September 2021 um 10:32:35 Uhr (+0200) schrieb
Lukas-Fabian Moser:
> Hi Orm,
>
> > for flute pizzicato in contemporary music, it is quite common to use
> > a ">" as a notehead. With a stem down, the ">" should be changed to a
> > "<" as visible in the attached png.
> >
> > I know how to change the notehead by overriding the NoteHead stencil
> > with an eps file, but can't find any information about automatically
> > changing the glyph depending on stem direction. Is that possible in
> > lilypond and does anybody have advice?
> >
> > It's cumbersome to do this by hand each time stem direction is
> > changed.
>
> Unfortunately you didn't provide a working example, hence my cumbersome and
> ugly choice of > or < for "note-heads".
>
> \version "2.22.0"
>
> \relative
> {
> \override NoteHead.stencil = #ly:text-interface::print
> \override NoteHead.text =
> #(lambda (grob)
> (let*
> ((notecolumn (ly:grob-parent grob X))
> (stem (ly:grob-object notecolumn 'stem))
> (direction (ly:grob-property stem 'direction)))
> (markup #:general-align
> Y CENTER
> (if (positive? direction) ">" "<"))))
> c'4 d e f g a b c d e f
> }
>
> Of course, one might adapt the general logic to either use glyphs better
> suited than ">"/"<", or even conditionally rotate/mirror _any_ note-head
> depending on the direction. (One might use grob-transformer for that.)
>
> Lukas
>