Many people are unsatisfied with the existing ways of font display systems on Linux. A research paper from Anti-Grain now showed easy but powerful text rasterization improvements. However, the answer from the FreeType developers is a bit sobering.
It is often mentioned that Fonts look ugly on Linux. While I cannot really understand that drastic statement (using DejaVu fonts) there certainly is room for improvements.
Maxim Shemanarev from Anti-Grain now looked into the issue and suggested a set of simple but powerful, not patented methods to improve this situation drastically. He outlines the advantages as follows:
- You can kern symbols with sub-pixel precision, not worrying about introducing extra blurriness.
- You can freely scale the text as you want, with 100% guarantee of preserving a stable text layout that always fits other graphic elements.
- You can always be sure that the calculated text width exactly corresponds with what you will see on screen and paper.
- You can apply fancy vector effects such as “faux bold” and “faux italic” being sure the text will not look any blurrier.
The paper mentions an interesting point: the free scaling of fonts and the stable, calculated text width are things which are not usual on today desktops. For example, fonts scaling on Windows XP seems to be a nightmare. Also, the distance between two chars is not constant for example in Word.
So the rasterization cannot only be improved on Linux but on Windows as well. The way to do so is:
- Use horizontal RGB sub-pixel anti-aliasing for LCD flat panels.
- Use vertical hinting only and completely discard the horizontal one.
- Use accurate glyph advance values, calculated at a high resolution for unhinted glyphs.
- Use accurate, high resolution values from the kerning table.
The paper itself shows numerous examples of blurry, not improved fonts and improved fonts. And the results do look pretty, even for an untrained eye. Besides, the articles gives a pretty good overview about text rendering on the different platforms.
However, the question is now if these suggestions will hit the Desktop anytime soon.
According to the FreeType developer David Turner this might not be the case due to different reasons. First of all backwards compatibility might be a showstopper:
And the same problem will happen on Linux if you want to implement sub-pixel positioning, because most of the GUI toolkits out there cannot deal with it correctly. And some applications will not work correctly anymore if you change the toolkit. Backwards compatibility is a bitch :-)
But there are also technical reasons. According to David Turner FreeType already supports techniques to deal with some mentioned problems like the inter-character spacing. Also, the suggested method to hint only in the vertical direction is already available in FreeType and is called “light hinting”.
Another, more general problem is that the layout toolkits using FreeType lack support of some of the techniques which would come in handy: sub-pixel glyph positioning and support for kerning and auto-kerning seems to be missing in the important libraries (which are Pango, LibXft, Qt, Cairo, poppler and others). But getting such patches upstream seems to be quite difficult, David is “tired of this”.
While the discussion continues it looks like that in the long term the major toolkits have to get together to talk about implementing the mentioned techniques. Or, as suggested by David, a initiative dedicated to bringing patches upstream is launched. It could try to work with upstream on the one hand, but with the distributors on the other hand – if the users see the results because the distributions include the patches it might help influencing the decision of upstream.
But there is no way of reaching perfect font rasterization with changes in FreeType only.