Font rendering and text layouting
m (1 revision(s))
Revision as of 09:19, 26 June 2008
The FreeType library is used for virtually all font loading and rendering within the Fedora desktop. It contains supports for a great variety of font formats, from Type1, to !TrueType, to bitmap formats like PCF and BDF.
Moving one layer up from !FreeType, once we've taken a font outline and converted it into an image, we have to send the image to the screen. The Xft library is designed to do this. On modern X servers, it uses the RENDER extension to draw fonts to the screen. For older X servers, it contains fallback code to do the same rendering through the core X protocol, though less efficiently.
While virtually everything in Fedora renders fonts using the !FreeType library and Xft, there is much more diversity in how text layout is done. Text layout for scripts such as Latin or Cyrillic is relatively straightforward. The simple capabilities built into Xft are sufficient. But languages such as Arabic and Hindi require more intricate handling. The characters in the input string interact with each other and sophisticated processing is required to determine the right set of glyphs to be drawn to the screen. Right-to-left languages like Arabic and Hebrew are also challenging. The Pango library is used by GNOME and other programs based on the GTK+ toolkit for text layout. KDE and other programs based on the Qt toolkit use code built into Qt for the same purpose. !OpenOffice.org uses layout code from the ICU library.