[SM-Users] KDE, anti alias, Qt, Xft[2], FontConfig, FreeType2 HOWTO

isoperimetrix isoperimetrix at excite.com
Fri Jan 3 18:59:03 EST 2003

I've had a difficult time to get anti aliased fonts working in KDE 3.1rc5 
under SourceMage so I'd like to share my experience in getting this to work. 
After some time with no success, I found a great guide on the kde-devel list:


I attach the first draft of my HOWTO based in what I did to get this 
stuff to all work.

Note that this is for installing them all from source.

You want to get the current versions of FCPackage (2.1) and FreeType 

Also, I have XFree86 4.2.1 installed from the xfree86.org binaries.

Please post you comments, corrections, and experiences.


["install-FCPackage.txt" (text/plain)]

FontConfig HOWTO {Beta 1}

To install from source:

1.  Install the latest version of FreeType2 with:


2.  Remove these files and directories:


You may get very odd build errors if you don't remove them.

BUT, DO NOT remove anything in:


3.  Be sure that the directory:


is in your: "ld.so.conf" file and execute: "ldconfig".

4. Unpack the FCPackage tarball in: "/usr/src/".  There are 4
separate packages in it:

	Xft {this is Xft-2}

which need to be installed separately.

5.  Install: "fontconfig":

	cd /usr/src/fcpackage.2_x/fontconfig

	./configure --prefix=/usr/X11R6 --sysconfdir=/etc \ 
	make install


6.  Install: "Xft":

	cd /usr/src/fcpackage.2_x/Xft

	./configure --prefix=/usr/X11R6 --sysconfdir=/etc \ 
	--with-freetype-includes=/usr/local/include/freetype2 \


Then before you install, remove the old files::



	make install


7.  Edit the file:


[yes that is the file that says: DO NOT EDIT]

Change the line:

	#define Freetype2Dir /usr


	#define Freetype2Dir /usr/local

so that it indicates the correct location for FreeType2.

8.  Install: "Xft1":

	cd /usr/src/fcpackage.2_x/Xft1

	xmkmf -a -DHasFreetype2 -DUseFreetype2


	make install


9.  Install "Xrender"

	cd /usr/src/fcpackage.2_x/Xrender

	xmkmf -a -DHasFreetype2 -DUseFreetype2


	make install


10.  Then you need to rebuild Qt-3.1.0.

NOTE: I use this command line for configuring Qt-3.1.0. 
	./configure -L/usr/local/lib -I/usr/local/include \
	-system-zlib -qt-gif -system-libpng -system-libjpeg \
	-system-libmng -thread -no-xinerama -no-g++-exceptions \

If you don't want to use the system library for JPEG, PNG, &/|
MNG, make the necessary changes.

If you have installed FreeType2 in: "/usr/local/", the paramater:
"-I/usr/local/include" is necessary for Qt to autodetect Xft. 
I'm not certain about using: "-L/usr/local/lib" but it doesn't

You should check for any old cache files in your font
directories, remove them, and then execute [as root]:

	fc-cache -v

to make new caches.

You might need to edit the: "/etc/fonts/fonts.conf" configuration
file.  If so, note that when you run: "fc-cache" that it
searches the directories recursivly, so you only need the
directory at the root of font trees.


If you have installed KDE in a directory other than: "/usr/" you
need to add a directory path for the fonts installed by Konsole. 
For example if you installed in the default: "/usr/kde3/" then


Don't bother running: "fc-cache" yet since it won't do any good
(see below)

If you have locally installed fonts under KDE, then you need to


and then execute for each user:

	fc-cache -v

Then we come to the font problem with Konsole.  The current
version of FontConfgure apparently does not deal with gzipped
fonts, so you don't get the correct bit-mapped fonts in Konsole.

To fix this:

	cd $KDEDIR/share/fonts
	gunzip 9x15.pcf.gz
	cd /usr/X11R6/lib/X11/fonts/misc
	gunzip 5x7.pcf.gz 6x10.pcf.gz 7x13.pcf.gz 10x20.pcf.gz

then execute [as root]:

	fc-cache -v


When I started, I recompiled xfree86 4.2.1, freetype2, fontconfig, Xft2, 
Xrender, qt-3.1.1, and a few kde packages (triggers from the qt-x11 spell). 
When I found this HOWTO, I noticed that I had not installed Xft1 (though I 
don't think this is strictly required), and #2 regarding freetype includes 
and libs inside of /usr/X11R6/. The freetype2 spell puts these in /usr so 
here there are potentially conflicting libs.

I went through several iterations of installing the requisite spells, deleting 
font cache files, and running fc-cache -v with no success. I checked the 
compile logs for which libs were being linked when compiling and they were 
correct without hand intervention. Before I removed file from /usr/X11R6 it 
was finding freetype there. I also tried building Xft1 and Xrender by hand so 
I could try running the xmkmf command.

Next I tried to version bump the fcpackage related spells from 2.0 to 2.1. 
Recompile freetype, fontconfig, qt, etc. Still nothing. In the final round, I 
downgraded freetype from 2.1.3 to 2.1.2 in order to match what was listed in 
the howto, then I recompiled freetype2, and all four fcpackage spells. 
Finally it was working. I did not do another recompile of qt-x11 here. I 
finished out by doing the konsole font fix.

Since I arrived at my solution in a very round about way, I can't write a step 
by step process with complete confidence. But here is an approximation of 
where I'm at now adapted from the above HOWTO:

1) edit DETAILS on freetype2, version bump from 2.1.3 to 2.1.2
   edit DETAILS on fontconfig, Xft1, Xft2, Xrender, version bump from 2_0
   to 2_1
2) cast freetype2  (I ran ldconfig after each cast, I don't think that was
   necessary, but I agree with the HOWTO that it can't hurt.)
3) removed these files and directories:
   BUT, DO NOT remove anything in:
4) cast fontconfig
4) cast Xft2
5) cast Xft1
6) cast Xrender
7) cast qt-x11
8) remove font cache files in /usr/X11R6/lib/X11/fonts or where ever your 
   folder is. Here's what I did:
     cd /usr/X11R6/lib/X11/fonts
     for i in `find . -name "*cache*"`; do
         rm  $i
9) run fc-cache -v (root). the howto says you may need to run it for each user
   too (I didn't need to).
10) do the konsole font fix

Once this started working, I immediately noticed the difference when opening 
new applications (kmail, konsole). Then I restarted KDE to make it global. If 
anyone else tries this. I hope it works, err, I mean this msg helps.

Join Excite! - http://www.excite.com
The most personalized portal on the Web!

More information about the SM-Users mailing list