How can I make Devanagari fonts render properly in Ubuntu 16.04?

Devanagari fonts appear broken like this:

It should appear this way

I have the same problem in browsers and office applications.

Is there any way to fix it?


Solution 1:

Install the fonts-deva package, if you haven't already done so. Then create the file ~/.config/fontconfig/conf.d/10-prefer-devanagari.conf with the following contents:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
        <alias>
                <family>serif</family>
                <prefer>
                        <family>Lohit Devanagari</family>
                </prefer>
        </alias>
        <alias>
                <family>sans-serif</family>
                <prefer>
                        <family>Lohit Devanagari</family>
                </prefer>
        </alias>
        <alias>
                <family>monospace</family>
                <prefer>
                        <family>Lohit Devanagari</family>
                </prefer>
        </alias>
</fontconfig>

Solution 2:

Download Google Noto Fonts (choose Noto Sans Devanagari) and add it to Home > .fonts

If .fonts folder is not available in Home folder create it.

.fonts folder will be hidden by default. Use CTRLH to see hidden files and folders before creating a .fonts folder.

You can use other Google Noto Fonts for any Indic language you would like to use.

If you want to have different font weights, choose fonts with those qualities.

This is just one simple way of doing it. There could be a thousand other ways to use Devanagari fonts in Ubuntu.