[Fontconfig] Remap italic to small-caps

Tobias Wolf towolf at gmail.com
Fri Jan 15 08:30:48 PST 2010


Salve,

I have a set of fonts with no italic but a small caps style.

How can I prevent that fontconfig assigns a faux italic and instead
map italic to small-caps, such that small-caps is used whenever italic
is requested?

I tried this in my fonts.conf but it only changes the family name, not
the font used:

<match target="font">
	<test name="family">
		<string>TT2010</string>
	</test>
	<test name="slant">
		<const>roman</const>
	</test>
	<test target="pattern" name="slant" compare="not_eq">
		<const>roman</const>
	</test>
	<edit name="family" mode="assign">
		<string>TT2010 SC</string>
	</edit>
	<edit name="slant" mode="assign">
		<const>oblique</const>
	</edit>
</match>

This gives me

	tt-regular.ttf: "TT2010 SC" "Regular"

and not «tt-sc.ttf» and hence anything italic becomes just plain roman
instead of roman small caps.

What does work is <edit name="file" mode="assign">. But that can’t be
right? Am I misunderstanding the examples in /etc/fonts w.r.t.
re-assigning a family?

--Tobias


More information about the Fontconfig mailing list