[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fingering output change 2.17.9 -> 2.17.10
From: |
Nick Payne |
Subject: |
Fingering output change 2.17.9 -> 2.17.10 |
Date: |
Mon, 14 Jan 2013 14:37:35 +1100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 |
To indicate guide fingering I've been using the code below. In 2.17.10,
the fingering with guide is placed above the stem even though
Fingering.add-stem-support = ##f. In 2.17.9 and earlier it was placed at
the same height as normal fingering. I've attached pngs of the output on
2.17.9 and 2.17.10:
\version "2.17.9"
% 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)))
;; first combine stencils without any rotation of the guide
line in
;; order to get X and Y extent to use for final translation
of the
;; combined stencil so that the fingering number is
correctly aligned
(stil
(ly:stencil-combine-at-edge
guide-stil
X 1 ;; combine stencils along X-axis on right
finger-stil
0.3)) ;; 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))
;; now combine again with requested rotation
(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.3)) ;; add padding to move guide slightly left from
finger number
;; 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.52 (- (cdr stil-ext-X) (interval-length
finger-stil-ext))))
stil-ext-Y))))
adj-stil))
(ly:music-property music 'tweaks)))
music))
% guide hyphen
% <c-\ghy #-15 -1>4 c4^\ghy #45 ^2 c4-\ghy #-15 -3 c4_\ghy# -14 _4
ghy = #(define-music-function (parser location slope fingering) (number?
ly:music?)
(gx slope #x2010 fingering))
\relative c'{
\override Fingering.staff-padding = #'()
\override Fingering.add-stem-support = ##f
<c-1>4 <d-\ghy #15 -3>
}
2.17.10.png
Description: PNG image
2.17.9.png
Description: PNG image