Even with the latest and greatest release of Ubuntu Gutsy Gibbon, font configuration in Linux can range anywhere from somewhat confusing to downright difficult. On top of the configuration difficulty, nobody can agree on what makes fonts look good. This article aims to document several approaches to font rendering, and the appropriate configuration settings to implement each approach.
I'm not going to go into which approach I think is the best, since that's a fairly personal matter. Each approach has its strengths and weaknesses, and come on, this is Linux. It's not about forcing people into choices they don't want.
First I'll introduce some basic terminology that I will use in this article:
Ubuntu's font configuration system, unfortuately, has many moving parts and complementary configuration tools. The most visible one is the Appearance Preferences control panel, which can be found under the System menu on the desktop. The "Fonts" tab has the various settings related to font rendering.
Aside from this control panel, the font configuration in the Gnome environment is also affected by the fontconfig system. The fontconfig system is built on top of freetype, and allows applications to query the system for fonts based on all kinds of parameters and have the system return available fonts.
This fontconfig is controlled using a configuration file, and this configuration file allows the modification of all types of font rendering properties. Per-user fontconfig configuration information can be written into the .fonts.conf file in a user's home directory.
Next, I'll enumerate what I think are the distinct worth approaches in LInux font rendering:
This approach most closely approximates how the Microsoft Windows "ClearType" system renders fonts. Truetype hinting information is interpreted to the extent supported by the freetype library, and subpixel filtering techniques are applied.
In Ubuntu Gutsy, configuring this approach is most easily configured by choosing the "Subpixel Rendering" option in the Appearances Preferences control panel.
While this method in theory applies all the enhancement technologies that are available on the Ubuntu desktop system, the results can be somewhat unsatisfying. There are many potential reasons for this, though for each particular font the reasons may differ:
This approach is essentially similar the previous one, except that subpixel filtering is not used. This results in slightly lower horizontal resolution, but eliminates the possibility of color fringing that can be introduced when using subpixel rendering.
This approach can be configured using the Advanced section of the Fonts tab of the Appearance Preferences. In the Font Rendering Details window, choose Grayscale under Smoothing, and Full under Hinting.
The pros and cons of this method are similar to the subpixel filtered method. This method trades off subpixel rendering for a more consistent, color-fringing-less result. Depending on your monitor and font, this might produce a more pleasing result.
This approach forgoes any hinting at all. This means that glyph outlines are not adjusted for the pixel grid, and only subpixel filtering is used to smooth edges. This technique produces a less "sharp" output, but one that is more faithful to the original design of each font as the shapes are not distorted. Eariler version of Apple's OS X used this approach.
This approach is configured, again, using the standard Appearance Preferences control panel. Under the Advanced settings of the Fonts tab, choose Subpixel under Smoothing, and None under Hinting.
This method gets correct glyph shapes while trading off sharpness. You will notice that most fonts look significantly more blurry under these settings. Even blurrier than the post 10.3 versions of OS X (see this post for an explanation).
On the plus side, core microsoft fonts will look just as good as "native" linux fonts, and fonts lacking hinting information will also be rendered relatively well.
This method combines the relative outlines faithfulness of the Unhinted approach, but uses the freetype library's autohinter in a limited way to improve results.
The standard Gnome fonts control panel does not allow one to configure the use of the auothinter. This must be configured using the command line:
% sudo dpkg-reconfigure fontconfig-config
Executing this command will result in some dialog questions. In the first question, be sure to choose the "autohinter" option over "native". The remaining two questions can be answered with their default selections.
Finally, use the Gnome Appearance Preferences to set the remaining settings. Under Smoothing, choose Subpixel and under Hinting choose Slight.
This configuration is recommended by David Turner, a large contributor to the freetype library. It combines a relative faithfulness to the shape of the outlines with an added sharpness from the autohinter.
They key to the effect is the combination of the autohinter and subpixel rendering. Subpixel rendering, increases the horizontal resolution of the pixel grid by in theory by 3x (perceived increase is somewhat less, but still significant). Because of this, it was suggested that hinting only need be applied in the vertical direction, where we have less resolution. The "slight" hinting setting when used with the autohinter does exactly this. Glyph outlines are only automatically adjusted in the vertical direction.
The autohinter can still have bugs, unfortunately, and some fonts still look suboptimal. Also, the use of subpixel rendering can still cause color fringing on certain fonts. Without proper gamma correct rendering, this will always be the case. Also some fonts, such as Arial, can still look a tad off even under these settings, usually due to the heuristic algorithm that the autohinter uses.
Comments
A really helpful article!
A really helpful article! Thanks.
sword.f1sh@yahoo.com