k...@aspodata.se writes:

> David Kastrup:
>> k...@aspodata.se writes:
>> > David Kastrup:
>> >> k...@aspodata.se writes:
>> > ...
>> >> > BTW, does someone know why add-text-replacements in attached file 
>> >> > doesn't work ?
>> >> >  I got the syntax from:
>> >> > http://www.gnu.org/software/guile/manual/html_node/String-Syntax.html#String-Syntax
>> >> That's the Guile-2.0 manual.  LilyPond uses 1.8 at the moment.
>> > Hmm, so basically it can't be done.
>> Nonsense.  You just need to use octal escapes for the actual UTF-8 byte
>> sequences.  And you'll probably need to revisit that input once
>> Guile-2.0 actually gets used: I don't think there is an obvious
>> "portable" way to do it.
>
> So, if neither of the ;-commented out lines below work, what do I do?
>
> \paper {
>   #(include-special-characters)
>
>   #(add-text-replacements!
>     '(
>       ("100" . "hundred")
>       ("dpi" . "dots per inch")
>       ;(":a" . "\u00E4" )
>       ;(":b" . "\x00\xE4" )
>       ;(":c" . (list->string (\x00 \xE4)) )
>       ;(":d" . $ \markup \char ##x00E4 $ )
>     ))
> }

Uh, do you actually know what UTF-8 is?  \x00\xE4 would rather be
UTF-16BE.  The UTF-8 byte sequence is "\xc3\xa4" instead which works.
\x00 is not a valid number or character and you use it like a function
call because of failing to quote.  #\000 would be a character, but it
needs to be in octal, so we are talking here about
(list->string '(#\303 #\244))

$ is not a valid method to escape from Scheme into LilyPond but rather
the other way round.

#{ \markup \char ##x00e4 #} does not work since markup commands like
\char are only evaluated at markup interpretation time.

You can use (ly:char->utf8 #x00e4) instead.

-- 
David Kastrup

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

Reply via email to