You are not logged in.

#1 2022-11-09 12:20:33

nikinbaidarr
Member
Registered: 2021-05-06
Posts: 92

[SOLVED] Devanagari font ligatures "shra"/"shri" rendered incorrectly

Some websites in Firefox on Arch Linux do not render the devanagari fonts correctly. Particularly, the glyph known as "Shri" in Sanskrit language is not rendered correctly on Arch. On the first line of this wikipedia page the glyph Shri is rendered  incorrectly as this.. However, the same glyph "Shri", on Windows as well as Linux Mint, in the same wiki page is rendered correctly as this. (in Firefox too).

So I'm thinking this is more of an Arch Specific configuration issue.  I have all the devnagari fonts installed that were installed in my other Linux Mint computer.

"fc-list | grep -i devanagari | nl" output on Linux Mint:

     1  /usr/share/fonts/truetype/noto/NotoSansDevanagari-Bold.ttf: Noto Sans Devanagari:style=Bold
     2  /usr/share/fonts/truetype/lohit-devanagari/Lohit-Devanagari.ttf: Lohit Devanagari:style=Regular
     3  /usr/share/fonts/truetype/noto/NotoSerifDevanagari-Regular.ttf: Noto Serif Devanagari:style=Regular
     4  /usr/share/fonts/truetype/noto/NotoSansDevanagari-Regular.ttf: Noto Sans Devanagari:style=Regular
     5  /usr/share/fonts/truetype/samyak/Samyak-Devanagari.ttf: Samyak Devanagari:style=Regular
     6  /usr/share/fonts/truetype/noto/NotoSerifDevanagari-Bold.ttf: Noto Serif Devanagari:style=Bold

"fc-list | grep -i devanagari | nl" output on Arch Linux:

     1  /home/nikin/.local/share/fonts/NotoSansDevanagari/NotoSansDevanagari-Regular.ttf: Noto Sans Devanagari:style=Regular
     2  /home/nikin/.local/share/fonts/Lohit-Devanagari/Lohit-Devanagari.ttf: Lohit Devanagari:style=Regular
     3  /home/nikin/.local/share/fonts/NotoSansDevanagari/NotoSansDevanagari-Bold.ttf: Noto Sans Devanagari:style=Bold
     4  /home/nikin/.local/share/fonts/NotoSerifDevanagari/NotoSerifDevanagari-Bold.ttf: Noto Serif Devanagari:style=Bold
     5  /home/nikin/.local/share/fonts/Samayak-Devanagari/Samyak Devanagari Regular.ttf: Samyak Devanagari:style=Regular
     6  /home/nikin/.local/share/fonts/NotoSerifDevanagari/NotoSerifDevanagari-Regular.ttf: Noto Serif Devanagari:style=Regular

The LANG variable on both machines is set to "en_UTF-8". I've also updated the font cache with "fc-cache" and done a reboot. How do I get the glyph to be rendered correctly?

Last edited by nikinbaidarr (2022-11-10 13:29:06)

Offline

#2 2022-11-09 13:06:25

seth
Member
Registered: 2012-09-03
Posts: 54,562

Offline

#3 2022-11-09 14:43:51

nikinbaidarr
Member
Registered: 2021-05-06
Posts: 92

Re: [SOLVED] Devanagari font ligatures "shra"/"shri" rendered incorrectly

Running

FC_DEBUG=4 pango-view --font="sans" -t "श्र" | grep family:

shows the fallback font is "FreeSans".

Testing different fonts I found it was "Lohit Devanagari" that produces the expected results.
So as per Fallback font order I put

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<alias>
   <family>sans</family>
   <prefer>
     <family>Lohit Devanagari</family>
   </prefer>
 </alias>
</fontconfig>

in the file ~/.fontconfig/fonts.conf

And yet system continues to use Freesans for that matter.

The output of

$ fc-match -a sans | less | nl | grep Lohit
    20  Lohit-Devanagari.ttf: "Lohit Devanagari" "Regular"

.

Offline

#4 2022-11-09 15:54:57

seth
Member
Registered: 2012-09-03
Posts: 54,562

Re: [SOLVED] Devanagari font ligatures "shra"/"shri" rendered incorrectly

wikipedia wrote:

html, body {
    font-family: sans-serif;
}

Offline

#5 2022-11-09 16:46:43

nikinbaidarr
Member
Registered: 2021-05-06
Posts: 92

Re: [SOLVED] Devanagari font ligatures "shra"/"shri" rendered incorrectly

seth wrote:

    font-family: sans-serif;

Totally forgot about sans-serif. That fixed the original issue with the Wikipedia site amongst others. But if I try to type or copy/paste that letter to something like google docs or overleaf or other local host applications it still gets rendered incorrectly.

Offline

#6 2022-11-09 16:52:03

seth
Member
Registered: 2012-09-03
Posts: 54,562

Re: [SOLVED] Devanagari font ligatures "shra"/"shri" rendered incorrectly

Is there a reason why you keep around https://archlinux.org/packages/extra/an … ree-fonts/ when you don't like it?
It's probably drawn in by /etc/fonts/conf.d/40-nonlatin.conf and/or /etc/fonts/conf.d/69-unifont.conf

Offline

#7 2022-11-09 17:37:58

nikinbaidarr
Member
Registered: 2021-05-06
Posts: 92

Re: [SOLVED] Devanagari font ligatures "shra"/"shri" rendered incorrectly

seth wrote:

Is there a reason why you keep around https://archlinux.org/packages/extra/an … ree-fonts/ when you don't like it?
It's probably drawn in by /etc/fonts/conf.d/40-nonlatin.conf and/or /etc/fonts/conf.d/69-unifont.conf

I can't seem to remove gnu-free-fonts, even as root.

