[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Optional args in event-function not working with 2.17.6 ?
From: |
Thomas Morley |
Subject: |
Optional args in event-function not working with 2.17.6 ? |
Date: |
Fri, 9 Nov 2012 02:27:50 +0100 |
Hi,
I was working on
http://lists.gnu.org/archive/html/lilypond-user/2012-11/msg00185.html
and wrote a event-function as a template for custom-script-signs.
This function uses some optional arguments and works as expected in 2.16.0
But not in 2.17.6
What am I missing?
\version "2.16.0"
#(define (mrkp align arg)
#{
\markup
\fontsize #1.2
\general-align #X #align
\override #'(font-name . "TeXGyreSchola Bold")
%\override #'(font-name . "Century Schoolbook L")
\vcenter
#arg
#})
newScript =
#(define-event-function (parser location lst scaling strg) ((list? '(0
0 0)) (boolean? #f) string?)
#{
\tweak
#'stencil
#(lambda (grob)
(let* ((dir (ly:grob-property grob 'direction))
(note-head (ly:grob-parent grob X))
(note-column (ly:grob-parent note-head Y))
(stem (ly:grob-object note-column 'stem))
(stem-dir (ly:grob-property stem 'direction))
(align (cond ((and (= stem-dir 1)(= dir 1))
(car lst))
((and (= stem-dir -1)(= dir -1))
(cadr lst))
((or (= stem-dir -1)(= dir -1))
(car (last-pair lst)))
(else 0)))
(new-stencil
(grob-interpret-markup grob
(mrkp align strg))))
(ly:stencil-scale
new-stencil
1 (if scaling dir 1)
)))
-|
#})
% The arguments of the list dictate alignment-behaviour.
% First: If Stem- and Script-direction is UP.
% Second: If Stem- and Script-direction is DOWN.
% Third: If Stem- or Script-direction is DOWN
%
% LEFT : -1
% RIGHT : 1
% CENTER : 0
% Other value are possible.
%
% The list #'(0 0 0) could be omitted.
%
%
% If you want to mirror the script sign (while Script-direction is Down)
% add ##t, as shown in the examples.
% Otherwise it could be omitted too.
grave = \newScript #'(-1 0 0) ##t "`"
acute = \newScript #'(0 1 0) ##t "´"
threePoints = \newScript "…"
noName = \newScript "@"
\relative c' {
c1\grave
d\acute
e\threePoints
f\noName
}
Regards,
Harm
- Optional args in event-function not working with 2.17.6 ?,
Thomas Morley <=
Re: Optional args in event-function not working with 2.17.6 ?, David Kastrup, 2012/11/08