lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Function to add a "-" before finger number


From: Neil Puttock
Subject: Re: Function to add a "-" before finger number
Date: Tue, 3 Aug 2010 20:25:50 +0100

On 3 August 2010 01:55, Antheo <address@hidden> wrote:

> Ideally I'd like to have the following syntax: {f \shift a-1} where the
> \shift command would add a dash and offset the finger number to be aligned
> with the note. Or it could be {f a\shift-1}.

The latter syntax is easier to implement (and more in keeping with
LilyPond's postfix convention):

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)
                    (grob-interpret-markup grob
                                           (make-concat-markup
                                            (list (make-char-markup #x2012)
                                                  (number->string finger)))))
                  (ly:music-property music 'tweaks)))
     music))

\relative c' {
  % must use hyphen before \shift
  c4-\shift -3
}

Cheers,
Neil



reply via email to

[Prev in Thread] Current Thread [Next in Thread]