-\version "2.14.0"
+\version "2.15.5"
#(use-modules (srfi srfi-13)
(ice-9 format))
%% \ottava
\test "" ##[ \ottava #1 #] % OttavaMusic
+%% \tweak
+\test "" ##[ < \tweak #'duration-log #2 c > #]
+\test "" ##[ < c \tweak #'transparent ##t e > #]
+\test "" ##[ < \tweak #'color #'(1.0 0.0 0.0) \tweak #'duration-log #2 c > #]
+\test "" ##[ c-\tweak #'font-size #3 -> #]
+
%% end test.
#(read-hash-extend #\[ #f) %{ ] %}
;;;
(define (scheme-expr->lily-string scm-arg)
(cond ((or (number? scm-arg)
- (string? scm-arg))
+ (string? scm-arg)
+ (boolean? scm-arg))
(format #f "~s" scm-arg))
((or (symbol? scm-arg)
(list? scm-arg))
;; as a note_chord_element to prevent spurious output, e.g.,
;; \displayLilyMusic < c-1\4 >8 -> c-1\48
(null? (filter post-event?
- (ly:music-property (car simple-elements) 'articulations))))
+ (ly:music-property (car simple-elements) 'articulations)))
+ ;; same for simple_element with \tweak
+ (null? (ly:music-property (car simple-elements) 'tweaks)))
;; simple_element : note | figure | rest | mmrest | lyric_element | skip
(let* ((simple-element (car simple-elements))
(duration (ly:music-property simple-element 'duration))
(format #f "~a\\tag #'~a" (if post-event? "-" "") tag))
(ly:music-property expr 'tags))))
+(define* (tweaks->lily-string expr #:optional (post-event? #f))
+ (format #f "~{~a ~}"
+ (map (lambda (tweak)
+ (format #f "~a\\tweak #'~a #~a"
+ (if post-event? "-" "")
+ (car tweak)
+ (scheme-expr->lily-string (cdr tweak))))
+ (ly:music-property expr 'tweaks))))
+
(define-public (music->lily-string expr parser)
"Print @var{expr}, a music expression, in LilyPond syntax."
(if (ly:music? expr)
(proc expr parser))
procs))))
(if result-string
- (format #f "~a~a"
- (tag->lily-string expr (post-event? expr))
+ (format #f "~a~a~a"
+ (tag->lily-string expr (post-event? expr))
+ (tweaks->lily-string expr (post-event? expr))
result-string)
(format #f "%{ Print method not implemented for music type ~a %}"
music-type)))