Fedora notes

Thursday, January 13, 2005

Font-handling Puzzles
Handling fonts in linux is really a pain especially when tuning about Chinese display with new fonts. After reading an article "A font primer for Linux" written by Nathan Willis , I finally got a rough idea about this kind of type-display magic.

Rough ideas of all puzzle concepts about fonts in linux:
1. fontconfig: Fontconfig is a library for configuring and customizing font access.
2. xft: provides a client-side font API for X applications. It uses Fontconfig to select fonts and the X protocol for rendering them.
3. FreeType: is a free, high-quality portable font engine used by Xft to rasterize fonts

Summary:
A lot of applications, GNOME, KDE, GTK+/Pango, QT, despite of their internal dependencies, uses xft to request for string displays with specified font. And xft uses fontconfig to find the font in the system, and uses FreeType font engine for accessing and rendering font. Furthermore, FreeType supports a variety of font formats like Type 1(adobe), TrueType(apple), OpenType(ms&adobe), ...

Therefore, fontconfig should be the right target and the lowest level for configuring font usage after installing new fonts. I've also checked a simple way of installing a TrueType font manually, but which hasn't been tried yet. Basic steps as follow:
1. move font files(.ttf) to /usr/fonts/...
2. cd to that directory you put files, and do commands "> mkfontscale && mkfontdir"
3. add fontpath to "file" section of X config file, for fedora core, it's /etc/X11/xorg.conf
FontPath /usr/fonts/....
4. restart X.

0 Comments:

Post a Comment

<< Home