Re: Snippet 888 string, was Re: Lyric centre-on-word / ignore-punctuation bug

2018-02-24 Thread David Wright
On Sat 24 Feb 2018 at 20:27:58 (-0700), madMuze wrote:
> >> What I haven't figured out is why there are two long dashes
> 
> As davidK pointed out, three dash forms are probably desired: the hyphen,
> the N-dash, and the M-dash.

I didn't see him mention the hyphen, but it's all present and correct,
just after the question mark.

> It does look like an extra M-dash at the
> beginning of your string (or is that some character code masquerading as a
> dash?).

No, it's a genuine long dash, sorry, em-dash.

While driving to the Met opera cinema this morning, it occurred to me
why the extra dash was present. It's there because, just like Harm's
typographer’s single quote, someone added it to the beginning of the
string thinking it wasn't there; but it already was—in disguise.

> The space is there, not for the dash, but (I believe) in case one
> might enter "lyricSyllable " in quotes and including a space. Having the
> space character in space-set thus causes the space width to be ignored on
> centering.

I would have thought one would want the space to be treated like
a letter. This snippet is designed to treat a string like spqr—
as if it was spqr (with respect to centering). If you go to the
bother of adding space to make "  spqr—" and then centre it as if
it were spqr, the space has achieved nothing. OTOH treating space
as a letter makes it centre like xxspqr, which pushes spqr rightwards.

> For what it’s worth, I use this string for space-set (in ASCII
> order, if I recall):
>   " !()*,-./:;<>?[]`{|}‚„…‹‘’“”–—› ¡«»¿"
> 
> The obsessively astute will notice a non-breaking space just before the
> inverted bang. One might include numerals, if one wanted a sloppy way to
> indicate stanzas. Since the tilde creates a lyric tie, it is probably better
> left out of space-set.
> 
> This is a lovely and much-appreciated procedure. So long as the space-set
> string could be customized, making this default behavior in a future version
> would indeed contribute to the progress of civilization.

Cheers,
David.

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


Re: Snippet 888 string, was Re: Lyric centre-on-word / ignore-punctuation bug

2018-02-24 Thread David Wright
On Sat 24 Feb 2018 at 16:59:37 (+0100), David Kastrup wrote:
> David Wright  writes:
> 
> > On Sat 24 Feb 2018 at 11:06:20 (+0100), David Kastrup wrote:
> >> Thomas Morley  writes:
> >> 
> >> > 2018-02-24 3:45 GMT+01:00 Kieren MacMillan 
> >> > :
> >> >> Hi all,
> >> >>
> >> >> When a lyric syllable begins with a typographer’s single quote
> >> >> (e.g., ’cause, ’ll, etc.), the "ignore-punctuation" hack doesn't
> >> >> work. Any hints on how to fix this would be appreciated.
> >> >>
> >> >> Thanks,
> >> >> Kieren.
> >> >>
> >> >> %%%  SNIPPET BEGINS
> >> >> \version "2.19"
> >> >>
> >> >
> >> > Only characters from `space-set' are respected by `center-on-word'.
> >> > Extend the given string with "’"
> >> >
> >> >> #(define space-set
> >> >>   (list->char-set
> >> >> (string->list "—.?-;,:“†‘’–— */()[]{}|<>!`~&…")))
> >> >
> >> > #(define space-set
> >> >   (list->char-set
> >> > (string->list "’—.?-;,:“†‘’–— */()[]{}|<>!`~&…")))
> >> >
> >> > works for me.
> >> 
> >> Doesn't really look like dealing sensibly with utf-8.
> >
> > AFAICT the string in the original snippet is
> >
> > —.?-;,:“”‘’–— */()[]{}|<>!`~&…
> 
> I was talking about the code,

I wouldn't know about the code: I'm not familiar with scheme.
The three lines quoted don't exactly look complicated, but I
wouldn't like to judge.

> not the string (which is garbled, sure).

Yes, I've never seen an ungarbled version posted, so I thought
I'd just look at it carefully and see if it was obvious what
it was meant to be. And, as it happened, it was.

> > What I haven't figured out is why there are two long dashes;
> 
> en-dash and em-dash are different code points.

My apologies for being so sloppy as to call an em-dash a long
dash, as opposed to the shorter en-dash. There are still two
of them, as shown by the marked line:

 821120131   1  –
 821220142   1  — ←
 821620181   1  ‘
 821720191   1  ’
 8220201c1   1  “
 8221201d1   1  ”
 823020261   1  …
Scanned 31 Unicode characters with 0 problems
$ 

I didn't bother to annotate the columns as I thought the 2 was
a bit obvious (apart from the fact that the recoded text has
two long dashes in it).

Cheers,
David.

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


Re: Snippet 888 string, was Re: Lyric centre-on-word / ignore-punctuation bug

2018-02-24 Thread madMuze
>> What I haven't figured out is why there are two long dashes

As davidK pointed out, three dash forms are probably desired: the hyphen,
the N-dash, and the M-dash. It does look like an extra M-dash at the
beginning of your string (or is that some character code masquerading as a
dash?). The space is there, not for the dash, but (I believe) in case one
might enter "lyricSyllable " in quotes and including a space. Having the
space character in space-set thus causes the space width to be ignored on
centering. For what it’s worth, I use this string for space-set (in ASCII
order, if I recall):
  " !()*,-./:;<>?[]`{|}‚„…‹‘’“”–—› ¡«»¿"

