Default fonts on Ubuntu are not everyone’s cup of tea. While there may be many reasons behind that like patent violation issues, user choices and the OS philosophy, I just wanted my fonts to look sharp and crispier like that in Windows. The default slightly blurred over-hinted fonts on Ubuntu didn’t work for me. So here’s everything I did to make the fonts look like I want them to. I am using the LXDE desktop environment on Saucy. My system font size is 9. My laptop is a Sony VAIO SVS13112ENB.
How to get the best sharp font rendering on Ubuntu?
- I set the system font to Ubuntu everywhere with variations like Bold, Regular etc. It does look good and using the same font across the system reduces memory and CPU usage. The package is ttf-ubuntu-font-family.
- The next thing I did was install the Microsoft core fonts package. There might be controversies about using those etc. but they look better. Hands down! Many websites use these fonts as default which helps during browsing. Having them installed also enables me to use the same fonts in Google Docs across different systems. The package to install is ttf-mscorefonts-installer.
- My font dpi is set to 96. To check yours, use:
$ xdpyinfo | grep inch resolution: 96x96 dots per inch
- In order to change the dpi at login, run the following in a startup script:
$ xrandr --dpi 96
- Created a new font configuration file to override almost all other font rendering settings through fontconfig:
File: /etc/fonts/conf.d/99-sharp-fonts.conf
Contents:<!--?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>hintfull</const></edit> <edit name="lcdfilter" mode="assign"><const>lcddefault</const></edit> <edit name="rgba" mode="assign"><const>rgb</const></edit> </match> </fontconfig>
- Made the same changes in a new file for Cairo applications which do not obey fontconfig settings.
File: /etc/X11/Xresources/sharp-fonts
Contents:Xft.antialias: true Xft.hinting: true Xft.hintstyle: hintfull Xft.lcdfilter: lcddefault Xft.rgba: rgb
- Settings in LXDE Start Menu ▸ Preferences ▸ Customize Look and Feel ▸ Font:
//Google Chrome seems to follow this Enable antialiasing: Enabled Enable hinting : Enabled Hinting style : Full Sub-pixel geometry : RGB
- Besides the high quality Ubuntu font family, two other fonts which look stunningly beautiful on Ubuntu are Noto Sans, Open Sans, Arimo and Istok. My personal choice for the desktop is Noto Sans and Terminus for the terminal.
- Logged out and in for the new settings to take effect. Finally I managed to make the fonts look beautiful… my way.
- To verify the system settings, run:
$ xrdb -query | grep Xft
Firefox fonts
To get the best possible rendering from Firefox, go to about:config and set the following
browser.display.auto_quality_min_font_size > 0
References:
One thought on “Font rendering on Ubuntu. My way!”