NetBSD-Users archive

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

Re: Fontconfig and variable fonts



On Tue 28 May 2024 at 16:38:04 +0300, Valery Ushakov wrote:
> Arch wiki has e.g. (haven't tried it myself):
> 
>   https://wiki.archlinux.org/title/Font_configuration/Examples#Enable_typographic_features

Ah, interesting find, thank you! "Features" are somewhat similar to
"variables". So one hope that somehow this can be specified in a font
name, so it can be used in naive programs that only really know about a
font name and perhaps a size.

The font I am interested in by way of example is Recursive, from
https://www.recursive.design/ . It has 5 font "variations" (where you
can select some value along an interval of an "axis") and some 24
"features" (essentially boolean variations, one can think).

The two programs I'm (again by ways of example) I'm interested in are
XTerm and Vim (gtk2 or 3). It turns out that XTerm uses fontconfig
directly but Vim uses pango. And they have different syntax for font
names...

E.g. font size: "FooFont-10" for fontconfig; "FooFont 10" for pango.
"FooFont:matrix=0.9 0 0 1" for setting a transformation matrix in
fontconfig. This doesn't seem to be possible with pango.

For font variations,
https://docs.gtk.org/Pango/type_func.FontDescription.from_string.html
says it's "Cantarell Italic Light 15 `wght`=200", but that isn't true.
It is actually "Cantarell Italic Light 15 @wght=200" as can be in the
pango source code if you search for pango_font_description_from_string.

pango-view --text "Hello, world!" --font 'Recursive 30 @CASL=0.5,slnt=-20'

seems to work, but if I use such a font name in Vim

:set guifont=Recursive\ 10\ @slnt=-10,wght=800

then somehow only the first variation seems to be taken into account.

Maybe the variations can be specified in the xml fontconfig file in a
way similar to the features...

> -uwe
-Olaf.
-- 
___ Olaf 'Rhialto' Seibert                            <rhialto/at/falu.nl>
\X/ There is no AI. There is just someone else's work.           --I. Rose

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index