Hello list,
when I am typesetting christian/latin or german music, there are often
passages with short notes and a lot of long syllables. The character 'M'
is a quite long one and if you have the german word "schlem -- men", it
also takes a lot of space.
If I use proportional duration scaling for the notes, it only works -
for texts like these - with a very wide spreading of the notes. So I
tried to scale the lyrics proportionally:
--snip--
\version "2.14.2"
#(define-public (create-damp-stencil axis mx gamma proc)
(lambda (grob)
(let* ((stil (proc grob)) ; produce stencil
(extent (ly:stencil-extent stil axis)) ; get stencil
extent
(size (- (cdr extent) (car extent))) ; there's a
ly:function for this, I think
(fac (* (/ mx size) (- 1 (expt gamma (- size)))))) ;
calculate scale-factor: maximum/size * (1 - (gamma ^ (-size)))
(if (< fac 1.0) ; if we make it smaller, return scales
else original stencil
(ly:stencil-scale stil (if (eq? axis X) fac 1) (if
(eq? axis Y) fac 1))
stil)
)))
% some text with different syllable lengths ... many characters and a
lot of 'm's
credo = \lyricmode {
Cre -- do in u -- num De -- um Je -- sum Chri -- stum
}
\relative c'' {
\repeat unfold 2 { \repeat unfold 11 { c8 } r }
} \addlyrics {
\credo
\override LyricText #'stencil = #(create-damp-stencil X 4 1.6
lyric-text::print)
\credo
}
--snip--
The scaling formula maximum/size * (1 - (gamma ^ (-size))) is a first
shot, wich scales all syllables to not be greater than maximum. So in
this example the 8ths are not spread in the second part by 'sum' or 'Chris'.
But I don't like the look of the uneven scaled text. Has anyone an idea
of a "softer" scaling function? Or has anyone another idea on this topic?
Right now I simply try a scaled stencil:
--snip--
\version "2.14.2"
#(define-public (create-scale-stencil fac proc)
(lambda (grob)
(let ((stil (proc grob)))
(if (pair? fac)(ly:stencil-scale stil (car fac) (cdr fac))
(begin (ly:message "not a pair of numbers: ~A!" fac)
stil)))))
% some text with different syllable lengths ... many characters and a
lot of 'm's
credo = \lyricmode {
Cre -- do in u -- num De -- um Je -- sum Chri -- stum
}
\relative c'' {
\repeat unfold 2 { \repeat unfold 11 { c8 } r }
} \addlyrics {
\credo
\override LyricText #'stencil = #(create-scale-stencil '(.7 . 1)
lyric-text::print)
\credo
}
--snip--
What do you think of this?
Cheers,
Jan-Peter
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user