[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: inter-letter spacing?
From: |
David Kastrup |
Subject: |
Re: inter-letter spacing? |
Date: |
Tue, 16 Jul 2019 01:07:14 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Thomas Morley <address@hidden> writes:
> Am Mo., 15. Juli 2019 um 21:37 Uhr schrieb David Kastrup <address@hidden>:
>>
>> Werner LEMBERG <address@hidden> writes:
>>
>> >> any idea how to realize inter-letter spacing? Has someone already
>> >> written a macro like
>> >>
>> >> \markup { \letter-spacing #0.1 "foobar" }
>> >>
>> >> which should be equivalent to
>> >>
>> >> \markup { \concat { "f" \hspace #0.1
>> >> "o" \hspace #0.1
>> >> ...
>> >> "a" \hspace #0.1
>> >> "r" } }
>> >>
>> >> ? A google search didn't come up with a solution...
>> >
>> > Actually, I wonder whether this is possible at all currently. The
>> > above is a very simplistic solution, completely ignoring kerning,
>> > which should be retained.
>> >
>> > It seems that we would need a Scheme interface to the
>> > `pango_attr_letter_spacing_new' function, which isn't used yet within
>> > LilyPond...
>> >
>> > PS: Right now, I would be thankful for a pointer to this simplistic
>> > solution :-)
>>
>> \markup \override #'(word-space . 0.4)
>> \line { #(map! string (string->list "foobar")) }
>
> This will fail with a pango-error for args like "fööbar":
> (process:11556): Pango-WARNING **: 22:04:29.548: Invalid UTF-8 string
> passed to pango_layout_set_text()
> warning: no glyph for character U+FFFD in font
> `/usr/share/texmf/fonts/opentype/public/tex-gyre/texgyreschola-regular.otf'
>
> With my lily-guilev2 build it works out of the box.
>
> For guilev1 one would likely need something like Arnold's code. Most
> recent version probably here:
> https://archiv.lilypondforum.de/index.php/topic,1152.msg11560.html#msg11560
>
> Maybe something newer/superior out there?
Well, not particularly pretty...
\markup \override #'(word-space . 0.4)
\line { #(string-fold-right
(lambda (new old)
(cond ((char<? new #\200) (cons (string new) old))
((char<? new #\300) (cons new old))
(else (call-with-values
(lambda () (span! char? old))
(lambda (c r) (cons (apply string (cons new c)) r))))))
'() "fööbär")
}
--
David Kastrup