If you have noticed, on DEs like XFCE and Unity, Google Chrome (and family e.g. Chromium, Opera, Yandex Browser, SRWare Iron …) do not follow font settings. In other words, even if you set the best fonts like Noto Sans or Open Sans in your browser settings, your gmail fonts still look curvy and crooked. The situation doesn’t change even if you use Infinality, because the problem lies with how the browsers choose fonts rather than the font rendering. Continue reading Better Google Chrome fonts on Linux
[Click and view in original size]
This is the follow-up article to my earlier article on font rendering on Ubuntu. While the previous one explains tweaks on default Ubuntu, this article will add to that using infinality patches.
Infinality adds many improvements to font rendering by patching fontconfig and freetype libraries:
- Emboldening Enhancement: Disables Y emboldening, producing a much nicer result on fonts without bold versions. Works on native TT hinter and autohinter.
- Auto-Autohint: Automatically forces autohint on fonts that contain no TT instructions.
- Autohint Enhancement: Makes autohint snap horizontal stems to pixels. Gives a result that appears like a well-hinted truetype font, but is 100% patent-free (as per the dev).
- Customized FIR Filter: Select your own filter values at run-time. Works on native TT hinter and autohinter.
- Stem Alignment: Aligns bitmap glyphs to optimized pixel boundaries. Works on native TT hinter and autohinter.
- Pseudo Gamma Correction: Lighten and darken glyphs at a given value, below a given size. Works on native TT hinter and autohinter.
- Embolden Thin Fonts: Embolden thin or light fonts so that they are more visible. Works on autohinter.
- Force Slight Hinting: Force slight hinting even when programs want full hinting. The local.conf provided (included in infinality-settings fedora package) adds nice improvements on @font-face fonts.
- ChromeOS Style Sharpening: ChromeOS uses a patch to sharpen the look of fonts. Included in the infinality patchset.
[Click and view in original size]
Infinality comes with various configuration options:
- DEFAULT – Default settings. A compromise that should please most people
- OSX – Simulate OSX rendering
- IPAD – Simulate iPad rendering
- UBUNTU – Simulate Ubuntu rendering
- LINUX – Generic “Linux” style – no snapping or certain other tweaks
- WINDOWS – Simulate Windows rendering
- WINDOWS7 – Simulate Windows rendering with normal glyphs
- WINDOWS7LIGHT – Simulate Windows 7 rendering with lighter glyphs
- VANILLA – Just subpixel hinting
- CUSTOM – Your own preferences. Tweak stuff if you know what you are doing
- Infinality styles:
- CLASSIC – Infinality rendering circa 2010. No snapping
- NUDGE – CLASSIC with lightly stem snapping and tweaks
- PUSH – CLASSIC with medium stem snapping and tweaks
- SHOVE – Full stem snapping and tweaks without sharpening
- SHARPENED – Full stem snapping, tweaks, and Windows-style sharpening
- INFINALITY – Settings used by the Infinality developer
- DISABLED – Act as though running without the extra infinality enhancements (just subpixel hinting)
However, regular users don’t really need to understand the details of the improvements. Applying and testing the different font settings are easy. Follow the steps below:
- To install on Ubuntu:
$ sudo add-apt-repository ppa:no1wantdthisname/ppa $ sudo apt-get update $ sudo apt-get install fontconfig-infinality freetype
- Run the following commands to choose and apply a font configuration:
$ sudo /etc/fonts/infinality/infctl.sh setstyle
However, the command doesn’t show all configuration options.
- To take full control, open /etc/profile.d/infinality-settings.sh and search for the string
USE_STYLE. You can set it to any of the configuration options listed above. For example, I use “WINDOWS7LIGHT” with my own customization for extra sharpness. Get it here.
- Remember that you need to logout and login back for the settings to take effect correctly.
At this point, I also set my dots per inch to 128:
$ xrandr --dpi 128
and added the command to a startup script.
To push things further, you can try out the infinality-ultimate patches from bohoomil. However, I faced issues with my Firefox fonts with this patch (this might not happen on all hardware) though the system fonts looked great. In addition, there might be issues downgrading all the packages again. If you still want to go for it:
$ sudo add-apt-repository ppa:rjvbertin/infinaltimate $ sudo apt-get update $ sudo apt-get upgrade
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:
<!--?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.
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
To get the best possible rendering from Firefox, go to about:config and set the following
browser.display.auto_quality_min_font_size > 0