[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: conditionally eliminating lyric extender
From: |
Alexander Kobel |
Subject: |
Re: conditionally eliminating lyric extender |
Date: |
Tue, 12 Jun 2012 09:40:50 +0200 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 |
On 2012-06-11 17:49, Alexander Kobel wrote:
<this very same message>
Looks like this message has not made it to the list; not sure if the
problem was on my or on the gnu.org side. I apologize in advance if it
appears twice now.
================================
Hi all,
digging out a very old thread:
<http://lists.gnu.org/archive/html/lilypond-user/2009-08/msg00136.html>
It was about conditionally killing lyric extenders if they are in the
source, but the engraving turns out too tight for them to be necessary.
Several months ago, I wrote the following function for exactly this. I
forgot about it and today hoped that Google helps me find it; turned out
that I had to grep locally instead since I never posted it to the
public. Ashamed of that, but here comes the code:
#(define (conditional-kill-lyric-extender-callback . args)
(lambda (grob)
(let* ((minimum-length
(if (null? args)
(ly:grob-property grob 'minimum-length 0)
(car args)))
(X-extent (ly:stencil-extent (ly:grob-property grob 'stencil
empty-stencil) X))
(length (- (cdr X-extent) (car X-extent))))
(if (> minimum-length length)
(ly:grob-suicide! grob)))))
\layout {
\context {
\Lyrics
\override LyricExtender #'minimum-length = #0
\override LyricExtender #'after-line-breaking =
#(conditional-kill-lyric-extender-callback 1)
%% change "1" (in staff-spaces) to whatever you feel is a suitable
minimum length for extenders
}
}
Best,
Alexander