Request better Arabic font for Ubuntu 20.04

I ask for add better Arabic font for Ubuntu 20.04 for make it the most quality Ubuntu version ever
I am change font every time i install ubuntu (KDE neon has font installed and set for arabic by default) by add new file to /etc/fonts/conf.d/ named 99-arabic.conf content

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>

<!-- Default font (no fc-match pattern) -->
<match>
  <edit mode="prepend" name="family">
  <string>Noto Sans</string>
  </edit>
</match>

<!-- Default font for the ar_SA locale (no fc-match pattern) -->
<match>
  <test compare="contains" name="lang">
  <string>ar</string>
  </test>
  <edit mode="prepend" name="family">
  <string>Noto Sans Arabic UI</string>
  </edit>
</match>

<!-- Default sans-serif font -->
<match target="pattern">
  <test qual="any" name="family"><string>sans-serif</string></test>
  <!--<test qual="any" name="lang"><string>ar</string></test>-->
  <edit name="family" mode="prepend" binding="same"><string>Noto Sans</string></edit>
</match>

<!-- Default serif fonts -->
<match target="pattern">
  <test qual="any" name="family"><string>serif</string></test>
  <edit name="family" mode="prepend" binding="same"><string>Noto Serif</string></edit>
  <edit name="family" mode="append" binding="same"><string>Noto Sans Arabic</string></edit>
  <edit name="family" mode="append" binding="same"><string>Noto Sans Arabic UI</string></edit>
</match>

<!-- Default monospace fonts -->
<match target="pattern">
  <test qual="any" name="family"><string>monospace</string></test>
  <edit name="family" mode="prepend" binding="same"><string>Noto Sans Arabic</string></edit>
  <edit name="family" mode="append" binding="same"><string>Noto Sans Arabic UI</string></edit>
</match>

<!-- Default DejaVu Serif fonts -->
<match target="pattern">
  <test qual="any" name="family"><string>DejaVu Serif</string></test>
  <edit name="family" mode="assign" binding="strong"><string>Noto Sans Arabic</string></edit>
  <edit name="family" mode="assign" binding="strong"><string>Noto Sans Arabic UI</string></edit>
</match>

  <!-- Default DejaVu Sans fonts -->
<match target="pattern">
  <test qual="any" name="family"><string>DejaVu Sans</string></test>
  <edit name="family" mode="assign" binding="strong"><string>Noto Sans Arabic</string></edit>
  <edit name="family" mode="assign" binding="strong"><string>Noto Sans Arabic UI</string></edit>
</match>

<!-- Fallback fonts preference order -->
<alias>
  <family>sans-serif</family>
  <prefer>
  <family>Noto Sans</family>
  <family>Open Sans</family>
  <family>Droid Sans</family>
  <family>Ubuntu</family>
  <family>Roboto</family>
  <family>NotoSansCJK</family>
  <family>Noto Arabic</family>
  <family>Noto Sans Arabic UI</family>
  </prefer>
</alias>
<alias>
  <family>serif</family>
  <prefer>
  <family>Noto Serif</family>
  <family>Droid Serif</family>
  <family>Roboto Slab</family>
  <family>Noto Sans Arabic</family>
  </prefer>
</alias>
<alias>
  <family>monospace</family>
  <prefer>
  <family>Inconsolatazi4</family>
  <family>Ubuntu Mono</family>
  <family>Droid Sans Mono</family>
  <family>Roboto Mono</family>
  <family>Noto Sans Arabic</family>
  </prefer>
</alias>
<alias>
  <family>DejaVu Serif</family>
  <prefer>
  <family>Inconsolatazi4</family>
  <family>Ubuntu Mono</family>
  <family>Droid Sans Mono</family>
  <family>Roboto Mono</family>
  <family>Noto Sans Arabic</family>
  </prefer>
</alias>
<alias>
  <family>DejaVu Sans</family>
  <prefer>
  <family>Inconsolatazi4</family>
  <family>Ubuntu Mono</family>
  <family>Droid Sans Mono</family>
  <family>Roboto Mono</family>
  <family>Noto Sans Arabic</family>
  </prefer>
