The Konqueror Web browser with aliased and anti-aliased fonts side-by-side:
In addition X.Org uses the fontconfig(3) library to manage the installed fonts, including their names and properties.
You can verify that the Render extension is enabled by running:
$ /usr/X11R6/bin/xdpyinfo | grep RENDER RENDER
In addition to the DejaVu fonts family that ships with OpenBSD (OpenBSD used Bitstream Vera fonts family till version 4.7 including), a collection of popular TrueType 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:
# cd /usr/ports/x11/msttcorefonts # make install
The ports collection also include other TrueType fonts packages, especially the liberation fonts that can be used as a replacement for the Microsoft Web fonts above and are distributed with a more acceptable license.
These options are:$ xterm -fa '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.
After a 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
The fc-list command can be used to list all known fonts to the system. Beware, this command outputs international fonts names encoded in UTF-8. So it's better to run it in an UTF-8 capable terminal emulation program, such as uxterm.
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 fonts.dir file. 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 mkfontscale(1) program 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, the following command should be used instead:$ xset +fp /usr/local/lib/X11/fonts/myfonts
# pkill -HUP xfs