On 2019-03-11 9:56 am, Urs Liska wrote:
Hi,
I've written a poor-man's implementation of a simple \letterspaced
markup command:
#(define-markup-command
(letterspaced layout props text)(markup?)
(let*
((chars (string->list text))
(dummy (ly:message "Chars: ~a" chars))
(spaced-text
(string-join
(map string chars) " ")))
(interpret-markup layout props
(markup spaced-text))))
However, this scrambles umlauts and presumably other UTF-8 characters
as you can see with
{
s1 ^\markup \letterspaced "Täst"
}
=>Chars: (T � � s t)
Obviously the characters are wrongly en/decoded along the way, which
makes me think whether I have simply forgotten an encoding setting
somewhere (although I have no idea where and how I should include
that) or whether that whole routine is totally clumsy.
It is my understanding that proper Unicode support is not in Guile 1.8.
As such, I believe string->list will not understand that multiple bytes
could represent a single codepoint. Also, in Guile characters values of
the form #\nnn are limited to 256 possible values (#\000 to #\377). If
you try to specify a larger value, it just wraps around: (eq? #\012
#\412)
You should be able to achieve what you want, but you'll have to examine
the characters in the list by hand looking for UTF-8 sequences and only
inserting spaces between actual characters. Note that means that you
would need to watch out for combining characters and other special
things.
I do not have the time right now, but I can definitely take a stab at
this later in the day if you would like.
-- Aaron Hill
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user