lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Character encoding / poor man's letterspacing


From: Urs Liska
Subject: Re: Character encoding / poor man's letterspacing
Date: Tue, 12 Mar 2019 10:41:29 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1


Am 11.03.19 um 23:40 schrieb David Kastrup:
Urs Liska <address@hidden> writes:

Am 11.03.19 um 20:22 schrieb Aaron Hill:
On 2019-03-11 11:30 am, David Kastrup wrote:
Urs Liska <address@hidden> writes:

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.

Any pointer would be appreciated.
Guile-1.8 has only byte strings, not Unicode character strings.
However, the regexp procedures are locale aware, so you can use
something like
/./ isn't smart enough to match Unicode graphemes.  You would need
/\X/, however that is not supported in POSIX ERE.  Neither is the
approximation /\P{M}\p{M}*+/.

I can confirm that the suggestion doesn't work for me, even with the
given example. It's still "T   s t" (see attached).
Do you have an UTF-8 locale set?


I must admit I have never really thought about it, but if you are talking of the operating system and desktop environment that should be good (I don't see any issues with special characters anywhere).

~$ locale
LANG=de_DE.UTF-8
LANGUAGE=de_DE
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=

Or do you have to set a locale specifically for LilyPond? I can't imagine since I usually can engrave anything through it (except now this case with individual characters).

Urs



reply via email to

[Prev in Thread] Current Thread [Next in Thread]