checking dependencies...
error: failed to prepare transaction (could not satisfy dependencies)
:: removing gnu-free-fonts breaks dependency 'ttf-font' required by firefox-developer-edition
:: removing gnu-free-fonts breaks dependency 'ttf-font' required by inkscape

Although I removed the entries from those two files. I could still manually set the font in google docs and libre office but still no luck with other applications such as overleaf amongst others.

Offline

#8 2022-11-09 20:15:53

seth
Member
Registered: 2012-09-03
Posts: 54,562

Offline

#9 2022-11-10 03:09:53

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,144

Re: [SOLVED] Devanagari font ligatures "shra"/"shri" rendered incorrectly

$ pkg-list_providers ttf-font
ttf-font extra/gnu-free-fonts
ttf-font extra/noto-fonts
ttf-font extra/ttf-bitstream-vera
ttf-font extra/ttf-croscore
ttf-font community/ttf-dejavu
ttf-font community/ttf-droid
ttf-font community/ttf-ibm-plex
ttf-font community/ttf-liberation

CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#10 2022-11-10 05:11:03

nikinbaidarr
Member
Registered: 2021-05-06
Posts: 92

Re: [SOLVED] Devanagari font ligatures "shra"/"shri" rendered incorrectly

Okay so removing free fonts fixed the issue for everything except my terminal. I'm using st and have used the font2 patched and loaded the desired font in there but the glyph doesn't render properly in my terminal window.

Offline

#11 2022-11-10 07:34:13

seth
Member
Registered: 2012-09-03
Posts: 54,562

Re: [SOLVED] Devanagari font ligatures "shra"/"shri" rendered incorrectly

Ftr. https://st.suckless.org/patches/font2/
Please post your st config.h and explain "doesn't render properly" - you're probably trying to use a non-fixed width font?

fc-list :mono | grep -i devanagari

Offline

#12 2022-11-10 09:53:52

nikinbaidarr
Member
Registered: 2021-05-06
Posts: 92

Re: [SOLVED] Devanagari font ligatures "shra"/"shri" rendered incorrectly

seth wrote:

Please post your st config.h

st config.h is around 500 lines long so just posting the part relevant to just fonts:

static char *font = "Source Code Pro Medium:size=10";
static char *font2 = "Noto Sans Devanagari:size=10";
seth wrote:

  explain "doesn't render properly" - you're probably trying to use a non-fixed width font?

"doesn't render properly" as in what was happening before. The ligature is displayed incorrectly as in the wiki page above. The other devanagari text is rendered properly and correctly.
Furthermore,

fc-list :mono | grep -i devanagari

gives nothing.
Although,

$ FC_DEBUG=4 pango-view --font="mono" -t "श्र" | grep family:

Shows:

        family: "Noto Sans Devanagari"(s)
        family: "Noto Sans Devanagari"(s)

And produces the renders the shri glyph as expecrted.

Offline

#13 2022-11-10 12:24:57

seth
Member
Registered: 2012-09-03
Posts: 54,562

Re: [SOLVED] Devanagari font ligatures "shra"/"shri" rendered incorrectly

How can it look the same after removing the causing GNU FreeFonts?

FC_DEBUG=4 pango-view --font="Source Code Pro" -t "श्र" | grep family:

Since st by default uses the fontconfig substitution and you're apparently just adding the Devanagari font, how does it behave w/o the patch (now)?
Do other Devanagari *ligatures* render fine?

Offline

#14 2022-11-10 13:17:31

nikinbaidarr
Member
Registered: 2021-05-06
Posts: 92

Re: [SOLVED] Devanagari font ligatures "shra"/"shri" rendered incorrectly

seth wrote:

How can it look the same after removing the causing GNU FreeFonts?

I did indeed remove the GNU free fonts, but there were more fonts installed as dependencies on my system:

pacman -Q | grep -i font | nl
    1    adobe-source-code-pro-fonts 2.038ro+1.058it+1.018var-1
    2    cantarell-fonts 1:0.303.1-1
    3    fontconfig 2:2.14.1-2
    4    gsfonts 20200910-2
    5    libfontenc 1.1.6-1
    6    libxfont2 2.0.6-1
    7    noto-fonts 20220810-1
    8    xorg-fonts-encodings 1.0.6-1
seth wrote:
FC_DEBUG=4 pango-view --font="Source Code Pro" -t "श्र" | grep family:

As well as --font="Source Code Pro Medium" results in expected rendering.

seth wrote:

Since st by default uses the fontconfig substitution and you're apparently just adding the Devanagari font, how does it behave w/o the patch (now)?

Same thing with and without the patch. Although I've added this to my fontconfig:

<alias>
   <family>monospace</family>
   <prefer>
     <family>Source Code Pro Medium</family>
   </prefer>
 </alias>
<alias>
   <family>sans-serif</family>
   <prefer>
     <family>Noto Sans</family>
     <family>Noto Sans Devanagari</family>
   </prefer>
 </alias>
seth wrote:

Do other Devanagari *ligatures* render fine?

No they don't. While other devanagari glpyhs render properly, *ligatures* don't.  I didn't notice it until you pointed it out. Ligatures are working fine outside st.

Offline

#15 2022-11-10 13:27:21

nikinbaidarr
Member
Registered: 2021-05-06
Posts: 92

Re: [SOLVED] Devanagari font ligatures "shra"/"shri" rendered incorrectly

You know what. It's not worth bothering about that font in the terminal. I don't even use it there so be it. I wanted it to render properly in browsers and other web applications which it is now.

I cannot thank you enough for your time. Thank you so much! I'll mark this thread as solved and also change the title to something more general so others can find it if they're having similar issues.

Thanks agian!

Offline

Board footer

Powered by FluxBB