Sunday, March 13, 2011

better Freetype fonts in Fedora

libfreetype includes some features that enhance much the apparence of rendered fonts: this features are disabled by default in distros like fedora and ubuntu, due to potential copyright issues. But can be enabled quite simply by recompiling the Freetype package. This is how:

rpm -qi freetype
will output informations about the package and the version of the lib you are using:

Name        : freetype                     Relocations: (not relocatable)
Version     : 2.4.2                             Vendor: Fedora Project
Release     : 4.fc14                        Build Date: Mon 15 Nov 2010 11:20:32 AM CET
Install Date: Sat 12 Mar 2011 12:03:25 PM CET      Build Host: x86-03.phx2.fedoraproject.org
Group       : System Environment/Libraries   Source RPM: freetype-2.4.2-4.fc14.src.rpm
  notice on a 64 bit system you'll probably have both .i686 and .x86_64 versions, as well as the .devel versions. Download the rpm source with yumdownloader:

yumdownloader --source freetype
this will download the .src.rpm, in my case  freetype-2.4.2-4.fc14.src.rpm.
Install the package:

 rpm -ih ./freetype-2.4.2-4.fc14.src.rpm
this will create a directory "rpmbuild" and unpackage the files needed to recompile the whole package. cd to the rpmbuild

cd rpmbuild
now we rebuild the package while enabling the copyrighted features:

rpmbuild --clean -bb --with bytecode_interpreter --with subpixel_rendering --with xfree86 SPECS/freetype.spec

after that you'll find new packages in rpbuild/RPMS/x86_64/ . you can install them with

sudo rpm -Uh RPMS/x86_64/freetype-X.Y.Z-K.fcXX.x86_64.rpm --force
you can also install the devel lib.

Now for the 32 bit libraries, first make sure you have the 32 bit versions of the devel libs needed to recompile:
 [massi@poldon rpmbuild]$ rpm -qa | grep libX11-devel
libX11-devel-1.3.4-3.fc14.x86_64
[massi@poldon rpmbuild]$
Download and install the missing 32 bit package:

 yumdownloader libX11-devel-1.3.4-3.fc14.i686
 sudo rpm -ih libX11-devel-1.3.4-3.fc14.i686

Now recompile the package with target "i686" to produce the 32 bit lib:

 rpmbuild --target i686 --clean -bb --with bytecode_interpreter --with subpixel_rendering --with xfree86 SPECS/freetype.spec
The .rpms will be in RPMS/i686 . Install the 32 bit libraries as you did with the 64 bit ones.
 sudo rpm -ih RPMS/i686/freetype-2.4.2-4.fc14.i686.rpm --force
sudo rpm -ih RPMS/i686/freetype-devel-2.4.2-4.fc14.i686.rpm --force

Now restart X and enjoy truetype fonts with proper rendering and hinting support ;-)






















 

No comments:

Post a Comment