[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
improving Janek's \dynamic function (for combo dynamics)
From: |
Kieren MacMillan |
Subject: |
improving Janek's \dynamic function (for combo dynamics) |
Date: |
Tue, 15 Aug 2017 21:50:21 -0400 |
Hello all,
The snippet below includes Janek's \dynamic function, which has a rather lovely
interface.
Unfortunately, it doesn't align leading dynamics as expected (i.e., centered on
the notehead).
What's the easiest way to fix the function so that it does?
Thanks,
Kieren.
%%% SNIPPET BEGINS
\version "2.19.64"
#(use-modules (ice-9 regex))
dynamic =
#(define-event-function (text) (markup?)
(if (string? text)
(let* ((underscores-replaced
(string-map
(lambda (x) (if (eq? x #\_) #\space x))
text))
(split-text (string-split underscores-replaced #\space))
(formatted (map
(lambda (word)
(if (string-match "^[mrzfps]*$" word)
(markup #:dynamic word #:hspace 0.25)
(markup #:normal-text #:fontsize 0.625 #:italic
word)))
split-text)))
#{
-\tweak X-offset #0
#(make-dynamic-script (make-line-markup formatted))
#})
;; user provided a full-blown markup, so we don't mess with it:
#{
#(make-dynamic-script (markup #:normal-text #:fontsize 0.625 text))
#}))
<<
\new Staff { c''\dynamic "fffff testing" }
\new Staff { c''\fffff }
>>
%%% SNIPPET ENDS
________________________________
Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: address@hidden
- improving Janek's \dynamic function (for combo dynamics),
Kieren MacMillan <=
- Re: improving Janek's \dynamic function (for combo dynamics), Shevek, 2017/08/19
- Re: improving Janek's \dynamic function (for combo dynamics), Kieren MacMillan, 2017/08/20
- Re: improving Janek's \dynamic function (for combo dynamics), Lukas-Fabian Moser, 2017/08/24
- Re: improving Janek's \dynamic function (for combo dynamics), Saul Tobin, 2017/08/24
- Re: improving Janek's \dynamic function (for combo dynamics), Kieren MacMillan, 2017/08/24
- Re: improving Janek's \dynamic function (for combo dynamics), Thomas Morley, 2017/08/26
- Re: improving Janek's \dynamic function (for combo dynamics), David Kastrup, 2017/08/26
- Re: improving Janek's \dynamic function (for combo dynamics), Thomas Morley, 2017/08/26
- Re: improving Janek's \dynamic function (for combo dynamics), David Kastrup, 2017/08/26
- Re: improving Janek's \dynamic function (for combo dynamics), Thomas Morley, 2017/08/26