Hello everyone,

I hit the issue of adding accidentals above/below ornaments, and it seems like there isn’t a widespread easy-to-use solution, is there? https://gitlab.com/lilypond/lilypond/-/issues/3174 is supposed to address the issue on the most fundamental level, but until that gets there, I can well imagine a pragmatic solution just tacking the accidentals on to the existing stencil.

Unfortunately, I’m terrible at remembering and searching for how to code these things :( So I cooked up a bit of pseudo-code, and I do have a sense that easy tools exist to turn it into an actual implementation. Do any of you wizards want to help me out? Surely this would be great for LSR.

Very best regards,
Simon

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.25.28"

% Function: ly:stencil-combine-at-edge first axis direction second padding

scriptAccidental =
#(define-event-function (dir altr evnt) (ly:dir? exact-rational? ly:event?)
   (ly:stencil-combine-at-edge
    evnt-stencil
    Y
    dir
    (grob-interpret-markup grob (make-text-accidental-markup altr))
    .2))
scriptSharp =
#(define-event-function (dir evnt) (ly:dir? ly:event?)
   (scriptAccidental dir 1/2 evnt))
scriptNatural =
#(define-event-function (dir evnt) (ly:dir? ly:event?)
   (scriptAccidental dir 0 evnt))
scriptFlat =
#(define-event-function (dir evnt) (ly:dir? ly:event?)
   (scriptAccidental dir -1/2 evnt))

{
  % turn with a flat above and sharp below
  a'\scriptFlat #UP \scriptSharp #DOWN \turn
}

Reply via email to