Fonts in X11R7.7
Total Page:16
File Type:pdf, Size:1020Kb
Fonts in X11R7.7 Juliusz Chroboczek <[email protected]> X Version 11, Release 7.7 16 March 2012 1 Fonts in X11R7.7 Table of Contents Introduction ........................................................................................................... 3 Two font systems ........................................................................................... 3 Installing fonts ....................................................................................................... 3 Configuring Xft .............................................................................................. 3 Configuring the core X11 fonts system ......................................................... 6 Fonts included with X11R7.7 ................................................................................ 9 Standard bitmap fonts ................................................................................... 9 The ClearlyU Unicode font family ............................................................... 10 Standard scalable fonts ............................................................................... 10 The Bigelow & Holmes Luxi family ............................................................. 11 More about core fonts ......................................................................................... 12 Core fonts and internationalisation ............................................................. 12 Additional notes about scalable core fonts .................................................. 18 Appendix: background and terminology ............................................................. 20 Characters and glyphs ................................................................................. 20 Font files, fonts, and XLFD .......................................................................... 20 Unicode ........................................................................................................ 21 References ........................................................................................................... 21 2 Fonts in X11R7.7 Introduction This document describes the support for fonts in X11R7.7. Installing fonts is aimed at the casual user wishing to install fonts in X11R7.7 the rest of the document de- scribes the font support in more detail. We assume some familiarity with digital fonts. If anything is not clear to you, please consult Appendix: background and terminology at the end of this document for back- ground information. Two font systems X11 includes two font systems: the original core X11 fonts system, which is present in all implementations of X11, and the Xft fonts system, which may not yet be distrib- uted with implementations of X11 that are not based on either XFree86 or X11R6.8 or later. The core X11 fonts system is directly derived from the fonts system included with X11R1 in 1987, which could only use monochrome bitmap fonts. Over the years, it has been more or less happily coerced into dealing with scalable fonts and rotated glyphs. Xft was designed from the start to provide good support for scalable fonts, and to do so efficiently. Unlike the core fonts system, it supports features such as anti-alias- ing and sub-pixel rasterisation. Perhaps more importantly, it gives applications full control over the way glyphs are rendered, making fine typesetting and WYSIWIG display possible. Finally, it allows applications to use fonts that are not installed system-wide for displaying documents with embedded fonts. Xft is not compatible with the core fonts system: usage of Xft requires fairly ex- tensive changes to toolkits (user-interface libraries). While X.Org will continue to maintain the core fonts system, toolkit authors are encouraged to switch to Xft as soon as possible. Installing fonts This section explains how to configure both Xft and the core fonts system to access newly-installed fonts. Configuring Xft Xft has no configuration mechanism itself, it relies upon the fontconfig [http:// www.fontconfig.org/] library to configure and customise fonts. That library is not specific to the X Window system, and does not rely on any particular font output mechanism. Installing fonts in Xft Fontconfig looks for fonts in a set of well-known directories that include all of X11R7.7's standard font directories (“/usr/share/fonts/X11/*”) by default) as well as a directory called “.fonts/” in the user's home directory. Installing a font for use by Xft applications is as simple as copying a font file into one of these directories. 3 Fonts in X11R7.7 $ cp lucbr.ttf ~/.fonts/ Fontconfig will notice the new font at the next opportunity and rebuild its list of fonts. If you want to trigger this update from the command line, you may run the command “fc-cache”. $ fc-cache In order to globally update the system-wide Fontconfig information on Unix systems, you will typically need to run this command as root: $ su -c fc-cache Fine-tuning Xft Fontconfig's behaviour is controlled by a set of configuration files: a standard con- figuration file, “/etc/fonts/fonts.conf”, a host-specific configuration file, “/etc/ fonts/local.conf”, and a user-specific file called “.fonts.conf” in the user's home directory (this can be overridden with the “FONTCONFIG_FILE” environment variable). Every Fontconfig configuration file must start with the following boilerplate: <?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> In addition, every Fontconfig configuration file must end with the following line: </fontconfig> The default Fontconfig configuration file includes the directory “˜/.fonts/” in the list of directories searched for font files, and this is where user-specific font files should be installed. In the unlikely case that a new font directory needs to be added, this can be done with the following syntax: <dir>/usr/local/share/fonts/</dir> Another useful option is the ability to disable anti-aliasing (font smoothing) for se- lected fonts. This can be done with the following syntax: <match target="font"> <test qual="any" name="family"> <string>Lucida Console</string> </test> <edit name="antialias" mode="assign"> <bool>false</bool> </edit> 4 Fonts in X11R7.7 </match> Anti-aliasing can be disabled for all fonts by the following incantation: <match target="font"> <edit name="antialias" mode="assign"> <bool>false</bool> </edit> </match> Xft supports sub-pixel rasterisation on LCD displays. X11R7.7 should automatically enable this feature on laptops and when using an LCD monitor connected with a DVI cable; you can check whether this was done by typing $ xdpyinfo -ext RENDER | grep sub-pixel If this doesn't print anything, you will need to configure Render for your particular LCD hardware manually; this is done with the following syntax: <match target="font"> <edit name="rgba" mode="assign"> <const>rgb</const> </edit> </match> The string “rgb” within the “<const>”...“</const>” specifies the order of pixel com- ponents on your display, and should be changed to match your hardware; it can be one of “rgb” (normal LCD screen), “bgr” (backwards LCD screen), “vrgb” (LCD screen rotated clockwise) or “vbgr” (LCD screen rotated counterclockwise). Configuring applications A growing number of applications use Xft in preference to the core fonts system. Some applications, however, need to be explicitly configured to use Xft. A case in point is XTerm, which can be set to use Xft by using the “-fa” command line option or by setting the “XTerm*faceName” resource: XTerm*faceName: Courier or $ xterm -fa "Courier" For KDE applications, you should select “Anti-alias fonts” in the “Fonts” panel of KDE's “Control Center”. Note that this option is misnamed: it switches KDE to using Xft but doesn't enable anti-aliasing in case it was disabled by your Xft configuration file. Gnome applications and Mozilla Firefox will use Xft by default. 5 Fonts in X11R7.7 Configuring the core X11 fonts system Installing fonts in the core system is a two step process. First, you need to create a font directory that contains all the relevant font files as well as some index files. You then need to inform the X server of the existence of this new directory by including it in the font path. Installing bitmap fonts The X11R7.7 server can use bitmap fonts in both the cross-platform BDF format and the somewhat more efficient binary PCF format. (X11R7.7 also supports the obsolete SNF format.) Bitmap fonts are normally distributed in the BDF format. Before installing such fonts, it is desirable (but not absolutely necessary) to convert the font files to the PCF format. This is done by using the command “bdftopcf”, e.g. $ bdftopcf courier12.bdf You may then want to compress the resulting PCF font files: $ gzip courier12.pcf After the fonts have been converted, you should copy all the font files that you wish to make available into a arbitrary directory, say “/usr/local/share/fonts/ bitmap/”. You should then create the index file “fonts.dir” by running the com- mand “mkfontdir” (please see the mkfontdir(1) [mkfontdir.1.html] manual page for more information): $ mkdir /usr/local/share/fonts/bitmap/ $ cp *.pcf.gz /usr/local/share/fonts/bitmap/ $ mkfontdir /usr/local/share/fonts/bitmap/ All that remains is to tell the X server about the existence of the new font directory; see Setting the server's font path below. Installing scalable fonts The X11R7.7 server supports scalable fonts in multiple formats, including Type 1, TrueType, and OpenType/CFF. (Earlier versions of X11 also included support for the Speedo and CID scalable