this post was submitted on 09 Nov 2024
49 points (73.3% liked)

Linux

48245 readers
525 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

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 :)

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 4 points 1 week ago (1 children)

Having comprehensive unicode language coverage on a free OS is amazing. I wish the font system was smart enough to hide Noto variants in creative apps but leave them available for browsers. There is a workaround to do that but its a huge pain. I wouldn't delete any files managed by the package system. They will just keep coming back anyway. There are smaller collections of noto fonts in AUR that will satisfy the noto-fonts dependency which should keep KDE Plasma happy. They should be a straight swap if you are comfortable with an AUR dependency for a functioning desktop. The newer one is noto-fonts-main updated this year or there is an older noto-fonts-lite. Not tried either. Usual stuff about backups and taking advice from strangers on the internet.

Segoe might benefit more from the embedded bitmap or autohint settings than the regular open source fonts I am likely to use. Microsoft would optimise the hell out of it to take advantage of their proprietary, patented font rendering system. I wouldn't be surprised if it rendered poorly with distro defaults. Its the kind of blind spot a lot of open source devs and packagers could easily have. Its probably packed full of embedded bitmaps for small sizes and proprietary hinting stuff that linux won't understand.

[–] [email protected] 2 points 1 week ago

Man, this is nice. Having an actual productive conversation on the internet without the battle of upvotes and downvotes. Lol
Anyway, I'll watch the system and see if things are missing after removing those fonts. All what I removed was any

noto sans + <a country whose language I don't speak>