Changing default font for Terminal in Ubuntu for Arabic Language

Hi @mhsabbagh and welcome back!

In the long thread about Arabic fonts we never addressed the monospace font. Or maybe we talked about it, but didn’t find a solution.

Are you sure about that? It shouldn’t make a difference, since DejaVu Sans Mono is preferred by fontconfig whether the locale is Arabic or not.

$ fc-match monospace
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"

Ubuntu Mono is set for the Ubuntu desktop in

/usr/share/glib-2.0/schemas/10_ubuntu-settings.gschema.override

provided by the ubuntu-settings package. Applications like gnome-terminal, gedit and gnome-text-editor use that setting by default rather than querying fontconfig.

Possibly we could override the override. Can you please open your ~/.profile file for editing and add this code:

if [ "${LC_CTYPE%_*}" = 'ar' -o "${LANG%_*}" = 'ar' ]; then
    gsettings set org.gnome.desktop.interface monospace-font-name 'DejaVu Sans Mono 12'
else
    gsettings reset org.gnome.desktop.interface monospace-font-name
fi

That ought to make a difference at next login.

I would also appreciate input from the desktop team about the idea. My thought is to let language-selector-common install /etc/profile.d/arabic-monospace.sh with that content. That’s where we have various font configuration tweaks already. One downside is that ~/.config/dconf/user would be manipulated at each login, which means that a user who wants to manually set their favorite monospace font would need to do that with e.g. a gsettings command in ~/.profile rather than just running the command once.

2 Likes