Kieren,
On Sat, Dec 21, 2013 at 2:30 PM, David Nalesnik <david.nales...@gmail.com>wrote: > Kieren, > > On Sat, Dec 21, 2013 at 2:18 PM, Kieren MacMillan < > kieren_macmil...@sympatico.ca> wrote: > > >> >> Clearly, there’s a gap in several measures, right? >> > > Yup. > > >> >> However, now that I look at the output again, there are no gaps to be >> found — i.e., it apparently works as advertised/expected/desired. [??] >> I will do more testing, and report back. >> > > Actually, gaps--on the first line only--are what I see when I run the > snippet under 2.17.95. But, as you say, those gaps aren't in the original > image you sent... > OK, a little experimentation showed that the right syllable, -bar, is not shifted on the first line because, for some reason, there is no stencil for the non-printed hyphen, yet there is one for the non-printed hyphens on subsequent lines. This means that the variable sten-ex gets assigned the empty interval, and no shift occurs. I don't know the best way to solve this, but this should at least work: [File attached b/c I can't figure out how to cut&paste from Frescobaldi without losing all formatting] HTH, David
<<Screen Shot 2013-12-19 at 8.43.43 AM.png>>
\version "2.17.95" #(define (hack threshold) (lambda (grob) (let* ((sten (ly:lyric-hyphen::print grob)) (sten-ex (if (ly:stencil? sten) (ly:stencil-extent sten X) (cons (/ threshold -2.0) (/ threshold 2.0))))) (if (> (interval-length sten-ex) threshold) sten (let* ((left (ly:spanner-bound grob LEFT)) (right (ly:spanner-bound grob RIGHT)) (left-text (ly:grob-property left 'text)) (right-text (ly:grob-property right 'text)) (full-text (string-concatenate (list left-text right-text))) (full-text-sten (grob-interpret-markup left full-text)) (full-text-sten-ext (ly:stencil-extent full-text-sten X)) (ref (ly:grob-common-refpoint left right X)) (left-ext (ly:grob-extent left ref X)) (right-ext (ly:grob-extent right ref X)) (shift (/ (- (interval-length (cons (car left-ext) (cdr right-ext))) (interval-length full-text-sten-ext)) 2))) (begin (ly:grob-set-property! left 'X-offset (+ (ly:grob-property left 'X-offset) shift)) (ly:grob-set-property! left 'text full-text) (ly:grob-set-property! right 'text "") (ly:grob-set-property! left 'stencil lyric-text::print) (ly:grob-set-property! right 'stencil lyric-text::print) (ly:grob-property left 'stencil) (ly:grob-property right 'stencil) empty-stencil)))))) << \new Voice = "foo" \relative c' { \time 1/4 \repeat unfold 23 { a8 b a[ b] } } \new Lyrics \lyricsto "foo" \lyricmode { \override Lyrics.LyricHyphen.stencil = #(hack 0.5) \override Lyrics.LyricHyphen.minimum-distance = #0 \repeat unfold 23 { foo -- bar foobar __ _ } } >>
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user