You are not logged in.

#1 Yesterday 13:30:18

Humblenoise4
Member
Registered: 2024-12-21
Posts: 13

Avoiding terrible Arial arabic font in Firefox

Hello,

I have had an issue where many websites like to use this terrible, unreadable font for Arabic content (e.g. Google, Instagram, X etc.). Through the DevTools, I found out that this is just Arial, which apparently has Arabic support. After trying a few things, I have managed to find two solutions that work. The first is just to make an alias in fontconfig that globally overrides Arial in favor of the Noto fonts. The second is just to pick the Noto fonts in Firefox and then disallow the websites from picking their own fonts (otherwise, it doesn't respect the choice).

Neither of these solutions are that great, since they both somehow have much wider implications than what I'm interested in. I was wondering if anyone had any ideas for a cleaner fix.

Thanks!

Offline

#2 Yesterday 13:44:58

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,809

Re: Avoiding terrible Arial arabic font in Firefox

Offline

#3 Yesterday 13:57:01

Humblenoise4
Member
Registered: 2024-12-21
Posts: 13

Re: Avoiding terrible Arial arabic font in Firefox

I have already tried all the config options on that Arch Wiki page, it doesn't fix the issue. I think maybe doing it on the basis of the lang tag doesn't work, because often there is mixed content. So really, it'd somehow have to happen on the basis of the glyphs. But I am really not sure.

It also seems to be something that the websites decide to some extent. As mentioned, many websites use Arial for Arabic, but Wikipedia, for example, uses a super nice and readable font.

As far as the specific Arial font, I actually don't know. I just noticed that I have both the ttf-liberation package installed and ttf-ms-fonts, so I'm unsure where it comes from.

Offline

#4 Yesterday 14:06:13

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,809

Re: Avoiding terrible Arial arabic font in Firefox

fc-match -s Arial

happen on the basis of the glyphs

https://bbs.archlinux.org/viewtopic.php … 8#p2275888

Offline

#5 Yesterday 14:53:24

Humblenoise4
Member
Registered: 2024-12-21
Posts: 13

Re: Avoiding terrible Arial arabic font in Firefox

I tried adding the following to my fontconfig based on the link, but it did not fix the issue, it still uses Arial on the same webpages. Am I doing something wrong? Thanks.

  <match target="scan">
    <test name="family" compare="contains">
      <string>Arial</string>
    </test>
    <edit name="charset" mode="assign" binding="same">
      <minus>
        <name>charset</name>
        <charset>
          <range>
            <int>0x0600</int>
            <int>0x06ff</int>
          </range>
        </charset>
      </minus>
    </edit>
  </match>

Offline

#6 Yesterday 15:09:10

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,809

Re: Avoiding terrible Arial arabic font in Firefox

Not necessarily,

This did not work in every program, for example it worked for xfce4-terminal but not alacritty (even after a reboot).

and mozilla even uses their own fontconfig parser.

fc-match -s :charset=0x0627

Offline

#7 Yesterday 15:20:31

Humblenoise4
Member
Registered: 2024-12-21
Posts: 13

Re: Avoiding terrible Arial arabic font in Firefox

Hmm, that's odd..

I mean, it's not as though it totally ignores my fontconfig. As mentioned, adding the following does actually make it do what I want (though at the cost of replacing Arial everywhere):

<alias>
  <family>Arial</family>
  <prefer>
    <family>Noto Sans</family>
    <family>Noto Naskh Arabic</family>
  </prefer>
</alias>

But I guess it seems that Firefox respects some things in fontconfig and not others.

Last edited by Humblenoise4 (Yesterday 15:22:37)

Offline

Board footer

Powered by FluxBB