[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Moving accidentals above or below notes
From: |
Paul Morris |
Subject: |
Re: Moving accidentals above or below notes |
Date: |
Mon, 17 Dec 2012 16:47:39 -0500 |
Hi Dominique,
Apparently I cannot resist a challenge. The following is a scheme function
that will move accidentals above or below notes, depending on the stem
direction. You can adjust the numbers following "ly:grob-translate-axis!" to
fine-tune the positioning.
If you want it to automatically move all accidentals, you can put the override
in the \with block of a staff, like I've shown below.
HTH,
-Paul
\version "2.16"
accidentalShifter =
#(lambda (grob)
(let* (
(notehead (ly:grob-parent grob 1))
(notecol (ly:grob-parent notehead 0))
(stm (ly:grob-object notecol 'stem))
(stmdir (ly:grob-property stm 'direction))
)
;; just for testing
;; (display stmdir) (newline)
(ly:grob-translate-axis! grob 0.2 X)
(if (= stmdir -1)
(ly:grob-translate-axis! grob 2.5 Y)
(ly:grob-translate-axis! grob -2.5 Y)
)
))
accShift = {
\once \override Score.Accidental #'before-line-breaking = \accidentalShifter
}
\relative c'' {
a16 b \accShift cis \accShift bes
g a \accShift b \accShift c
}
\relative c'' {
a b c b
g a b c
}
\new Staff \with {
\override Accidental #'before-line-breaking = \accidentalShifter
} {
\relative c'' {
a16 b cis bes
g a b c
}
}