Improve Ubuntu default Sinhala rendering

Thilina wrote this .
ΰ·ƒΰ·’ 🐧 ΰ·ƒΰ·’ 🐧 🐧 ΰ·ƒΰ·’ ΰ·ƒΰ·’ 🐧 ΰ·ƒΰ·’ 🐧 🐧 ΰ·ƒΰ·’ ΰ·ƒΰ·’ 🐧 🐧 ΰ·ƒΰ·’ 🐧 🐧 🐧 🐧 ΰ·ƒΰ·’ 🐧 ΰ·ƒΰ·’ ΰ·ƒΰ·’ 🐧 ΰ·ƒΰ·’ ΰ·ƒΰ·’ 🐧 🐧 ΰ·ƒΰ·’ 🐧 ΰ·ƒΰ·’ ΰ·ƒΰ·’ ΰ·ƒΰ·’ 🐧 ΰ·ƒΰ·’ 🐧 ΰ·ƒΰ·’ ΰ·ƒΰ·’ 🐧

Ubuntu’s default Sinhala font LKLUG’s rendering is broken. The diacritics doesn’t appear in the correct place. Got it fixed by setting Noto Sans Sinhala as the default si font.

Before:

Before the change letters don't render correctly

After:

After the change letters render correctly

  1. Download your favourite sinhala font and add it to /usr/share/fonts/ eg: https://fonts.google.com/noto/specimen/Noto+Sans+Sinhala

  2. Create ~/.config/fontconfig/conf.d/50-custom-si.conf and add below content. (Replace Noto Sans Sinhala with your downloaded font family)

    <?xml version="1.0"?>
    <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
    <fontconfig>
    <match target="font">
        <test name="lang" compare="contains">
            <string>si</string>
        </test>
        <alias>
            <family>sans-serif</family>
            <prefer>
                <family>Noto Sans Sinhala</family>
            </prefer>
        </alias>
    </match>
    
    <match target="font">
        <test name="lang" compare="contains">
            <string>si</string>
        </test>
        <alias>
            <family>serif</family>
            <prefer>
                <family>Noto Sans Sinhala</family>
            </prefer>
        </alias>
    </match>
    </fontconfig>
  3. Re-build font cache by running fc-cache

  4. Can confirm the change by running LANG=si fc-match, you will have to restart most apps to see the change.