[Fontconfig] a warning-free way to apply <edit> to multiple font families?

Jungshik SHIN (신정식) jshin1987 at gmail.com
Wed Aug 13 16:09:58 PDT 2014


This is about https://bugs.freedesktop.org/show_bug.cgi?id=82582.

In the past (e.g. fontconfig 2.7.x), I could use the following to apply
<edit>'s to a group of font families :

<match target="font">
   <test name="family" compare="contains">
        <string>MSung GB18030</string>
        <string>MSung B5HK</string>
    <!-- Turn on light auto-hint -->
    <!-- Turn off sub-pixel anti-aliasing -->
    <edit name="hinting" mode="assign"><bool>true</bool></edit>
    <edit name="autohint" mode="assign"><bool>true</bool></edit>
    <edit name="hintstyle" mode="assign"><const>hintslight</const></edit>
    <edit name="antialias" mode="assign"><bool>true</bool></edit>
    <edit name="rgba" mode="assign"><const>none</const></edit>

With a newer version of fontconfig (e.g. 2.11.1), I got a warning that
'multiple strings test are not supported and may not work as
intended'. Despite that warning, it still works as I intended :-).

Anyway, I wanted to find a warning-free way to express the same in a
compact way (i.e. instead of repeating <edit>'s for each family in the
above group (if it's only 4, it may be ok, but I also have another
group with over 30 families).

My first attempt in the bug 82582 failed (somehow, <edit>'s were
applied to all other fonts NOT listed in <test>). Behdad suggested a
couple of other ways.  The first (in comment 0) of his two
alternatives did not work (edits are not applied to the 4 fonts
above).  The second (in comment #1 of the bug) one worked but I got an
warning about <test> not having 'name'.

I wonder if any on the list knows how to achieve what I want to do
(apply multiple edits to a group of fonts matching family name) in a
compact manner without a warning from fontconfig 2.11.x.

BTW, I also tried replacing 'contains' with 'eq', but didn't change
anything I wrote above.

Thanks in advance,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/fontconfig/attachments/20140813/2cd3ebb7/attachment.html>

More information about the Fontconfig mailing list