[Fontconfig] rule to exclude certain fonts based on file type and name scheme
Raimund Steger
rs at mytum.de
Mon Sep 2 08:46:48 PDT 2013
Fabian Greffrath wrote:
> Am Montag, den 02.09.2013, 12:10 +0900 schrieb Akira TAGOH:
>> The following rule would behaves similar what you want but only
>> exclude when family is exactly matching with "bad font".
>
> That's how it is currently done. But I want to exclude a whole set of
> fonts that all include the same string in their family names. By now I
> have to exclude all the fonts individually and thus have 10 almost
> identical rules. :/
(1) This is not exactly what you requested, but since on many systems
Type1 fonts are stored in their own directory, e. g.
/usr/share/fonts/X11/Type1 or similar, a <glob> element may be able to
help you. But it matches on the filename, not the family name; often
that's close enough but probably not always.
An example:
<selectfont>
<rejectfont>
<glob>/usr/share/fonts/X11/Type1/cour*</glob>
<glob>/usr/share/fonts/X11/Type1/UT*</glob>
</rejectfont>
</selectfont>
to exclude Type1 Courier and Utopia.
(2) Not very elegant but still possible: Use target="scan" to assign
some bogus family to the fonts (downside is it's going to look ugly in
font pickers, plus I think not a lot of globbing options are available,
just "contains"):
<match target="scan">
<test name="family" compare="contains">
<string>Courier</string>
</test>
<test name="fontformat"><string>Type 1</string></test>
<edit name="family" mode="assign">
<string>__DISABLED_FONT__</string>
</edit>
</match>
A bit more beautiful in pickers -- append a suffix:
<match target="scan">
<test name="family" compare="contains">
<string>Courier</string>
</test>
<test name="fontformat"><string>Type 1</string></test>
<edit name="family" mode="assign">
<plus>
<name>family</name>
<string> (Beware Ugly Font)</string>
</plus>
</edit>
</match>
That way, Type1 .*Courier.* would show as .*Courier.* (Beware Ugly Font)
in pickers.
I wouldn't recommend deleting the "family" property in the cache, one
could think that would help but I just had the strangest results when I
tested it.
(3) You could also add a "fontformat" element to the pattern before the
match (to specifically set TrueType, for example) and leave the cache
alone, but this only works with upcoming 2.11.
-Raimund
--
Worringer Str 31 Duesseldorf 40211 DE home: <rs at mytum.de>
+49-179-2981632 icq 16845346 work: <rs at interface-ag.de>
More information about the Fontconfig
mailing list