3

Default sans-serif font which is used in system, doesn't have some characters from Middle-Eastern languages. So I want to set a fallback font to be used when some symbols are missing.

AFAIK, it's related to fontconfig and fonts.conf files. Here is my current fonts.conf file:

<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <alias>
        <family>sans</family>
        <prefer>
                <family>FONTNAME</family>
        </prefer>
    </alias>
</fontconfig>

where FONTNAME is the font which have all symbols. It works, but after setting this, the default font disappeared and whole system use FONTNAME as default sans font. (Note that, FONTNAME has latin characters too.)

1

It will be easier to install the Ubuntu package for your needed characters if available: http://packages.ubuntu.com/precise/fonts/

Otherwise, to answer your question, the first font with a matching character/glyph in the preferred list is the font used. If you don't want FONTNAME used as the default everywhere, then you need to add it to the list after the primary. This should work:

<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <alias>
        <family>sans-serif</family>
        <prefer>
                <family>ORIGINAL_SANS_FONT</family>
                <family>YOUR_FONT</family>
        </prefer>
    </alias>
</fontconfig>

I suggest using: sans-serif instead of sans, because it is the actual name in the fontconfig. sans is an alias.

| improve this answer | |
  • This works on my KDE neon 5.13.5 (based on Ubuntu 16.04) to solve an issue with Inkscape failed to choose previously correct sans-serif font family. This issue happened after full upgrading from 5.12.0 and is now solved. Thanks! – Ade Malsasa Akbar Oct 1 '18 at 11:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.