Subject: Xft and anti-aliased fonts on NetBSD (a short howto)
To: None <tech-x11@netbsd.org>
From: Jared D. McNeill <jmcneill@invisible.ca>
List: tech-x11
Date: 12/29/2002 19:54:23
I've written a short howto on configuring anti-aliased fonts with NetBSD.
Comments / suggestions are welcome.

Cheers,
Jared

How to setup anti-aliased fonts on NetBSD with XFree86 4

    NOTE: The paths below should be adjusted appropriately if using xpkgwedge

	1. Install the following packages from pkgsrc:
		fonts/ms-ttf
		fonts/mkfontscale
		fonts/fontconfig
	2. Setup the font hints:
		mkfontscale /usr/X11R6/lib/X11/fonts/TrueType
		mkfontdir /usr/X11R6/lib/X11/fonts/TrueType
	   There should now be a 'fonts.dir' and 'fonts.scale' in the
	   TrueType font directory.
	3. Configure the X server:
	    a. In the "Module" section, make sure that the following exists:
		Load "type1"
		Load "freetype"
	    b. In the "Files" section, verify the order of the font paths.
	       Verify that the TrueType and Type1 font paths are before
	       the rest:
    		FontPath   "/usr/X11R6/lib/X11/fonts/local/"
    		FontPath   "/usr/X11R6/lib/X11/fonts/TrueType/"
    		FontPath   "/usr/X11R6/lib/X11/fonts/Type1/"
    		FontPath   "/usr/X11R6/lib/X11/fonts/misc/"
    		FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
    		FontPath   "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
    		FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/"
    		FontPath   "/usr/X11R6/lib/X11/fonts/100dpi/"
	4. Configure Xft -- an example /usr/X11R6/lib/X11/XftConfig follows:

##### Example XftConfig
dir "/usr/X11R6/lib/X11/fonts/TrueType"
dir "/usr/X11R6/lib/X11/fonts/Type1"
# Uncomment the following line if using an LCD display
#match edit rgba = rgb;
match any family == "fixed"             edit family =+ "mono";
includeif       "~/.xftconfig"
match any family == "Times"             edit family += "Times New Roman";
match any family == "Helvetica"         edit family += "Verdana";
match any family == "Courier"           edit family += "Courier New";
match any family == "serif"             edit family += "Times New Roman";
match any family == "sans"              edit family += "Verdana";
match
        any family == "mono"
        all slant == roman
        all weight < bold
edit
        family += "monotype.com";
match any family == "mono"              edit family += "Courier New";
match any family == "Charter"           edit family += "Bitstream Charter";
match any family == "Bitstream Charter" edit family =+ "Charter";
match any family == "Lucidux Serif"     edit family += "LuciduxSerif";
match any family == "LuciduxSerif"      edit family =+ "Lucidux Serif";
match any family == "Lucidux Sans"      edit family += "LuciduxSans";
match any family == "LuciduxSans"       edit family =+ "Lucidux Sans";
match any family == "Lucidux Mono"      edit family += "LuciduxMono";
match any family == "LuciduxMono"       edit family =+ "Lucidux Mono";
match any family == "Comic Sans"        edit family += "Comic Sans MS";
match any family == "Comic Sans MS"     edit family =+ "Comic Sans";
match any family == "Trebuchet"         edit family += "Trebuchet MS";
match any family == "Trebuchet MS"      edit family =+ "Trebuchet";
match any family == "Monotype"          edit family =+ "Monotype.com";
match any family == "Andale Mono"       edit family += "Monotype.com";
match any family == "Monotype.com"      edit family =+ "Andale Mono";
##### End of XftConfig

	5. Rebuild the font cache for applications that use fontconfig:
		fc-cache -v
	   This will take a very long time (~20 minutes on a PII 366),
	   so be patient.
	6. That's it! Restart the X server, and test the configuration:
		xterm -ls -fg gray -bg black -ls -fa "Courier New Bold" -fs 10