[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:
http://lists.kde.org/?l=kde-devel&m=103827986823928&w=2


msg


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 
(2.1.2).

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

Please post you comments, corrections, and experiences.

--
JRT

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

FontConfig HOWTO {Beta 1}

To install from source:

1.  Install the latest version of FreeType2 with:

	--prefix=/usr/local

2.  Remove these files and directories:

	/usr/X11R6/bin/freetype-config
	/usr/X11R6/include/freetype2/
	/usr/X11R6/lib/libfreetype.*

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

BUT, DO NOT remove anything in:

	/usr/X11R6/lib/modules/

3.  Be sure that the directory:

	/usr/local

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:

	fontconfig
	Xft {this is Xft-2}
	Xft1
	Xrender

which need to be installed separately.

5.  Install: "fontconfig":

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

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

	ldconfig

6.  Install: "Xft":

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

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

	make

Then before you install, remove the old files::

	/usr/X11R6/lib/libXft.so*

Then:

	make install

	ldconfig

7.  Edit the file:

	/usr/X11R6/lib/X11/config/X11.tmpl

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

Change the line:

	#define Freetype2Dir /usr

to:

	#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

	make install

	ldconfig


9.  Install "Xrender"

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

	xmkmf -a -DHasFreetype2 -DUseFreetype2

	make

	make install

	ldconfig


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
hurt.

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.

Specifically:

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
add:

	/usr/kde3/share/fonts

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
add:

	~/.kde/share/fonts

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
	mkfontdir
	cd /usr/X11R6/lib/X11/fonts/misc
	gunzip 5x7.pcf.gz 6x10.pcf.gz 7x13.pcf.gz 10x20.pcf.gz
	mkfontdir

then execute [as root]:

	fc-cache -v


/msg


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:
	/usr/X11R6/bin/freetype-config
	/usr/X11R6/include/freetype2/
	/usr/X11R6/lib/libfreetype.*
   BUT, DO NOT remove anything in:
	/usr/X11R6/lib/modules/
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 
fonts
   folder is. Here's what I did:
     cd /usr/X11R6/lib/X11/fonts
     for i in `find . -name "*cache*"`; do
         rm  $i
     done
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