How to Make Fonts Look Darker in Linux

Linux distributions use the popular FreeType library to display fonts. Depending on the FreeType configuration, fonts may sometimes look “faint” or washed out in certain Linux distributions and desktop environments. Now, preferences are subjective, so if you like the way fonts look on your PC, that’s all that matters. If you do, however, wish for darker or bolder looking fonts, the steps mentioned below should be helpful.

To make the fonts look darker, we will enable a FreeType feature called “stem darkening” with an environment variable. Some desktop environments like KDE enable it out of the box, while others like GNOME and XFCE don’t. If you use GNOME or another desktop environment besides KDE, keep reading for the instructions. I prefer using the terminal for certain tasks as it is faster and works on any desktop environment. If you’d rather not deal with the terminal (it’s fine, I’ve been there), I’ve also included the GUI steps for GNOME a few paragraphs down.

Open the terminal app and enter the ~/.config/environment.d/ directory. ~ refers to your home directory in Linux.

cd ~/.config/environment.d

If you see a message that the environment.d folder doesn’t exist, create it with the mkdir command.

cd ~/.config
mkdir environment.d
cd environment.d

Now we have to create a .conf file where we will add the environment variable to enable stem darkening. The .conf file can have any name, but I am going with envvars.conf. I will use the nano text editor, but feel free to use any other terminal based editor of your choice, say vim or sed.

nano envvars.conf

If you see some text in the file, this implies it was created before. Add the environment variable for stem darkening below the existing text.

FREETYPE_PROPERTIES="cff:no-stem-darkening=0 autofitter:no-stem-darkening=0"

Save the file. In nano, you press Ctrl + X and Y to confirm.

Log out of your session and log back in, and you should notice a subtle difference in the way fonts are rendered on your desktop.

The default stem darkening settings work well across most font types, sizes, and display resolutions. If you prefer fonts to look a bit more or less emboldened, modify the darkening parameters as detailed in the official FreeType documentation. I prefer bolder fonts, so this is what I have in my envvars.conf file:

FREETYPE_PROPERTIES="cff:no-stem-darkening=0 cff:darkening-parameters=500,400,1000,350,1500,325,2000,300 autofitter:no-stem-darkening=0 autofitter:darkening-parameters=500,400,1000,350,1500,325,2000,300"

Don’t forget to log out of your desktop and log back in to see the changes.

The above changes will apply only to your user account. If you want to enable stem darkening for all users, or if your Linux distro doesn’t use systemd, you will need to edit the /etc/environment file with sudo privilege instead of ~/.config/environment.d/envvars.conf.

sudo nano /etc/environment

Type your password and hit enter. If you are unfamiliar with the terminal, note that passwords don’t appear on screen, not even as asterisks (*****), so don’t worry if you don’t see anything when typing.

When the file opens, add the same environment variable as above and save it.

FREETYPE_PROPERTIES="cff:no-stem-darkening=0 cff:darkening-parameters=500,400,1000,350,1500,325,2000,300 autofitter:no-stem-darkening=0 autofitter:darkening-parameters=500,400,1000,350,1500,325,2000,300"

Beyond stem darkening, you can make fonts look even bolder in apps that are built on the GTK framework, which includes most apps catering to GNOME, XFCE, and Cinnamon desktop environments. Note that this can cause smaller font sizes to look fuzzy and distorted. In a terminal, create a gtk.css file under ~/.config/gtk-3.0 and ~/.config/gtk-4.0. Create the gtk-3.0 and gtk-4.0 folders with mkdir if they don’t exist.

nano ~/.config/gtk-3.0/gtk.css

Add this line to the file and save.

* { font-weight: 500; }

Repeat for gtk-4.0.

nano ~/.config/gtk-4.0/gtk.css

Log out of your desktop and log back in to see the changes.

You can do the above steps in your file manager and text editor apps without typing commands in a terminal. In GNOME, open Files and enter Ctrl + H to show hidden files and folders. Open .config and create the environment.d folder if it doesn’t exist.

Open the text editor app, enter the environment variable properties for stem darkening (from above), and save it as envvars.conf in the environment.d folder. You can similarly create the gtk.css files and save them without using the terminal.

To undo the above changes, open the files and delete or comment the respective lines before logging out of your desktop and logging back in. You can further tweak font settings in GNOME with the gnome-tweaks app from your distro’s official repo. I prefer to disable hinting and enable standard (grayscale) anti-aliasing.

What are your favorite font settings in your Linux desktop? Share in the comments section.

Featured image credit: [email protected] Larry Ewing and The GIMP, Attribution, via Wikimedia Commons

We run automated tests to catch spam, and moderate comments as per our policy. Your comment may take some time to appear below this post.