I have been raging about the font rendering on Linux for years. It just sucks. Font has jagged edges and it looks very weird. I dual-boot with windows and the font there is very nice. So, I asked Claude ai to help me and it did a great job and my font is now is actually better than windows. I wanted to share it with everyone in case you have the same issue with the font on Linux.

Here it is:

  1. First, install required packages:
sudo pacman -S freetype2 cairo fontconfig

2. Install better fonts:

sudo pacman -S ttf-dejavu ttf-liberation noto-fonts ttf-roboto ttf-roboto-mono ttf-droid ttf-opensans ttf-hack ttf-fira-code

I have also installed Segoe ui and Segoe UI Variable fonts and that is what I’m using now.

3. Create or edit the font configuration file:

sudo mkdir -p /etc/fonts/conf.d

sudo nano /etc/fonts/local.conf

4. Add this configuration to local.conf:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="font">
<edit name="antialias" mode="assign">
<bool>true</bool>
</edit>
<edit name="hinting" mode="assign">
<bool>true</bool>
</edit>
<edit name="hintstyle" mode="assign">
<const>hintslight</const>
</edit>
<edit name="rgba" mode="assign">
<const>rgb</const>
</edit>
<edit name="lcdfilter" mode="assign">
<const>lcddefault</const>
</edit>
<edit name="embeddedbitmap" mode="assign">
<bool>false</bool>
</edit>
<edit name="autohint" mode="assign">
<bool>true</bool>
</edit>
</match>
<!-- Increase contrast slightly for all fonts  This is not mandatory and can be commented out-->
<match target="font">
<edit name="weight" mode="assign">
<const>medium</const>
</edit>
</match>
</fontconfig>

5. Create a file for FreeType settings:

sudo nano/etc/profile.d/freetype2.sh

6. Add these export commands (I found it there already, but it was commented out. Just removed the “#”):

export FREETYPE_PROPERTIES="truetype:interpreter-version=40"

7. Enable subpixel rendering: (You might get a message that says “File exist”, that’s ok. It means it was already there)

sudo ln -s /etc/fonts/conf.avail/70-no-bitmaps.conf /etc/fonts/conf.d/

sudo ln -s /etc/fonts/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d/

8. Clear and regenerate font cache:

fc-cache -fv

9. For better Java application fonts:

sudo pacman -S jre-openjdk fontconfig

10. Reboot


Additional optional steps: a. For better Firefox font rendering, in about:config: Set

gfx.font_rendering.cleartype_params.rendering_mode

to 5 (This doesn’t exist in FF. You create it, set it to “number” and give it a value of 5)

Set

gfx.webrender.all

to true

b. If you use VSCode, add to settings.json:

{
"editor.fontFamily": "'Fira Code, 'Droid Sans Mono', 'monospace'",

"editor.fontLigatures": true
}

Truly hope this help someone. Share it with others if you think it will help them.

Thanks :)

  • eldavi@lemmy.ml
    link
    fedilink
    arrow-up
    11
    arrow-down
    2
    ·
    17 days ago

    i never thought to use ai for instruction on system configuration like is and this is brilliant.

    i’ve used it before to give me ideas that serve as a starting place when i work on anything and now i’m going to start doing this when i want to improve my setup; thanks for making me aware of this option.

    • mFat@lemdro.id
      link
      fedilink
      English
      arrow-up
      4
      ·
      16 days ago

      Last night my windows/linux dual boot was broken and i fixed it with instructions from chatgpt. It helped me recreate windows efi partition that i had accidentally deleted.

      • eldavi@lemmy.ml
        link
        fedilink
        arrow-up
        2
        ·
        16 days ago

        i prompted it the other day to find out what paperwork i need for same day registration for the election; i think it’s use for general information is better than for programming.

        • penquin@lemm.eeOP
          link
          fedilink
          arrow-up
          1
          ·
          10 days ago

          They’re freaking fantastic at general info. I almost never Google anything anymore, especially when it needs a long question from me to explain it well. I got a new gas stove and I needed to get rid of a message that was stuck on the screen. ChatGPT gave me the answer right away. Lol

          • eldavi@lemmy.ml
            link
            fedilink
            arrow-up
            1
            ·
            10 days ago

            i suspect that’s why google and microsoft jumped on it so quickly; their search engines become useless compared to chatgpt and i wonder how they’re going to enshitify it in the future to squeeze out more profits.

    • penquin@lemm.eeOP
      link
      fedilink
      arrow-up
      1
      ·
      10 days ago

      So glad this helped. I use AI a lot for many things, especially those things that require a detailed explanation from me (which googling normally doesn’t get right). It is like talking to a super duper googler who can search the whole web for you in seconds and put together a good answer. I’ve had Claude and chatGPT help me fix so many critical issues on my distro. They almost always get it right. I also use them to generate any reparative code that I need. I also make them do all css and HTML (no one has time to for that shit. Lol). They also help with producing logic if you’re stuck on a part of your project. Even if they don’t get it right, they give you a good explanation and and a better idea on what to do. One thing they all failed at 100% at a time is negative unit tests. For some reason, I’ve never been able to get them to give me one successful negative test.

      • eldavi@lemmy.ml
        link
        fedilink
        arrow-up
        1
        ·
        10 days ago

        They also help with producing logic if you’re stuck on a part of your project. Even if they don’t get it right, they give you a good explanation and and a better idea on what to do.

        i now use it at the start of every single project and task that i work on.

        • penquin@lemm.eeOP
          link
          fedilink
          arrow-up
          2
          ·
          10 days ago

          Greatly speeds up things. I love it. I’ve been faster at my projects. I had a project at work that would have taken my at least 1.5 months, and I built in 3 weeks.