Replace default devanagari font in Linux

Devanagari text au in foreground and some devanagari props in background

Photo by Kvistholt Photography on Unsplash

Create a file in ~/.config/fontconfig/conf.d/10-devanagari-substitution.conf add put the following content. Create the folders if necessary. Replace the fonts with your fonts.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <match>
        <test name="lang" compare="contains">
            <string>ne</string>
        </test>
        <test name="family">
            <string>sans-serif</string>
        </test>
        <edit name="family" mode="prepend">
            <string>Noto Sans Devanagari</string>
        </edit>
    </match>
    <match>
        <test name="lang" compare="contains">
            <string>hi</string>
        </test>
        <test name="family">
            <string>sans-serif</string>
        </test>
        <edit name="family" mode="prepend">
            <string>Noto Sans Devanagari</string>
        </edit>
    </match>
    <match>
        <test name="lang" compare="contains">
            <string>mr</string>
        </test>
        <test name="family">
            <string>sans-serif</string>
        </test>
        <edit name="family" mode="prepend">
            <string>Noto Sans Devanagari</string>
        </edit>
    </match>
    <match>
        <test name="lang" compare="contains">
            <string>ne</string>
        </test>
        <test name="family">
            <string>serif</string>
        </test>
        <edit name="family" mode="prepend">
            <string>Noto Serif Devanagari</string>
        </edit>
    </match>
    <match>
        <test name="lang" compare="contains">
            <string>hi</string>
        </test>
        <test name="family">
            <string>serif</string>
        </test>
        <edit name="family" mode="prepend">
            <string>Noto Serif Devanagari</string>
        </edit>
    </match>
    <match>
        <test name="lang" compare="contains">
            <string>mr</string>
        </test>
        <test name="family">
            <string>serif</string>
        </test>
        <edit name="family" mode="prepend">
            <string>Noto Serif Devanagari</string>
        </edit>
    </match>
</fontconfig>

If you want to set the same fonts to all the flatpak applications then use the following command:

flatpak override --user --filesystem=xdg-config/fontconfig:ro

You can as well change add the config using flatseal application.