5

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.)

mrdaliri
  • 1,013

2 Answers2

3

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.

13rac1
  • 972
  • 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 01 '18 at 11:29
0

Per this answer you can simply find and download a TTF file (example) that contains the glyphs that you need. Double-click to open the font file in the font viewer, and then click the install button.

You don't need to manually set any config up - the system will automatically fall back to your font if the default font is missing glyphs that your new font contains.

joe
  • 129