If I want Arial when Helvetica or DejaVu Sans are requested, this configuration works fine:
<match target="pattern">
<test name="family"><string>Helvetica</string></test>
<edit binding="strong" mode="prepend" name="family">
<string>Arial</string>
</edit>
</match>
<match target="pattern">
<test name="family"><string>DejaVu Sans</string></test>
<edit binding="strong" mode="prepend" name="family">
<string>Arial</string>
</edit>
</match>
A quick test:
$ echo Terminus Helvetica | xargs -n1 fc-match
ter-x12n.pcf.gz: "Terminus" "Regular"
arial.ttf: "Arial" "Regular"
But it's way too verbose. The fontconfig manual mentions <or>
element, but it lacks examples of how to use it properly. I've tried to search github
https://github.com/search?q=match+test+or+extension%3Aconf, which returns a bunch of examples very similar to:
<match target="font">
<or>
<test name="family"><string>Nasu</string></test>
<test name="family"><string>NasuM</string></test>
</or>
<edit name="autohint"><bool>false</bool></edit>
</match>
Unfortunately, if I naively rewrite my configuration to
<match target="pattern">
<or>
<test name="family"><string>Helvetica</string></test>
<test name="family"><string>DejaVu Sans</string></test>
</or>
<edit binding="strong" mode="prepend" name="family">
<string>Arial</string>
</edit>
</match>
that breaks all the matchings:
$ echo Terminus Helvetica | xargs -n1 fc-match
arial.ttf: "Arial" "Regular"
arial.ttf: "Arial" "Regular"