Re: LyricHyphen hara-kiri

2013-12-21 Thread Kieren MacMillan
Hi David,

> If you're not accidentally using the older version of the function, I have no 
> idea what could be going on.

Apparently I was — sorry.  =\

Every compressed string looks great now.
Thanks!

>> 2. If “foo-bar" happens over a barline, it probably shouldn’t be compressed; 
>> at the very least, that should be a settable property (analogous: 
>> #’to-barline).
> This probably wouldn't be too hard.  (That sounds like "famous last words"…)

=)

Fingers crossed!

Thanks,
Kieren.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: LyricHyphen hara-kiri

2013-12-21 Thread David Nalesnik
Kieren,


On Sat, Dec 21, 2013 at 3:26 PM, Kieren MacMillan <
kieren_macmil...@sympatico.ca> wrote:


> I think [to begin with] there are two separate issues to consider here:
>
> 1. In m.28, it’s clear that “foo bar” has not become one Pango string,
> which it apparently has on the downbeat of m.29 (and really “should”, I
> imagine, in any “ultimate fix”).
>

Now that's really strange!  I've attached my result below.  Same example as
the last one you gave, but I don't see those gaps.  If you're not
accidentally using the older version of the function, I have no idea what
could be going on.


> 2. If “foo-bar" happens over a barline, it probably shouldn’t be
> compressed; at the very least, that should be a settable property
> (analogous: #’to-barline).
>
>
This probably wouldn't be too hard.  (That sounds like "famous last
words"...)

-David
<>___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: LyricHyphen hara-kiri

2013-12-21 Thread David Nalesnik
Kieren,


On Sat, Dec 21, 2013 at 2:30 PM, David Nalesnik 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
<>\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


Re: LyricHyphen hara-kiri

2013-12-21 Thread David Nalesnik
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...

To add to the fun, those gaps disappear when you remove
Time_signature_engraver.

(maybe that helps, maybe it doesn't!)

--David
<>___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: LyricHyphen hara-kiri

2013-12-21 Thread Kieren MacMillan
Hi all,

This slightly altered snippet shows another problem with the fix/workaround: it 
doesn’t make “compressed” words into a [false] melisma automatically, as it 
clearly should — see, for example, when “foobar” appears on a single note.

\version "2.19"
#(define (hack threshold)
  (lambda (grob)
   (let* ((sten (ly:lyric-hyphen::print grob))
  (sten-ex (if (ly:stencil? sten)
   (ly:stencil-extent sten X)
   '(-inf.0 . +inf.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 `(,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 `(,(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 4 { a8 b a[ b] } \break
\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 }
  }
>>

Cheers,
Kieren.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: LyricHyphen hara-kiri

2013-12-21 Thread Kieren MacMillan
Hi all,Just compiled Mike's most recent foo.ly file again, and there [again] appear to be gaps in the output:What do others see when they compile it?Thanks,Kieren.___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: LyricHyphen hara-kiri

2013-12-21 Thread Kieren MacMillan
Hi David,I'm curious--how is Mike's solution not adequate as a workaround?You know what’s weird? I looked at it and found gaps in some of the “foobar”s — exactly what this fix/workaround is supposed to eliminate — so I took a screenshot and sent it to Mike:Clearly, there’s a gap in several measures, right?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.Sorry for the noise.Kieren.___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: LyricHyphen hara-kiri

2013-12-21 Thread David Nalesnik
Hi Kieren,


On Sat, Dec 21, 2013 at 1:19 PM, Kieren MacMillan <
kieren_macmil...@sympatico.ca> wrote:

> Hello all,
>
> I’ve been asking around to see if anyone can work on Lyric bounties (e.g.,
> GSoC stuff, plus other features).
>
> This one — LyricHyphen hara-kiri — was one that Mike S. suggested could be
> done in Scheme, so he started it (see attached).
> Can anyone else take it to the goal line?
>
>
I'm curious--how is Mike's solution not adequate as a workaround?

--David
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user