1 ;------------------------------------------------------------------;
2 ; opus_libre -- markup-commands.scm ;
4 ; (c) 2008-2010 Valentin Villenave <valentin@villenave.net> ;
6 ; opus_libre is a free framework for GNU LilyPond: you may ;
7 ; redistribute it and/or modify it under the terms of the GNU ;
8 ; General Public License, version 3 or later: gnu.org/licenses ;
10 ;------------------------------------------------------------------;
14 (define-markup-command (smallCaps layout props text) (markup?)
15 ;; Thanks to Nicolas Sceaux! See libtext.scm.
17 "Print @var{arg} as small caps.
18 This version of the @code{\\smallCaps} command adds basic support
19 for accented characters."
20 (interpret-markup layout props
22 (make-small-caps (string->list text) (list) #f (list))
26 (define-markup-command (dynamic-string layout props str) (string?)
29 @cindex dynamics, composite
30 @cindex dynamics, mixed with text
32 Print a string using the dynamic font only when appropriate.
33 Words may be separated with @code{_}; dynamic-style characters
34 will only be used in words that contain no other letter than
35 @b{f}, @b{m}, @b{p}, @b{r}, @b{s} and @b{z}, and punctuation
36 marks. Regular spaces are allowed inside words.
38 @lilypond[verbatim,quote]
40 \\dynamic-string #\"mp,_quasi_mf_ma piĆ¹ dolce.\"
43 (let ((composite-chars (char-set-union
46 char-set:punctuation))
47 (split (lambda (s) (string-index s #\_ )))
49 (style-markup (lambda (s)
50 (make-normal-text-markup
51 (make-italic-markup s)))))
52 (do ((current-str (string-append str "_")))
53 ((not (split current-str)))
56 (append str-list (list
57 (string-take current-str (split current-str)))))
59 (string-drop current-str (+ (split current-str) 1)))))
60 (interpret-markup layout props
63 (if (string-every composite-chars word)
64 (if (string-every char-set:dynamics word)
65 (make-dynamic-markup word)
66 (let ((word-lst (string->list word)))
69 (let ((print-ch (string ch)))
70 (if (char-punctuation? ch)
71 (style-markup print-ch)
72 (make-dynamic-markup print-ch))))
77 ;; Probably stolen from Nicolas' code -- is this really useful here?
78 (define-markup-command (line-width-ratio layout props width-ratio arg) (number? markup?)
79 (interpret-markup layout props
80 (markup #:override (cons 'line-width (* width-ratio (chain-assoc-get 'line-width props)))
83 ;; TODO: to be theme-ized.
84 (define-markup-command (indic layout props arg) (markup?)
85 (interpret-markup layout props
86 (markup #:whiteout #:small #:italic arg)))