how to set Arabic in your Linux machine
Tags: linux, archlinux
Published: 2023-09-11 01:12:12

for a while now I was struggling with Arabic in arch with fonts because it's minimal and has no programs for setting fonts system wide
**arch wiki does't help** I've searched for the solution so many times on the arch wiki but there was not full solution that can help me so here is a one for you 
mkdir ~/.config/fontconfig cd to it and then make a file fonts.conf add this to the file 

```
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
  <!-- Set preferred serif, sans serif, and monospace fonts. -->

 <alias>
   <family>sans-serif</family>
   <prefer>
    <family>Arimo</family>
    <family>Amiri</family>
   </prefer>
  </alias>
  <alias>
   <family>sans-serif</family>
   <prefer>
    <family>Arimo</family>
    <family>Amiri</family>
   </prefer>
  </alias>

  <alias>
   <family>serif</family>
   <prefer>
    <family>Tinos</family>
    <family>Amiri</family>
   </prefer>
  </alias>

  <alias>
   <family>Sans</family>
   <prefer>
    <family>Arimo</family>
    <family>Amiri</family>
   </prefer>
  </alias>

  <alias>
   <family>monospace</family>
   <prefer>
    <family>Cousine</family>
    <family>Amiri</family>
   </prefer>
  </alias>
  <!-- Aliases for commonly used MS fonts. -->
  <match>
    <test name="family"><string>Arial</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Arimo</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>Helvetica</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Arimo</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>Verdana</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Arimo</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>Tahoma</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Arimo</string>
    </edit>
  </match>
  <match>
    <!-- Insert joke here -->
    <test name="family"><string>Comic Sans MS</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Arimo</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>Times New Roman</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Tinos</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>Times</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Tinos</string>
    </edit>
  </match>
  <match>
    <test name="family"><string>Courier New</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Cousine</string>
    </edit>
  </match>
</fontconfig>
```
then you 
```
$sudo fc-cache -fv
```
lets explain a bit 
```
 <alias>
   <family>sans-serif</family>
   <prefer>
    <family>Arimo</family> the Latin font that you prefer 
    <family>Amiri</family> the Arabic font you prefer 
   </prefer>
  </alias>
``` quite not sure if it replaces the Latin font with the Arabic one or not but that what worked for me 
a side note choose carefully the font you use some times the font fails on some places Noto Sans Arabic failed on some Facebook comments 
shout out to https://www.youtube.com/watch?v=qWjz0ewff4s&t
good luck