</alias>

<dir>~/.fonts</dir>
</fontconfig>

maybe there better :thinking:
I suggest font Noto Sans Arabic it opensource and modern
there Ubuntu Arabic font ( used in https://alusus.org/Documents/srt-reference.ar.html ) but it in beta i think
some conversations about ubuntu font in small Arabic community:

4 Likes

I cannot get any reply :frowning_face:
release of GNOME 3.34 support RTL languages in Console/Terminal

@gunnarhj Is this something feasible to do in language-selector?

Possibly. And/or the seed for the ISO.

But to replace the default font for such a widely used script, I would like to see more input from Arabic speaking users first.

1 Like

What about Google’s noto-naskh-arabic (the default arabic font in Android)?
I find it to be the best Arabic font ever. but i’m not sure about its license

It good too and open font under OFL-1.1
But I don’t think it can be smaller to Ubuntu font
And it doesn’t support UI fonts
https://fontinfo.opensuse.org/fonts/NotoNaskhArabicRegular.html

Ubuntu Arabic font was beautiful font but Canonical discontinue it

Both Noto Sans Arabic and Noto Naskh Arabic are in the archive already, so license is not a problem.

There is a Noto Naskh Arabic UI font available, so it seems it does.

As regards configuration, I would prefer something simpler than proposed in the start of this topic.

@xlmnxp and @alawami-az: It would be great if you could help test by taking these measures:

  1. Install the related packages:

    sudo apt install fonts-noto-core fonts-noto-ui-core
    
  2. Edit the /etc/fonts/conf.avail/64-language-selector-prefer.conf file so it looks like this:

    <?xml version="1.0"?>
    <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
    <fontconfig>
    	<alias>
    		<family>sans-serif</family>
    		<prefer>
    			<family>Noto Sans CJK JP</family>
    			<family>Noto Sans CJK KR</family>
    			<family>Noto Sans CJK SC</family>
    			<family>Noto Sans CJK TC</family>
    			<family>Noto Sans CJK HK</family>
    			<family>Lohit Devanagari</family>
    			<family>Noto Sans Arabic UI</family>
    		</prefer>
    	</alias>
    	<alias>
    		<family>serif</family>
    		<prefer>
    			<family>Noto Serif CJK JP</family>
    			<family>Noto Serif CJK KR</family>
    			<family>Noto Serif CJK SC</family>
    			<family>Noto Serif CJK TC</family>
    			<family>Lohit Devanagari</family>
    			<family>Noto Sans Arabic</family>
    		</prefer>
    	</alias>
    	<alias>
    		<family>monospace</family>
    		<prefer>
    			<family>Noto Sans Mono CJK JP</family>
    			<family>Noto Sans Mono CJK KR</family>
    			<family>Noto Sans Mono CJK SC</family>
    			<family>Noto Sans Mono CJK TC</family>
    			<family>Noto Sans Mono CJK HK</family>
    			<family>Noto Sans Arabic</family>
    		</prefer>
    	</alias>
    </fontconfig>
    

Would that be sufficient to get a decent rendering of Arabic?

1 Like

@seb128: This discussion makes me think that this change would be a good idea. It would add 12 MB to the ISO. The fonts-noto source package seems to be in main already. What do you think?

Sorry but I don’t know enough about fonts to have an opinion there. If we don’t install the langpacks for those language is there really an interest to have the font preinstalled?

Fonts are used also for rendering web pages and documents, so even without language packs fonts matter. (And we do provide Arabic language packs. And we already ship a font for Arabic on the ISO - this discussion is about replacing it with a better one.)

fonts-noto-{,ui-}core includes fonts for many other scripts besides Arabic, while fonts-kacst{,-one} is for Arabic only. So you could argue that we would add some not-so-important fonts. OTOH Arabic is a widely used script, and improving the rendering of that script may be sufficient to justify those 12 MB archive size.

As a side effect we would provide high quality fonts for quite a few other scripts, which would allow us to stop language-selector-common from pulling certain fonts. (But I haven’t looked into that yet.)

Would that be sufficient to get a decent rendering of Arabic?

Unfortunately this didn’t change the font for me.

It ought to make a difference compared to the default font configuration on Ubuntu. Maybe you had already installed those packages, and don’t notice a difference for that reason?

I thought it may be that so I reverted everything then tried the method [xlmnxp] mentioned and it worked (though it breaks some English fonts like in vs code and firefox tab titles). I then reverted to default again to try your method a second time your but it didn’t change the font. I may done something wrong, I would wait for xlmnxp and see if it worked for him. It may be because i’m currently running Pop OS distro? it’s Ubuntu based so I don’t think it would matter

Thanks for clarifying.

Well, it’s important that this kind of change is successfully tested on standard Ubuntu before being implemented.

But with that said, I made a mistake. I now realize that more than one of the fonts which come with Ubuntu by default are capable of rendering Arabic script. So the simple approach I proposed, which works fine for e.g. Japanese and Korean, won’t work for Arabic.

For a new attempt it would be good if you could create the file /etc/fonts/conf.d/69-language-selector-ar.conf and give it this contents:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <match target="pattern">
        <test name="lang">
            <string>ar</string>
        </test>
        <test qual="any" name="family">
            <string>serif</string>
        </test>
        <edit name="family" mode="prepend" binding="strong">
            <string>Noto Sans Arabic</string>
        </edit>
    </match> 
    <match target="pattern">
        <test name="lang">
            <string>ar</string>
        </test>
        <test qual="any" name="family">
            <string>sans-serif</string>
        </test>
        <edit name="family" mode="prepend" binding="strong">
            <string>Noto Sans Arabic UI</string>
        </edit>
    </match> 
</fontconfig>

That should make a difference under some Arabic locale.

$ fc-match
DejaVuSans.ttf: "DejaVu Sans" "Book"
$ LC_CTYPE=ar_EG.UTF-8 fc-match
NotoSansArabicUI-Regular.ttf: "Noto Sans Arabic UI" "Regular"
$ LC_CTYPE=ar_EG.UTF-8 fc-match 'serif'
NotoSansArabic-Regular.ttf: "Noto Sans Arabic" "Regular"
1 Like

that work great! better then my solution
there small problem with test when the font sans-serif It will not be correct

<test name="lang">
    <string>ar</string>
</test>

without the test it work fine with Facebook for example

What I propose is a file that would be installed on all Ubuntu machines, and the idea is that it would be in use only if Arabic is set as the display language. The configuration is of such an aggressive nature that the test is necessary. It wouldn’t be reasonable to give Noto Sans Arabic the highest priority for all users.

So, what does your locale look like? Can you please run the

locale

command and let us know what it outputs.

1 Like

change the language to Arabic solve the problem
Is there another way to do that?

Well, yes there is, but the way you did it is the way I had in mind.

I’m thinking of making a change to the language-selector package which would result in the following:

  • If you install Ubuntu, and select Arabic as the language, it will be set up so the first time you boot up and log in, the improved Arabic rendering will be in place.

  • If you have an existing Ubuntu install and install the Arabic language via Manage Install Languages, the related packages will be pulled automatically. But then, in order to get the improved rendering, you’ll need to also change the display language to Arabic the way you just did.

@seb128: As you may have realized already, I found that my initial idea - to improve Arabic rendering for everyone irrespective of locale - was not practicable. Thus there is no need to add the packages to the ISO, and I deleted the platform merge request.

OTOH I submitted a new merge request in order to add the packages to supported. If I understand it correctly that’s necessary for those packages to be pulled by the installer in case of an Arabic install.

1 Like

I think that is right choose
for me removing DejaVu with it core and extra solve the problem
without need to change display language to Arabic :smiley:

sudo apt-get autoremove --purge fonts-dejavu-core fonts-dejavu-extra fonts-dejavu

I liked the fonts suggested by @xlmnxp I think this will improve Arabic interface user experience.
Font looks awesome in the screen shoot shared.

I’ve been using Ubuntu since 2008.

2 Likes