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: Alexander Kobel
Subject: Re: Character encoding / poor man's letterspacing
Date: Tue, 12 Mar 2019 14:54:18 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.3

Hi,

On 12.03.19 10:43, Urs Liska wrote:
Am 12.03.19 um 01:14 schrieb Aaron Hill:
On 2019-03-11 3:40 pm, David Kastrup wrote:
Urs Liska <address@hidden> writes:
[...]

Also, I should have been clear before.  David's code should work for most cases.  I was just being pedantic that /./ would not work if the input has combining characters.  For instance, if you type U+0308 (Combining Diaeresis) after an 'a', you'll get an ä.  But the simple regex would not treat that as a single grapheme.  The result would be "T a ̈ s t".

I did understand it that way, and it would not be an issue in the project I'm working on. There it's just some umlauts.

given that Aaron, my undisputed hero of Lily-UTFxy-workarounds, is active in this thread: I'm surprised to see no mention of his wonderful example of such a workaround from

  https://lists.gnu.org/archive/html/lilypond-user/2018-10/msg00473.html

IIRC, the essentials of the approach is to encode stuff as UTF-32 (more or less brute force), and handle individual characters as chunks of 4 consecutive bytes / 0..255-integers in a list. It's not the ultimate solution to all imaginable troubles with encodings, but should be good enough for almost every *practical* use case.

In his modified center-lyrics-ignoring-punctuation.ily from that thread, you'll find the two main utility functions as string->utf32 and utf32->string. I presume you could call string->utf32, slice in a '(0 0 0 32) after each 4 entries, convert back via utf32->string, et voilà.


HTH,
Alex

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


reply via email to

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