You are not logged in.

#1 2022-03-21 05:33:33

dhplakmal
Member
Registered: 2022-03-20
Posts: 4

[SOLVED] Adding 'Noto Sans Sinhala' as the system default Sinhala font

Hello,
I'm trying to change the default LKLUG Sinhala font to Noto Sans Sinhala because LKLUG is a bit outdated and also difficult to read web content with that font. I tried messing around with the user font config file ($HOME/.config/fontconfig/fonts.conf) but no luck. It does apply the font but partially. What I mean is after the conf change when I browse the web, part of the Sinhala content is still rendered in LKLUG some parts are in Noto Sans Sinhala. Not consistent (tested on both Firefox and Brave, behaviour is same on both browsers). I would like to know a way to fix this if anyone knows.

This is the content of my "$HOME/.config/fontconfig/fonts.conf" file.

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<match target="pattern">
 <test name="lang" compare="contains">
  <string>si</string>
 </test>
 <edit mode="prepend" binding="strong" name="family">
  <string>Noto Sans Sinhala</string>
 </edit>
</match>
<dir>~/.fonts</dir>
</fontconfig>

Last edited by dhplakmal (2022-03-22 15:56:27)

Offline

#2 2022-03-21 07:10:41

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

Re: [SOLVED] Adding 'Noto Sans Sinhala' as the system default Sinhala font

language tests aren't reliable, https://wiki.archlinux.org/title/Font_c … les#Arabic

The above should work for most applications but some applications like Chromium do not work with the language match test. If you find some applications not using your selected fonts, you can use the below alias and prefer tags which seems to work.

Offline

#3 2022-03-21 17:17:45

dhplakmal
Member
Registered: 2022-03-20
Posts: 4

Re: [SOLVED] Adding 'Noto Sans Sinhala' as the system default Sinhala font

Thanks, tried the one with the alias and prefer tags, provided on the wiki. This time the results are somewhat better. Now 95% is rendered with the desired font and the rest is still rendered with the same old font. (Previously it was like 70% & 30%).

Offline

#4 2022-03-21 17:51:42

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

Re: [SOLVED] Adding 'Noto Sans Sinhala' as the system default Sinhala font

fc-match -s ':charset=1234'
fc-list ':charset=1234'

Replace "1234" w/ the actual utf-8 codepoint of a glyph that isn't resolved to Noto Sans Sinhala (sould be some 0dxx, https://en.wikipedia.org/wiki/Sinhala_(Unicode_block) )

Offline

#5 2022-03-22 05:37:06

dhplakmal
Member
Registered: 2022-03-20
Posts: 4

Re: [SOLVED] Adding 'Noto Sans Sinhala' as the system default Sinhala font

I combined both types of configs (alias prefer and select) as below. Now I'm getting the output I wanted. Thanks

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
 <!-- Fallback fonts preference order -->
 <alias>
  <family>sans-serif</family>
  <prefer>
   <family>Noto Sans</family>
   <family>Open Sans</family>
   <family>Droid Sans</family>
   <family>Roboto</family>
   <family>Tholoth</family>
   <family>Noto Sans Sinhala</family>
  </prefer>
 </alias>
 <alias>
  <family>serif</family>
  <prefer>
   <family>Noto Serif</family>
   <family>Droid Serif</family>
   <family>Roboto Slab</family>
   <family>Tholoth</family>
   <family>Noto Sans Sinhala</family>
  </prefer>
 </alias>
 <alias>
  <family>monospace</family>
  <prefer>
   <family>Noto Sans Mono</family>
   <family>Inconsolata</family>
   <family>Droid Sans Mono</family>
   <family>Roboto Mono</family>
  </prefer>
 </alias>
 <match target="pattern">
  <test name="lang" compare="contains">
   <string>si</string>
  </test>
  <edit name="family" mode="prepend" binding="strong">
   <string>Noto Sans Sinhala</string>
  </edit>
 </match>
 <dir>~/.fonts</dir>
</fontconfig>

Offline

#6 2022-03-22 06:57:59

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

Re: [SOLVED] Adding 'Noto Sans Sinhala' as the system default Sinhala font

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

Board footer

Powered by FluxBB