Skip to content

Instantly share code, notes, and snippets.

@Gholamrezadar
Created July 20, 2025 05:35
Show Gist options
  • Save Gholamrezadar/d99adcdac53a48dd5c8a78c490e377bf to your computer and use it in GitHub Desktop.
Save Gholamrezadar/d99adcdac53a48dd5c8a78c490e377bf to your computer and use it in GitHub Desktop.
Change default persian font in Ubuntu
  1. Install the font
sudo apt install fonts-vazirmatn

or download it and place it in ~/.local/share/fonts/ or /usr/share/fonts/truetype/.

  1. Create this file
mkdir -p ~/.config/fontconfig
nano ~/.config/fontconfig/fonts.conf
  1. Paste this in it
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <!-- Prefer Vazirmatn for sans-serif -->
  <match>
    <test name="family" compare="eq">
      <string>sans-serif</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>Vazirmatn</string>
    </edit>
  </match>

  <!-- Force Persian (fa) language to use Vazirmatn -->
  <match>
    <test name="lang" compare="contains">
      <string>fa</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>Vazirmatn</string>
    </edit>
  </match>
</fontconfig>
  1. Reload
fc-cache -f -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment