[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
snippet to properly align dynamics with expressive text
From: |
Shevek |
Subject: |
snippet to properly align dynamics with expressive text |
Date: |
Fri, 7 Jul 2017 14:52:04 -0700 (MST) |
Dynamics with expressive text, like "p espressivo" are meant to have the
dynamic aligned on the notehead the same as ordinary dynamics, with the
expressive text following. Here is a snippet I've written to align custom
dynamics correctly.
\version "2.18.2"
\paper {
ragged-right = ##f
indent = 0\cm
}
dynText = #(define-event-function (parser location dyn expr) (markup?
markup?)
(let* (
(mark #{ \markup { \dynamic $dyn \normal-text\italic
$expr } #})
(offset (lambda (grob)
(let* (
(layout (ly:grob-layout grob))
(props (ly:grob-alist-chain grob
(ly:output-def-lookup layout
'text-font-defaults)))
(target-X-extent
(ly:stencil-extent
(ly:text-interface::interpret-markup layout props dyn)
X))
(width (abs
(- (cdr target-X-extent) (car
target-X-extent))))
)
(display target-X-extent)
(- 1 (/ width 2))
)
)
)
)
#{
\tweak DynamicText.X-offset #offset
#(make-dynamic-script mark)
#}
)
)
%% Example
\new Staff \with {
\omit TimeSignature
} \relative c' {
c1\dynText "p" "sub."
c1\dynText "fff" "espressivo"
c1\dynText "p" "espressivo"
c1\dynText "fffff" "sub."
\break
c1\p
c1\fff
c1\p
c1\fffff
}
--
View this message in context:
http://lilypond.1069038.n5.nabble.com/snippet-to-properly-align-dynamics-with-expressive-text-tp204305.html
Sent from the User mailing list archive at Nabble.com.
- snippet to properly align dynamics with expressive text,
Shevek <=
- Re: snippet to properly align dynamics with expressive text, Kieren MacMillan, 2017/07/07
- Re: snippet to properly align dynamics with expressive text, Shevek, 2017/07/07
- Re: snippet to properly align dynamics with expressive text, Urs Liska, 2017/07/08
- A contribution (was Re: snippet to properly align dynamics with expressive text), Richard Shann, 2017/07/08
- Re: A contribution (was Re: snippet to properly align dynamics with expressive text), Simon Albrecht, 2017/07/08
- Re: A contribution (was Re: snippet to properly align dynamics with expressive text), Richard Shann, 2017/07/09
- Re: A contribution (was Re: snippet to properly align dynamics with expressive text), Malte Meyn, 2017/07/09
- Re: A contribution (was Re: snippet to properly align dynamics with expressive text), Richard Shann, 2017/07/09
- Re: A contribution (was Re: snippet to properly align dynamics with expressive text), Urs Liska, 2017/07/10
- Re: A contribution (was Re: snippet to properly align dynamics with expressive text), Jacques Menu Muzhic, 2017/07/10