On 3 August 2010 21:49, Marc Mouries <m...@mouries.net> wrote:
> Thanks Neil. I just tried it and as you can see the number is too far on the
> right. I inserted a call to "make-general-align-markup X LEFT"
> but it did not help. Is there a way to move the "-" and the number further on
> the left so that the number is on the same axis of the note?
Sure, try the attached file. It calculates the extra space taken up
by the dash and moves the total stencil to the left to compensate.
Cheers,
Neil
\version "2.12.3"
%% Shift Finger
%% Print a finger number preceded by a "-" to indicate a shift
shiftI = \markup \center-align \finger \concat {\char ##x2012 1}
shiftII = \markup \center-align \finger \concat {\char ##x2012 2}
shiftIII = \markup \center-align \finger \concat {\char ##x2012 3}
shiftIV = \markup \center-align \finger \concat {\char ##x2012 4}
%% Usage: c4-\shift -3
shift =
#(define-music-function (parser location fingering) (ly:music?)
(let ((music (make-music 'FingeringEvent))
(finger (ly:music-property fingering 'digit)))
(set! (ly:music-property music 'tweaks)
(acons 'stencil
(lambda (grob)
(let ((dash-ext (ly:stencil-extent
(grob-interpret-markup grob (make-char-markup #x2012))
X)))
(ly:grob-translate-axis! grob (/ (interval-length dash-ext) -2) X)
(grob-interpret-markup grob (make-concat-markup
(list (make-char-markup #x2012)
(number->string finger))))))
(ly:music-property music 'tweaks)))
music))
\score {
<<
\new Staff \relative c'' { f4-1 g a2^\shiftI }
\new Staff \relative c'' { f4-1 g a2-\shift-1 }
>>
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user