[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: guide finger
From: |
David Nalesnik |
Subject: |
Re: guide finger |
Date: |
Tue, 21 Aug 2012 06:59:49 -0500 |
Hi pabuhr,
On Mon, Aug 20, 2012 at 11:45 PM, pabuhr <address@hidden> wrote:
> Thank you so much. However, because "rotate" performs its rotation around the
> center of the character I need to make a small adjustment. There is a
> "rotation" routine allowing rotation at an arbitrary point but it appears to
> be
> solely for music not markups.
I suppose you're thinking of ly:stencil-rotate. You can use this in
the function, since the result of grob-interpret-markup is a stencil:
#(define (gx rotate-guide fingering)
(let ((music (make-music 'FingeringEvent))
(finger (ly:music-property fingering 'digit))
(guide-char #x2013))
(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)) rotate-guide -1 1)
X 1
(grob-interpret-markup grob (number->string finger))
0))
(ly:music-property music 'tweaks)))
music))
>I tried the following change using "translate"
> but there is no "translate-guide" routine, which was a guess on my part after
> looking at the way "rotate" is used. I have attempted to locate a list of
> these
> Scheme routines but been unsuccessful. I even downloaded the GIT source for
> lilypond and tried to find them there. So I have done due diligence, but I may
> have done the wrong things. Can someone show me how to make translate move the
> character? I can do the fine tuning of the position after that.
I don't find a list of the make-...-markup formulations, and I just
created make-rotate-markup as you made make-translate-markup.
To express markups in Scheme in a way that is closer to ordinary input
you can use the syntax detailed here (I show this below as an
alternative):
http://www.lilypond.org/doc/v2.15/Documentation/extending/markup-construction-in-scheme
This is how to get the translation to work:
#(define (gx rotate-guide fingering)
(let ((music (make-music 'FingeringEvent))
(finger (ly:music-property fingering 'digit))
(guide-char #x2013))
(set! (ly:music-property music 'tweaks)
(acons 'stencil
(lambda (grob)
(grob-interpret-markup grob
; EITHER:
;(make-concat-markup
; (list
;(make-translate-markup '(2 . 3)
;(make-rotate-markup rotate-guide (make-char-markup
guide-char)))
;(number->string finger)))))
; OR:
(markup #:concat
(#:translate '(2 . 3) (#:rotate rotate-guide (#:char
guide-char)))
(number->string finger))))
(ly:music-property music 'tweaks)))
music))
> ==============================================================================
>
>
> You might consider upgrading to one of the current development versions if
> you're interested in writing functions like this. There is now quite a bit
> more flexibility and power to music functions (thanks to David Kastrup).
>
> I am using GNU LilyPond 2.15.41 even though my files still have "\version
> "2.14.2"" at the start. Again, I spent some time trying to locate scheme music
> functions but was wholly unsuccessful. But I may just be searching with the
> wrong magic phrases.
Well, here I was meaning that it was a simple matter to keep your
original formulation as a music function and call it from another
music function. (See attached. This will cause errors if you try it
with 2.14.2.)
HTH,
David
finger-slide.ly
Description: Binary data