[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fingering output change 2.17.9 -> 2.17.10
From: |
Nick Payne |
Subject: |
Re: Fingering output change 2.17.9 -> 2.17.10 |
Date: |
Tue, 15 Jan 2013 17:54:39 +1100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 |
On 14/01/13 17:31, Keith OHara wrote:
Nick Payne <nick.payne <at> internode.on.net> writes:
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.
Mike changed the fingering placement so that they go as close as they fit,
for issue <http://code.google.com/p/lilypond/issues/detail?id=2764>
It looks like your custom fingering stencil has a faked (shifted) extent
so that it lines up as you wish. The fingering will fit, but its faked
extent interferes with the stem. If I narrow the faked extent a bit, the
fingering slides down along the stem.
This hack seems to do the trick:
\version "2.17.10"
% 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.1)) ;; 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.1)) ;; 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
finger-stil-ext
(* 1.02 (- (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 = #'()
<c-4>4 <d-\ghy #15 -4>
}