From owner-freebsd-doc@FreeBSD.ORG Sun May 4 16:10:18 2003 Return-Path: Delivered-To: freebsd-doc@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9496537B401 for ; Sun, 4 May 2003 16:10:18 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 12B6543FDF for ; Sun, 4 May 2003 16:10:17 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h44NAHUp057821 for ; Sun, 4 May 2003 16:10:17 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h44NAHG8057819; Sun, 4 May 2003 16:10:17 -0700 (PDT) Resent-Date: Sun, 4 May 2003 16:10:17 -0700 (PDT) Resent-Message-Id: <200305042310.h44NAHG8057819@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-doc@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Joe Marcus Clarke Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 273BD37B401 for ; Sun, 4 May 2003 16:07:10 -0700 (PDT) Received: from shumai.marcuscom.com (rdu57-17-158.nc.rr.com [66.57.17.158]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0585143FA3 for ; Sun, 4 May 2003 16:07:09 -0700 (PDT) (envelope-from marcus@shumai.marcuscom.com) Received: from shumai.marcuscom.com (localhost.marcuscom.com [127.0.0.1]) by shumai.marcuscom.com (8.12.9/8.12.9) with ESMTP id h44N77IW014500 for ; Sun, 4 May 2003 19:07:07 -0400 (EDT) (envelope-from marcus@shumai.marcuscom.com) Received: (from marcus@localhost) by shumai.marcuscom.com (8.12.9/8.12.9/Submit) id h44N77UY014499; Sun, 4 May 2003 19:07:07 -0400 (EDT) Message-Id: <200305042307.h44N77UY014499@shumai.marcuscom.com> Date: Sun, 4 May 2003 19:07:07 -0400 (EDT) From: Joe Marcus Clarke To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: docs/51770: [PATCH] Update anti-alias font section of handbook X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Joe Marcus Clarke List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 May 2003 23:10:19 -0000 >Number: 51770 >Category: docs >Synopsis: [PATCH] Update anti-alias font section of handbook >Confidential: no >Severity: non-critical >Priority: high >Responsible: freebsd-doc >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Sun May 04 16:10:16 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Joe Marcus Clarke >Release: FreeBSD 4.8-STABLE i386 >Organization: MarcusCom, Inc. >Environment: System: FreeBSD shumai.marcuscom.com 4.8-STABLE FreeBSD 4.8-STABLE #9: Wed Apr 30 00:31:53 EDT 2003 marcus@shumai.marcuscom.com:/usr/obj/usr/src/sys/SHUMAI i386 >Description: The anti-aliased fonts section of the handbook is severely out of date. It still discusses the old XftConfig style of enable anti-aliasing. All of this has been pushed into fontconfig. Attached is a diff to the x11 chapter of the handbook that brings this section in line with Xft+fontconfig as well as updates the GNOME anti-aliasing section for GNOME 2. >How-To-Repeat: >Fix: --- chapter.sgml.diff begins here --- Index: chapter.sgml =================================================================== RCS file: /home/dcvs/doc/en_US.ISO8859-1/books/handbook/x11/chapter.sgml,v retrieving revision 1.110 diff -u -r1.110 chapter.sgml --- doc/en_US.ISO8859-1/books/handbook/x11/chapter.sgml 29 Apr 2003 20:47:06 -0000 1.110 +++ doc/en_US.ISO8859-1/books/handbook/x11/chapter.sgml 4 May 2003 23:02:40 -0000 @@ -693,46 +693,65 @@ 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. - - 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. - - First, tell the X server about the fonts that are to be - anti-aliased. For each font directory, add a line similar - to this: - - dir "/usr/X11R6/lib/X11/fonts/Type1" - - 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. + Anti-aliasing has been available in + XFree86 since 4.0.2. However + it was not easy to configure as it is in + 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. + + + 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). + + 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: + + + <?xml version="1.0"?> + <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> + <fontconfig> + + + 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,44 +759,80 @@ 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: - match any family == "mono" edit spacing = 100; - - 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: - - match any family == "mono" edit family += "LuciduxMono"; -match any family == "Lucidux Mono" edit family += "LuciduxMono"; -match any family == "LuciduxMono" edit family =+ "Lucidux Mono"; - - (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" + + <match target="pattern" name="family"> + <test qual="any" name="family"> + <string>mono</string> + <edit name="spacing" mode="assign"> + <int>100</int> + </edit> + </match> + + + 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. + + 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. + + 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: - - match edit rgba=rgb; + line somewhere in the local.conf file: - (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.) + + <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, 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 @@ -786,17 +841,12 @@ 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. + 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 +1154,12 @@ 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 +1200,24 @@ 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. --- chapter.sgml.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: