[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: guide finger
From: |
pabuhr |
Subject: |
Re: guide finger |
Date: |
Tue, 21 Aug 2012 14:58:48 -0700 |
I suppose you're thinking of ly:stencil-rotate.
Brilliant!
Now let me see if I can reward your patience by showing you I have learned
something.
The rotation needs to be along the right centre (center) so the character
appears to rotate in the middle of the finger number, which I figured out.
Also, I put in some documentation. And I generalize one step further by
allowing the ornamentation character to be passed as an argument. However, I
don't know how to write "gsc" (see below) to pass in a character or unicode to
"gx". So I still need help.
Also, does scheme have optional positional parameters and/or named parameters
to possibly allow more generalization, such as the padding size or putting the
ornamentation before or after the finger symbol? (Yea, I'm probably getting
carried away here. ;-)
==============================================================================
\version "2.14.2"
#(define (gx slope character fingering)
;; Purpose
;; add ornamentation character before fingering symbol
;; Parameters
;; slope : angle of rotation around right centre
;; character : ornamentation character before fingering
;; fingering : fingering designation for note
;; Examples
;; (gx 0 #x2013 fingering)
;; unicode #x2011 <-> #x2015 are different length "-" punctuation
(let ((music (make-music 'FingeringEvent))
(finger (ly:music-property fingering 'digit))
(guide-char character))
(set! (ly:music-property music 'tweaks)
(acons 'stencil
(lambda (grob)
(ly:stencil-combine-at-edge
(ly:stencil-rotate (grob-interpret-markup grob (markup #:char
guide-char))
slope 1 0) ;; rotate "slope" around right centre
X 1 ;; combine stencils along X-axis on right
(grob-interpret-markup grob (number->string finger))
0.2)) ;; add padding to move guide slightly left
from finger number
(ly:music-property music 'tweaks)))
music))
% guide-neutral
gn = #(define-music-function (parser location fingering) (ly:music?)
(gx 0 #x2013 fingering))
% guide-down
gd = #(define-music-function (parser location fingering) (ly:music?)
(gx 30 #x2013 fingering))
% guide-up
gu = #(define-music-function (parser location fingering) (ly:music?)
(gx -30 #x2013 fingering))
% guide slope
gs = #(define-music-function (parser location slope fingering) (number?
ly:music?)
(gx slope #x2013 fingering))
% guide slope character
gsc = #(define-music-function (parser location slope character fingering)
(number? char? ly:music?)
(gx slope character fingering))
\relative c' {
\override Fingering #'font-size = #-2
\override Fingering #'color = #red
\set fingeringOrientations = #'(left)
<c-\gn-1>4
c4^\gn^2
c4-\gn-3
c4_\gn_4
\set fingeringOrientations = #'(right)
<c-\gn-3>4
r4
<c-\gu-1>4
r4
c4^\gu^2
c4-\gd-3
c4_\gd_4
r4
<c-\gs #-15 -1>4
r4
c4^\gs #15 ^2
c4-\gs #45 -3
c4_\gs #-45 _4
% these don't work
% r4
% <c-\gsc #-15 ##x2011 -1>4
% r4
% c4^\gsc #15 ##x2012 ^2
% c4-\gsc #45 ##x2013 -3
% c4_\gsc #-4 ##x2014 _4
% r4
% <c-\gsc #-15 '+' -1>4
% r4
% c4^\gsc #15 '+' ^2
% c4-\gsc #45 '+' -3
% c4_\gsc #-4 '+' _4
}