The obsessively astute will notice a non-breaking space just before the
inverted bang. One might include numerals, if one wanted a sloppy way to
indicate stanzas. Since the tilde creates a lyric tie, it is probably better
left out of space-set.

This is a lovely and much-appreciated procedure. So long as the space-set
string could be customized, making this default behavior in a future version
would indeed contribute to the progress of civilization.

davidC



--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

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


Re: Snippet 888 string, was Re: Lyric centre-on-word / ignore-punctuation bug

2018-02-24 Thread Kieren MacMillan
Hi David(s),

>>> Doesn't really look like dealing sensibly with utf-8.
> I was talking about the code, not the string

There's no question it doesn’t handle UTF-8 sensibly: I had to avoid using it 
for a score a few weeks ago in which I was using a Ukrainian glyph ("backwards 
R").

I would very much appreciate it if Lilypond — via snippet or "base code" — had 
an option to automagically centre lyrics on the "letter" portions (which may 
change with language/alphabet, I suppose).

Best,
Kieren.


Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info


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


Re: Snippet 888 string, was Re: Lyric centre-on-word / ignore-punctuation bug

2018-02-24 Thread David Kastrup
David Wright  writes:

> On Sat 24 Feb 2018 at 11:06:20 (+0100), David Kastrup wrote:
>> Thomas Morley  writes:
>> 
>> > 2018-02-24 3:45 GMT+01:00 Kieren MacMillan :
>> >> Hi all,
>> >>
>> >> When a lyric syllable begins with a typographer’s single quote
>> >> (e.g., ’cause, ’ll, etc.), the "ignore-punctuation" hack doesn't
>> >> work. Any hints on how to fix this would be appreciated.
>> >>
>> >> Thanks,
>> >> Kieren.
>> >>
>> >> %%%  SNIPPET BEGINS
>> >> \version "2.19"
>> >>
>> >
>> > Only characters from `space-set' are respected by `center-on-word'.
>> > Extend the given string with "’"
>> >
>> >> #(define space-set
>> >>   (list->char-set
>> >> (string->list "—.?-;,:“†‘’–— */()[]{}|<>!`~&…")))
>> >
>> > #(define space-set
>> >   (list->char-set
>> > (string->list "’—.?-;,:“†‘’–— */()[]{}|<>!`~&…")))
>> >
>> > works for me.
>> 
>> Doesn't really look like dealing sensibly with utf-8.
>
> AFAICT the string in the original snippet is
>
> —.?-;,:“”‘’–— */()[]{}|<>!`~&…

I was talking about the code, not the string (which is garbled, sure).

> What I haven't figured out is why there are two long dashes;

en-dash and em-dash are different code points.

-- 
David Kastrup

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


Snippet 888 string, was Re: Lyric centre-on-word / ignore-punctuation bug

2018-02-24 Thread David Wright
On Sat 24 Feb 2018 at 11:06:20 (+0100), David Kastrup wrote:
> Thomas Morley  writes:
> 
> > 2018-02-24 3:45 GMT+01:00 Kieren MacMillan :
> >> Hi all,
> >>
> >> When a lyric syllable begins with a typographer’s single quote
> >> (e.g., ’cause, ’ll, etc.), the "ignore-punctuation" hack doesn't
> >> work. Any hints on how to fix this would be appreciated.
> >>
> >> Thanks,
> >> Kieren.
> >>
> >> %%%  SNIPPET BEGINS
> >> \version "2.19"
> >>
> >
> > Only characters from `space-set' are respected by `center-on-word'.
> > Extend the given string with "’"
> >
> >> #(define space-set
> >>   (list->char-set
> >> (string->list "—.?-;,:“†‘’–— */()[]{}|<>!`~&…")))
> >
> > #(define space-set
> >   (list->char-set
> > (string->list "’—.?-;,:“†‘’–— */()[]{}|<>!`~&…")))
> >
> > works for me.
> 
> Doesn't really look like dealing sensibly with utf-8.

AFAICT the string in the original snippet is

