![[Standard and anti-aliased xterm]](images/xterm_diff.jpg)
The Konqueror Web browser with aliased and anti-aliased fonts side-by-side:
![[Standard and anti-aliased Konqueror]](images/konqueror_diff.jpg)
You can check your card by running:
If it doesn't say "RENDER" in its extension list, you'll have to wait until someone implements the extension for that card.$ /usr/X11R6/bin/xdpyinfo | grep RENDER RENDER
The next step is to grab and install some TrueType fonts. A collection of popular fonts has been compiled and is available in the OpenBSD ports tree, in /usr/ports/x11/msttcorefonts. They can be installed by doing the following:
At this point, the instructions for registering new fonts with X are listed in another section.# cd /usr/ports/x11/msttcorefonts # make # make install
These options are:$ xterm -fa 'Andale Mono' -fs 14
Alternatively, X resources can be used. They are by default placed in $HOME/.Xdefaults and are controlled through the xrdb(1) program.Option Resource Meaning ---------------------------------------- -fa XTerm*faceName Font face name -fs XTerm*faceSize Font size
Some TrueType fonts (such as Arial, Georgia, and Verdana, for example) don't work well in xterm. This is because xterm uses the maximum width of all characters in the specified font to display each character. With a monospace font, the widths of all the characters are the same, and everything works. With a proportional font, such as the ones just mentioned, xterm fits each character into a cell the size of the maximum width, creating unreadable large gaps between characters.
The GUI Qt configuration program, qtconfig (or qtconfig-mt if the multi-threaded flavor of Qt is installed), can set this value from the Enable Anti-aliased Font Support checkbox under the Fonts tab.useXft=true
The following will launch the GTK+2-based instant messenging program Gaim available in /usr/ports/net/gaim:
$ env GDK_USE_XFT=1 gaim
Or, if using xfs, add the directory to /etc/X11/fs/config:Section "Files" FontPath "/usr/X11R6/lib/X11/fonts/TTF/" FontPath "/usr/local/lib/X11/fonts/myfonts/" ... EndSection
Next, the X server must be made aware of the font in that directory's font index, i.e., the file fonts.dir. Traditionally, all available sizes of a font were listed in the font index, generated by the mkfontdir(1) command. But since TrueType fonts can be scaled to any size, listing every possible size is not required. Instead, scalable fonts are listed in the file fonts.scale which is recognized by mkfontdir when generating fonts.dir indexes.catalogue = /usr/X11R6/lib/X11/fonts/TTF/, /usr/local/lib/X11/fonts/myfonts/
To build a fonts.scale file, the program mkfontscale(1) can be used:
Finally, to apply the changes to the current X session, instead of restarting X, the following command can be used to re-examine the currently registered font paths for changes:# cd /usr/local/lib/X11/fonts/myfonts # /usr/X11R6/bin/mkfontscale # /usr/X11R6/bin/mkfontdir
Or, if a new font path was added:$ xset fp rehash
If xfs is being used, following should be used instead:$ xset +fp /usr/local/lib/X11/fonts/myfonts
# pkill -HUP xfs
Add the directory containing the font to this configuration file:
Or, if only one user wants fonts added to their sessions, the above can be placed in their $HOME/.fonts.conf file.<?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "/etc/fonts/fonts.dtd"> <fontconfig> <dir>/usr/local/lib/X11/fonts/myfonts</dir> </fontconfig>
Note that fontconfig will recursively examine all sub-directories for available fonts whereas the regular X server will not.
After the directory is added, the font cache for the directory will need to be regenerated. The following command instructs fontconfig to rebuild the font caches for all directories specified in its configuration:
These changes will take effect in the current X session, so X itself will not need to be restarted, but running applications will.# /usr/X11R6/bin/fc-cache -v