Score:1

Kannada Font not using the font I suggest

rs flag

I have a file 10-sub.conf which I'm using to substitute font for specific locales: (made using this answer)

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

<!-- file saved in /.config/fontconfig/conf.d -->

<fontconfig>
    <match>
        <test compare="contains" name="lang">
            <string>hi</string>
        </test>
        <edit mode="prepend" name="family">
            <string>Lohit Devanagari</string>
        </edit>
    </match>
    <match>
        <test compare="contains" name="lang">
            <string>gu</string>
        </test>
        <edit mode="prepend" name="family">
            <string>Lohit Gujarati</string>
        </edit>
    </match>
    <match>
        <test compare="contains" name="lang">
            <string>kn</string>
        </test>
        <edit mode="prepend" name="family">
            <string>Lohit Kannada</string>
        </edit>
    </match>
    <alias>
        <family>sans-serif</family>
            <prefer>
                <family>Ubuntu</family>
                <familt>DejaVu Sans</family>
                <family>Liberation Sans</family>
                <family>Noto Sans</family>
                <family>Arial Unicode MS</family>
            </prefer>
    </alias>
    
    <alias>
        <family>serif</family>
            <prefer>
                <family>Noto Serif</family>
                <family>DejaVu Serif</family>
                <family>Liberation Serif</family>
                <family>Noto Serif Devanagari</family>
                <family>Arial Unicode MS</family>
            </prefer>
    </alias>
    
    <alias>
        <family>monospace</family>
            <prefer>
                <family>Ubuntu Mono</family>
                <family>Noto Sans Mono</family>
                <family>DejaVu Sans Mono</family>
                <family>Liberation Mono</family>
                <family>Arial Unicode MS</family>
            </prefer>
    </alias>    
</fontconfig>

The Arial Unicode font is used to capture any font not installed on the system. And this method works for Devanagari and Gujarati, but the Kannada script is always rendered by Arial Unicode instead of Lohit Kannada. I have the Lohit Kannada installed on my system /usr/share/fonts/truetype/lohit-kannada/Lohit-Kannada.ttf

System: Ubuntu 22.04 on GNOME 42.5.

Visiting this website renders Kannada font in Arial Unicode despite providing <match> for it in the file, whereas this website renders Gujarati in Lohit Gujarati (on removing the <match> tag for Gujarati, it is rendered by fallback font for Gujarati)

Output of LC_CTYPE=kn_IN fc-match

Lohit-Kannada.ttf: "Lohit Kannada" "Regular" Hover

Gunnar Hjalmarsson avatar
uz flag
Are you testing it using Firefox packaged as a snap?
Javauser avatar
rs flag
@GunnarHjalmarsson I'm using deb FireFox
Gunnar Hjalmarsson avatar
uz flag
Please edit your question again and show us the output of this terminal command: `LC_CTYPE=kn_IN fc-match`
Javauser avatar
rs flag
@GunnarHjalmarsson done
Javauser avatar
rs flag
@GunnarHjalmarsson I posted a screenshot of what currently the condition of my browser is. The contents are using Arial Unicode, whereas the elements of Firefox are using Lohit Kannada
Score:0
rs flag

I had to remove Arial Unicode from the system to make this work. Then I tweaked the config file a little:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
   <alias>
        <family>sans-serif</family>
        <prefer>
            <family>Ubuntu</family>
            <family>Liberation Sans</family>
            <family>DejaVu Sans</family>
            <family>Noto Sans</family>
            <family>Lohit Devanagari</family>
            <family>Lohit Gujarati</family>          
        </prefer>
    </alias>
    
    <alias>
        <family>serif</family>
        <prefer>
            <family>Noto Serif</family>
            <family>Liberation Serif</family>
            <family>DejaVu Serif</family>
            <family>Noto Serif Devanagari</family>
        </prefer>
    </alias>
    
    <alias>
        <family>monospace</family>
        <prefer>
            <family>Ubuntu Mono</family>
            <family>Noto Sans Mono</family>
            <family>Liberation Mono</family>
            <family>Biryani</family>
        </prefer>
    </alias>    
</fontconfig>

Plus, blacklist FreeSans and FreeSerif because they aren't made for Indic languages, yet the system falls back on them somehow (easily done through Font Manager):

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
  <selectfont>
    <rejectfont>
      <pattern>
        <patelt name="family">
          <string>FreeSerif</string>
        </patelt>
      </pattern>
      <pattern>
        <patelt name="family">
          <string>FreeSans</string>
        </patelt>
      </pattern>
      <pattern>
        <patelt name="family">
          <string>FreeMono</string>
        </patelt>
      </pattern>
    </rejectfont>
  </selectfont>
</fontconfig>
Score:0
uz flag

I suspect that you run Firefox under some other locale (more specifically the LC_CTYPE locale category) but kn_IN, and if that is the case, the first language guarded part of your fontconfig file does not make a difference.

Please try the following:

  • Close Firefox

  • Press Alt+F2 and restart Firefox with this command:

    env LC_CTYPE=kn_IN firefox
    

Hopefully webpages with Kannada script look better now.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.