diff --git a/en_US.ISO8859-1/books/handbook/x11/chapter.sgml b/en_US.ISO8859-1/books/handbook/x11/chapter.sgml index 317b0273ac..070c45e54a 100644 --- a/en_US.ISO8859-1/books/handbook/x11/chapter.sgml +++ b/en_US.ISO8859-1/books/handbook/x11/chapter.sgml @@ -691,48 +691,76 @@ EndSection + + + + Joe Marcus + Clarke + Updated for XFree86 4.3 by + + + + Anti-Aliased Fonts - Starting with version 4.0.2, XFree86 - supports anti-aliased - fonts. Currently, most software has not been updated to take - advantage of this new functionality. However, Qt (the toolkit - for the KDE desktop) does; so if - XFree86 4.0.2 is used - (or higher), Qt 2.3 (or higher) and KDE, - all KDE/Qt applications can be made to use anti-aliased - fonts. + Anti-aliasing has been available in + XFree86 since 4.0.2. However, font + configuration was cumbersome before the introduction of + XFree86 4.3.0. Starting in version 4.3.0, + all fonts in /usr/X11R6/lib/X11/fonts/ and + ~/.fonts/ are automatically + made available for anti-aliasing to Xft-aware applications. Not + all applications are Xft-aware yet, but many have received Xft support. + Examples of Xft-aware applications include Qt 2.3 and higher (the + toolkit for the KDE desktop), + Gtk+ 2.0 and higher (the toolkit for the + GNOME desktop), and Mozilla 1.2 and higher. + - To configure anti-aliasing, create (or edit, if - it already exists) the file - /usr/X11R6/lib/X11/XftConfig. Several - advanced things can be done with this file; this section - describes only the simplest possibilities. + In order to control which fonts are anti-aliased, or to + configure anti-aliasing properties, create (or edit, if it + already exists) the file + /usr/X11R6/etc/fonts/local.conf. Several + adavanced features of the Xft font system can be tuned using + this file; this section describes only some simple + possibilities. For more details, please see + fonts-conf(5). - First, tell the X server about the fonts that are to be - anti-aliased. For each font directory, add a line similar - to this: + This file must be in XML format. Pay careful attention to + case, and make sure all tags are properly closed. The file + begins with the usual XML header followed by a DOCTYPE + definition, and then the <fontconfig> tag: - dir "/usr/X11R6/lib/X11/fonts/Type1" + + <?xml version="1.0"?> + <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> + <fontconfig> + - Likewise for the other font directories (URW, TrueType, etc) - containing fonts to be anti-aliased. Anti-aliasing makes - sense only for scalable fonts (basically, Type1 and TrueType) so - do not include bitmap font directories here. The - directories included here can now be commented out - of the XF86Config file. + As previously stated, all fonts in + /usr/X11R6/lib/X11/fonts/ as well as + ~/.fonts/ are already made available to + Xft-aware applications. If you wish to add another directory + outside of these two directory trees, add a line similar to the + following to + /usr/X11R6/etc/fonts/local.conf: + + <dir>/path/to/my/fonts</dir> Anti-aliasing makes borders slightly fuzzy, which makes very small text more readable and removes staircases from large text, but can cause eyestrain if applied to normal text. To - exclude point sizes between 9 and 13 from anti-aliasing, include + exclude point sizes smaller than 14 point from anti-aliasing, include these lines: - match - any size > 8 - any size < 14 -edit - antialias = false; + <match target="font"> + <test name="size" compare="less"> + <double>14</double> + </test> + <edit name="antialias" mode="assign"> + <bool>false</bool> + </edit> + </match> Spacing for some monospaced fonts may also be inappropriate with anti-aliasing. This seems to be an issue with @@ -740,63 +768,92 @@ edit this is to force the spacing for such fonts to be 100. Add the following lines: - match any family == "fixed" edit family =+ "mono"; -match any family == "console" edit family =+ "mono"; + <match target="pattern" name="family"> + <test qual="any" name="family"> + <string>fixed</string> + <edit name="family" mode="assign"> + <string>mono</string> + </edit> + </match> + <match target="pattern" name="family"> + <test qual="any" name="family"> + <string>console</string> + <edit name="family" mode="assign"> + <string>mono</string> + </edit> + </match> (this aliases the other common names for fixed fonts as - "mono"), and then add: + "mono"), and then add: - match any family == "mono" edit spacing = 100; + <match target="pattern" name="family"> + <test qual="any" name="family"> + <string>mono</string> + <edit name="spacing" mode="assign"> + <int>100</int> + </edit> + </match> - Supposing the - Lucidux fonts as desired whenever - monospaced fonts are required (these look nice, and do not seem - to suffer from the spacing problem), replace that last - line with these: + Once you have finished editing + local.conf make sure you end the file + with the </fontconfig> tag. Not doing this will cause + your changes to be ignored. - match any family == "mono" edit family += "LuciduxMono"; -match any family == "Lucidux Mono" edit family += "LuciduxMono"; -match any family == "LuciduxMono" edit family =+ "Lucidux Mono"; + The default font set that comes with + XFree86 is not very + desirable when it comes to anti-aliasing. A much better + set of default fonts can be found in the + x11-fonts/bitstream-vera + port. This port will install a + /usr/X11R6/etc/fonts/local.conf file + if one does not exist already. If the file does exist, + the port will create a /usr/X11R6/etc/fonts/local.conf-vera + file. Merge the contents of this file into + /usr/X11R6/etc/fonts/local.conf, and the + Bitstream fonts will automatically replace the default + XFree86 Serif, Sans Serif, and Monospaced + fonts. - (the last lines alias different equivalent family names). - - Finally, it is nice to allow users to add commands to this - file, via their personal .xftconfig - files. To do this, add a last line: - - includeif "~/.xftconfig" + Finally, users can add their own settings via their personal + .fonts.conf files. To do this, each user should + simply create a ~/.fonts.conf. This file must + also be in XML format. One last point: with an LCD screen, sub-pixel sampling may be desired. This basically treats the (horizontally separated) red, green and blue components separately to improve the horizontal resolution; the results can be dramatic. To enable this, add the - line somewhere in the XftConfig file: + line somewhere in the local.conf file: - match edit rgba=rgb; + + <match target="font"> + <test qual="all" name="rgba"> + <const>unknown</const> + </test> + <edit name="rgba" mode="assign"> + <const>rgb</const> + </edit> + </match> + - (depending on the sort of display, the last word may need to - be changed from rgb to bgr, - vrgb or vbgr: experiment and see which - works best.) + Depending on the sort of display, + rgb may need to to bgr, + vrgb or vbgr: experiment and + see which works best. - Anti-aliasing should be enabled the next time the X server is - started. However, note that programs must know how to take - advantage of it. At the present time, the toolkit - Qt does, so the entire KDE environment - can use anti-aliased fonts - (see on - KDE for - details); there are patches for GTK+ to do the same, - so if compiled against such a patched GTK+, the GNOME environment - and Mozilla can also use anti-aliased fonts. In fact, there - is now a port called x11/gdkxft - which allows one to use antialiased fonts without recompiling: see - for details. - - Anti-aliasing is still new to FreeBSD and - XFree86; - configuring it should get easier with time, and it will soon be - supported by many more applications. + Anti-aliasing should be enabled the next time the X + server is started. However, programs must know how to take + advantage of it. At present, the Qt toolkit does, + so the entire KDE environment can + use anti-aliased fonts (see on + KDE for details). Gtk+ and GNOME + can also be made to use anti-aliasing via the + Font capplet (see for details). By default, + Mozilla 1.2 and greater will automatically use anti-aliasing. + To disable this, rebuild Mozilla with the + -DWITHOUT_XFT flag. @@ -1104,12 +1161,12 @@ DisplayManager.requestPort: 0 To install the GNOME package from the network, simply type: - &prompt.root; pkg_add -r gnome + &prompt.root; pkg_add -r gnome2 To build GNOME from source, use the ports tree: - &prompt.root; cd /usr/ports/x11/gnome + &prompt.root; cd /usr/ports/x11/gnome2 &prompt.root; make install clean Once GNOME is installed, @@ -1150,47 +1207,24 @@ DisplayManager.requestPort: 0 Anti-aliased fonts with GNOME - While anti-aliased fonts made their first appearance on - XFree86 desktops in the - KDE environment and are supported there - in the standard installation, it is also possible to use them with - GTK applications such as the GNOME - environment. The most straightforward way is probably by - using the libgdkxft library, in - the x11/gdkxft port. After - installing this port, read the - /usr/X11R6/share/doc/gdkxft/README file - carefully. - - Then, all that is needed is to tell GTK - applications to look for their font-rendering functions in - libgdkxft.so before looking in the - standard place, libgdk.so. This is - easily accomplished by setting an environment variable to - point to the right place; with the Bourne shell - (/bin/sh) or similar shells, type - the command (to start The Gimp, - say) - - &prompt.user; LD_PRELOAD=/usr/X11R6/lib/libgdkxft.so gimp - - and with csh and similar shells, type - - &prompt.user; setenv LD_PRELOAD /usr/X11R6/lib/libgdkxft.so -&prompt.user; gimp - - Or, the commands - - LD_PRELOAD=/usr/X11R6/lib/libgdkxft.so -export LD_PRELOAD - - can be put into .xinitrc, - .xsession or in the appropriate - place(s) in - /usr/X11R6/lib/X11/xdm/Xsession, - depending on how X is normally started. However, this - short-cut may cause problems if Linux GTK binaries are - run. + Starting with version 4.0.2, XFree86 + supports anti-aliasing via its RENDER extension. + Gtk+ 2.0 and greater (the toolkit used by + GNOME can make use of this + functionality. Configuring anti-aliasing is described in + . So, with up-to-date software, + anti-aliasing is possible within the + GNOME desktop. Just go to + Applications -> + Desktop Preferences -> + Font, and select either + Best shapes, + Best contrast, or + Subpixel smoothing (LCDs). For a + Gtk+ application that is not part of the + GNOME desktop, set the + environment variable GDK_USE_XFT to + 1 before launching the program.