The code below (I think it might have come from David Nalesnik) builds
without any error on both 2.16.2 and 2.17.11, but the output is correct
on 2.16.2 and incorrect on 2.17.11. On 2.17.11, the fingerings with
guide indication that are to the left become centred on the note - on
2.16 they stay in the correct position to the left. Is this difference
anything to do with the fingering changes that were introduced earlier
in 2.17?
Nick
\version "2.16.2"
% left-hand finger guide finger between notes
#(define (gx slope character fingering)
;; Purpose
;; add ornamentation character before fingering symbol
;; Parameters
;; slope : angle of rotation around right centre
;; character : ornamentation character for fingering
;; fingering : fingering designation for note
;; Examples
;; (gx 0 #x2013 fingering)
;; unicode #x2011 <-> #x2015 are different length "-" punctuation
(let ((music (make-music 'FingeringEvent)))
(set! (ly:music-property music 'tweaks)
(acons 'stencil
(lambda (grob)
(let* ((finger (ly:music-property fingering 'digit))
(finger-stil (grob-interpret-markup grob (number->string finger)))
(finger-stil-ext (ly:stencil-extent finger-stil X))
(guide-char character)
(guide-stil (grob-interpret-markup grob (markup #:char guide-char)))
(stil
(ly:stencil-combine-at-edge
(ly:stencil-rotate guide-stil slope 1 0) ;; rotate "slope" around right centre
X 1 ;; combine stencils along X-axis on right
finger-stil
0.2)) ;; add padding to move guide slightly left from finger number
(stil-ext-X (ly:stencil-extent stil X))
(stil-ext-Y (ly:stencil-extent stil Y))
;; Alter X-extents of combined stencil so that it
;; will be positioned with the number centered
;; over the note.
(adj-stil
;; leave fingerings oriented to side alone
(if (= 0 (ly:grob-property grob 'side-axis))
stil
(ly:make-stencil
(ly:stencil-expr stil)
(coord-translate
stil-ext-X
(* 0.5 (- (cdr stil-ext-X) (interval-length finger-stil-ext))))
stil-ext-Y))))
adj-stil))
(ly:music-property music 'tweaks)))
music))
% guide-neutral
% <c-\gn-1>4 c4^\gn^2 c4-\gn-3 c4_\gn_4
gn = #(define-music-function (parser location fingering) (ly:music?)
(gx 0 #x2013 fingering))
% guide-down
% <c-\gd-1>4 c4^\gd^2 c4-\gd-3 c4_\gd_4
gd = #(define-music-function (parser location fingering) (ly:music?)
(gx 20 #x2013 fingering))
% guide-up
% <c-\gu-1>4 c4^\gu^2 c4-\gu-3 c4_\gu_4
gu = #(define-music-function (parser location fingering) (ly:music?)
(gx -20 #x2013 fingering))
% guide slope
% <c-\gsl #-15 -1>4 c4^\gsl #45 ^2 c4-\gsl #-15 -3 c4_\gsl# -14 _4
gsl = #(define-music-function (parser location slope fingering) (number? ly:music?)
(gx slope #x2013 fingering))
% guide slope unicode
% <c-\gsl #-15 ##x2011 -1>4 c4^\gsl #45 ##x2012 ^2 c4-\gsl #-15 ##x2013 -3 c4_\gsl #-14 ##x2014 _4
gsn = #(define-music-function (parser location slope unicode fingering) (number? number? ly:music?)
(gx slope unicode fingering))
% guide slope character
% <c-\gsl #-15 ##\+ -1>4 c4^\gsl #45 ##\+ ^2 c4-\gsl #-15 ##\! -3 c4_\gsl #-14 ##\! _4
gsc = #(define-music-function (parser location slope character fingering) (number? char? ly:music?)
(gx slope (char->integer character) fingering))
\relative c'' {
<fis^4 b, a dis,>2 <g-\gd^4 b, g e> |
<fis^4 b, a dis,>2 <g-\gsn #10 ##x2014 ^4 b, g e> |
\set fingeringOrientations = #'(left)
<fis-\gsn #-20 ##x2014 -4 b, a-2 dis,>2 <g-\gd^4 b, g-\gu^2 e> |
}
_______________________________________________
bug-lilypond mailing list
bug-lilypond@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-lilypond