—.?-;,:“”‘’–— */()[]{}|<>!`~&…

What I haven't figured out is why there are two long dashes; perhaps
someone added the one at the beginning because they couldn't see
the one in the middle. And why the space after the latter?

The following gives the hex in case this message is garbled.

$ ucount.py /tmp/the-string 
   10   a1   1  LF  
   32  201   1  SPC 
   33  211   1  !   
   38  261   1  &   
   40  281   1  (   
   41  291   1  )   
   42  2a1   1  *   
   44  2c1   1  ,   
   45  2d1   1  -   
   46  2e1   1  .   
   47  2f1   1  /   
   58  3a1   1  :   
   59  3b1   1  ;   
   60  3c1   1  <   
   62  3e1   1  >   
   63  3f1   1  ?   
   91  5b1   1  [   
   93  5d1   1  ]   
   96  601   1  `   
  123  7b1   1  {   
  124  7c1   1  |   
  125  7d1   1  }   
  126  7e1   1  ~   
 821120131   1  –   
 821220142   1  —   
 821620181   1  ‘   
 821720191   1  ’   
 8220201c1   1  “   
 8221201d1   1  ”   
 823020261   1  …   
Scanned 31 Unicode characters with 0 problems
$ 

Cheers,
David.
—.?-;,:“”‘’–— */()[]{}|<>!`~&…
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Lyric centre-on-word / ignore-punctuation bug

2018-02-24 Thread David Kastrup
Thomas Morley  writes:

> 2018-02-24 3:45 GMT+01:00 Kieren MacMillan :
>> Hi all,
>>
>> When a lyric syllable begins with a typographer’s single quote
>> (e.g., ’cause, ’ll, etc.), the "ignore-punctuation" hack doesn't
>> work. Any hints on how to fix this would be appreciated.
>>
>> Thanks,
>> Kieren.
>>
>> %%%  SNIPPET BEGINS
>> \version "2.19"
>>
>
> Only characters from `space-set' are respected by `center-on-word'.
> Extend the given string with "’"
>
>> #(define space-set
>>   (list->char-set
>> (string->list "—.?-;,:“†‘’–— */()[]{}|<>!`~&…")))
>
> #(define space-set
>   (list->char-set
> (string->list "’—.?-;,:“†‘’–— */()[]{}|<>!`~&…")))
>
> works for me.

Doesn't really look like dealing sensibly with utf-8.

-- 
David Kastrup

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


Re: Lyric centre-on-word / ignore-punctuation bug

2018-02-24 Thread Thomas Morley
2018-02-24 3:45 GMT+01:00 Kieren MacMillan :
> Hi all,
>
> When a lyric syllable begins with a typographer’s single quote (e.g., ’cause, 
> ’ll, etc.), the "ignore-punctuation" hack doesn't work. Any hints on how to 
> fix this would be appreciated.
>
> Thanks,
> Kieren.
>
> %%%  SNIPPET BEGINS
> \version "2.19"
>

Only characters from `space-set' are respected by `center-on-word'.
Extend the given string with "’"

> #(define space-set
>   (list->char-set
> (string->list "—.?-;,:“†‘’–— */()[]{}|<>!`~&…")))

#(define space-set
  (list->char-set
(string->list "’—.?-;,:“†‘’–— */()[]{}|<>!`~&…")))

works for me.

Cheers,
  Harm

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


Lyric centre-on-word / ignore-punctuation bug

2018-02-23 Thread Kieren MacMillan
Hi all,

When a lyric syllable begins with a typographer’s single quote (e.g., ’cause, 
’ll, etc.), the "ignore-punctuation" hack doesn't work. Any hints on how to fix 
this would be appreciated.

Thanks,
Kieren.

%%%  SNIPPET BEGINS
\version "2.19"

#(define space-set
  (list->char-set
(string->list "—.?-;,:“”‘’–— */()[]{}|<>!`~&…")))

#(define (width grob text)
  (let* ((X-extent
   (ly:stencil-extent (grob-interpret-markup grob text) X)))
   (if (interval-empty? X-extent)
   0
   (cdr X-extent

#(define (center-on-word grob)
  (let* ((text (ly:grob-property-data grob 'text))
 (syllable (markup->string text))
 (word-position
   (if (string-skip syllable space-set)
   (string-skip syllable space-set)
   0))
 (word-end
   (if (string-skip-right syllable space-set)
   (+ (string-skip-right syllable space-set) 1)
   (string-length syllable)))
 (preword (substring syllable 0 word-position))
 (word (substring syllable word-position word-end))
 (preword-width (width grob preword))
 (word-width (width grob (if (string-null? syllable) text word)))
 (note-column (ly:grob-parent grob X))
 (note-column-extent (ly:grob-extent note-column note-column X))
 (note-column-width (interval-length note-column-extent)))

  (-
(*
  (/ (- note-column-width word-width) 2)
  (1+ (ly:grob-property-data grob 'self-alignment-X)))
preword-width)))

\layout {
  ragged-right = ##f
  line-width = 3\in
}


\score {
  <<
\new Staff { c''2 2 }
\addlyrics { That -- ’ll }
  >>
  \layout {
\context {
  \Lyrics
  \override LyricText.X-offset = #center-on-word
}
  }
}
}

\score {
  <<
\new Staff { c''2 2 }
\addlyrics { That -- ’ll }
  >>
}
%%%  SNIPPET ENDS


Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info


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