Fontconfig – How to Alias Bold Weight of One Font Family to Another

fontconfigfonts

I have one font — PragmataPro. The bold version of this font lies in another family, Essential PragmataPro. I would like applications to use Essential PragmataPro Bold when it tries to use PragmataPro Bold.

Additionally, a bold weight of PragmataPro does not exist, and a regular weight of Essential PragmataPro does not exist. The first remark is the source of my problem.

This is what I have tried:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <match target="pattern">
        <test name="family"><string>PragmataPro</string></test>
        <test name="weight" compare="more_eq"><const>bold</const></test>
        <edit name="family" mode="assign"><string>Essential PragmataPro</string></edit>
        <edit name="embolden" mode="assign"><bool>false</bool></edit>
    </match>
</fontconfig>

All it does is apply DejaVu Sans bold.

Any suggestions?

Best Answer

Adding binding="strong" to your first edit line like so:

<edit name="family" mode="assign" binding="strong"><string>Essential PragmataPro</string></edit>

should do the trick. It also seems that your second edit line:

<edit name="embolden" mode="assign"><bool>false</bool></edit>

isn't needed.