8

Is there any way to change the default font for a specific language like Persian/Farsi? I don't want to change the whole font system. I like Ubuntu Font very much but the Persian/Farsi version is very bad and it's difficult to read. I've Unity Tweak Tool installed but it doesn't provide any option, to change the font for a specific language/font Family.

Any help would be greatly appreciated, Thanks a lot. OS: Ubuntu 14.10

8

You can create the file ~/.config/fontconfig/conf.d/90-my-farsi.conf and give it this contents as a starter:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <match target="pattern">
        <test name="lang" compare="contains">
            <string>fa</string>
        </test>
        <test qual="any" name="family">
            <string>sans-serif</string>
        </test>
        <edit name="family" mode="prepend" binding="strong">
            <string>Homa</string>
        </edit>
    </match>

    <match target="pattern">
        <test name="lang" compare="contains">
            <string>fa</string>
        </test>
        <test qual="any" name="family">
            <string>serif</string>
        </test>
        <edit name="family" mode="prepend" binding="strong">
            <string>Homa</string>
        </edit>
    </match>
</fontconfig>

That file results in the Homa font (included in the fonts-farsiweb package) being selected at first hand when Persian is the selected language.

$ LANG=fa_IR fc-match
homa.ttf: "Homa" "Regular"
$ 
  • Thanks a lot, outstanding, if I want to change 'Homa' to something else, I should only replace Homa with another font, right? – bossModus Mar 16 '15 at 18:32
  • @williclarkam: Right (it must be installed, of course). If the default setup is "very bad", as you said, you may want to file a bug about it. As an example, if the above file would be an improvement, it could be included by default. – Gunnar Hjalmarsson Mar 16 '15 at 19:10
  • I've tried your solution. And in Libreoffice it changes the writing font to the proper font that I've chosen when i change my language to persian. but i want to apply this font system-wide, to see the Persian folder names with that font. system still shows Persian names with Ubuntu's default font. do you know how to fix it? – HOS Mar 3 '18 at 19:35
  • @HOS: That's sounds like a different question, so I'd suggest that you submit a new question. When doing so you can refer to this one if appropriate. – Gunnar Hjalmarsson Mar 3 '18 at 20:39
  • 1
    @Anwar: Wouldn't that motivate a separate question? If you submit a question about it, just ping me, and I'll try to help if I can. – Gunnar Hjalmarsson May 30 '18 at 18:52

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.