Am 17.05.2014 01:51, schrieb Thomas Morley:
2014-05-17 0:38 GMT+02:00 Urs Liska <u...@openlilylib.org>:
Am 16.05.2014 09:41, schrieb d...@gnu.org:
Well, we have \omit already. What if we had
\appearance [markup] [grobname or music]
Which would basically be the syntactic sugar for overriding the stencil
with an appropriate grob-interpret-markup?
That way one could just define some markup function for formatting time
signatures and use it either in markup contexts or indeed for overriding
a time signature.
If I understand you correctly this would mean that one would write
\appearance \fractionList #'((6 8)(5 4)) Score.TimeSignature
instead of
\override Score.TimeSignature.stencil = \fractionList #'((6 8)(5 4))
?
I think David thought of something at the lines of the following function:
appearance =
#(define-music-function (parser location mrkp item)
(markup? symbol-list-or-music?)
(let ((stil (lambda (item)
(grob-interpret-markup item mrkp))))
#{ \tweak stencil #stil #item #}))
\relative c' {
\appearance
\markup "XY"
Staff.Clef
\appearance
\markup
\override #'(baseline-skip . 0)
\override #'(word-space . 0.2)
\line {
\center-column { \number 3 \number 4 }
\center-column { \number 6 \number 8 }
}
Score.TimeSignature
c1
}
That looks good.
With a little modification (just skipping the wrapping of the generated
markup to a stencil one could still use fractionList with that like:
\appearance \fractionList #'(#t (6 8)(7 8)) Score.TimeSignature
What do you think?
a) \appearance still seems a bit odd because it's not a verb.
\use would be appropriate but I'm not sure if that's too generic
to be used for the discussed function.
b) What would be the right order of operations?
I assume "appearance" should be included first
(or in one combined step because it's not so useful to first
add \fractionList just to modify it immediately afterwards.
Urs
Cheers,
Harm
\version "2.19.6"
fractionList =
#(define-scheme-function (parser location timesigs) (list?)
(_i "Generate a list of time signature markups that can be used
to override TimeSignature.stencil in order to indicate irregularly
changing meters. Optionally print hyphens between the individual
time signatures.")
(let* (;; #t if the first list element is a #t,
;; #f if it is anything else (i.e. a list)
(hyphen (and (boolean? (car timesigs))
(car timesigs)))
;; = timesigs stripped off a possible leading boolean
(used-signatures
(if hyphen
(cdr timesigs)
timesigs)))
;; Check for well-formedness of the used-signatures list:
;; #t if all list elements are lists with two elements
(if (every (lambda (sig) (eqv? 2 (length+ sig))) used-signatures)
;; generate the list of time signatures
#{
\markup \override #'(baseline-skip . 0)
\number
#(map (lambda (x)
#{ \markup {
% create a column from one input sublist
\center-column #(map number->string x)
% process the hyphen if requested
#(if hyphen
(if (eq? x (last timesigs))
;; do not print a hyphen after the last column
""
;; generate the hyphen
; TODO: make appearance configurable
(markup
#:line
(#:hspace -0.25
(#:override
(cons (quote thickness) 3.4)
(#:draw-line (cons 0.9 0)))
#:hspace -0.15)))
"")
}
#}) used-signatures)
#}
(ly:input-message location (_i "Error in \\fractionList.
Please use time signatures with two elements.")))))
appearance =
#(define-music-function (parser location mrkp item)
(markup? symbol-list-or-music?)
(let ((stil (lambda (item)
(grob-interpret-markup item mrkp))))
#{ \tweak stencil #stil #item #}))
\relative c' {
\appearance
\markup "XY"
Staff.Clef
\appearance
\markup
\override #'(baseline-skip . 0)
\override #'(word-space . 0.2)
\line {
\center-column { \number 3 \number 4 }
\center-column { \number 6 \number 8 }
}
Score.TimeSignature
c1
\appearance \fractionList #'(#t (6 8)(7 8)) Score.TimeSignature
\time 6/8
c8 c c c c c c
}
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel