almann.goo
October 30th, 2005, 11:24 PM
Overview
This weekend I decided to join the Ubuntu world and install Breezy on my system that was previously Fedora Core 3. Overall I was quite happy with the install and after enabling the Autohinter via "dpkg-reconfigure fontconfig" I was quite happy that my GTK2/GNOME applications had fonts anti-aliased the way I like them (a lot like how Fedora looks).
One problem that I ran into however was that no matter what I configured, OpenOffice 2.0 still didn't quite look right. Using Luxi as my default font, OpenOffice did anti-alias it, but it looked a little strange (and actually looked like my other GNOME applications before I enabled the libfreetype Autohinter). Doing some searching on the forums and Google, my results seemed to indicate that the Ubuntu/Debian package of libfreetype enabled the bytecode interpreter that looks somewhat terrible on LCDs (I run a 20" LCD). Other sources during this search indicated that no matter what fontconfig settings were made, OpenOffice used the bytecode interpreter if it was enabled.
A Solution
To get around this problem I decided to build a new DEB of the libfreetype package. Overall not a terribly complex solution and may not in itself warrant a HOWTO, but since it wasn't trivial to fix I thought I should share my steps. Disclaimer: Although I have been using Linux for some time now, I am by no means an expert, especially on Ubuntu systems--so this may not be the best way to solve the problem so if you have a better one please let me know!
Getting the Source Package
Create a directory to use for building and change into it.
mkdir freetype-build
cd freetype-build
Get the sources for libfreetype6.
apt-get source libfreetype6
Install any dependencies needed for building the package (need root for this).
sudo apt-get build-dep libfreetype6
Change the Source Package
Switch into the source directory created by Apt. Depending on the version the directory may be named differently, as of this writing it is "freetype-2.1.7".
cd freetype-2.1.7
Edit the "changelog" file in the "debian" directory. (I use vim, but any editor will of course work like gedit for instance)
vim debian/changelog
I dug into the Makefile (actually the rules file) and it seems to extract it with a regular expression from the top of the file. At the current time of this writing, the top of file looks like this:
freetype (2.1.7-2.4ubuntu1) breezy; urgency=low
* Slightly relax the header check on Type1 fonts, enabling wider display of
PDFs, et al; based on a change to FreeType CVS (closes: Ubuntu#10087).
-- Daniel Stone <daniel.stone@ubuntu.com> Thu, 12 May 2005 12:41:38 +1000
Using your favorite text editor add an entry that adds to the version slightly this is to prevent apt-get from trying to install the "official" version over your custom one. Of course when a new version of libfreetype6 becomes available it will overwrite your custom package--for this minor change I find that okay, but if you don't you can consider other techniques like package "pinning" which I won't get into here. I made an entry on the top that looks something like this (note the additional minor up version):
freetype (2.1.7-2.4ubuntu1-nobytecode1) breezy; urgency=low
* Disabled patch for Bytecode Interpreter.
-- Almann Goo <almann.goo@somewhere.com> Sat, 29 Oct 2005 21:30:00 -0500
Now edit the "rules" file in the "debian" directory.
vim debian/rules
Find the line that patches in the enabling of the bytecode interpreter. It should look something like:
patch -p0 -i $(patchdir)/030-bytecode-interpreter.diff
Comment out the line with "#" so the line looks like this:
#patch -p0 -i $(patchdir)/030-bytecode-interpreter.diff
Build the Package
After making these slight changes, build the package:
fakeroot dpkg-buildpackage -rfakeroot -b -uc -us
This will create unsigned versions of the package in the parent directory. Change to that directory.
cd ..
You should see the built packages, libfreetype6_XXXXX.deb where XXXXX is the version of your freetype.
Install the Package
Install the package using "dpkg"
sudo dpkg -i libfreetype6_2.1.7-2.4ubuntu1-nobytecode1_i386.deb
Of course, use the filename of the deb you created (the above example shows the one I built on my own machine).
Conclusion
Hopefully, if I wrote my instructions right and you followed them correctly, you should now have a libfreetype that has no bytecode interpreter and OpenOffice 2.0 will look as good (IMO) as the rest of your GTK2+/GNOME applications.
Again, you may have to repeat this when a new version of libfreetype comes out, though by using "pinning" you can of course avoid that scenario.
Hope this is helps anyone having this problem! :)
Best Regards,
Almann
This weekend I decided to join the Ubuntu world and install Breezy on my system that was previously Fedora Core 3. Overall I was quite happy with the install and after enabling the Autohinter via "dpkg-reconfigure fontconfig" I was quite happy that my GTK2/GNOME applications had fonts anti-aliased the way I like them (a lot like how Fedora looks).
One problem that I ran into however was that no matter what I configured, OpenOffice 2.0 still didn't quite look right. Using Luxi as my default font, OpenOffice did anti-alias it, but it looked a little strange (and actually looked like my other GNOME applications before I enabled the libfreetype Autohinter). Doing some searching on the forums and Google, my results seemed to indicate that the Ubuntu/Debian package of libfreetype enabled the bytecode interpreter that looks somewhat terrible on LCDs (I run a 20" LCD). Other sources during this search indicated that no matter what fontconfig settings were made, OpenOffice used the bytecode interpreter if it was enabled.
A Solution
To get around this problem I decided to build a new DEB of the libfreetype package. Overall not a terribly complex solution and may not in itself warrant a HOWTO, but since it wasn't trivial to fix I thought I should share my steps. Disclaimer: Although I have been using Linux for some time now, I am by no means an expert, especially on Ubuntu systems--so this may not be the best way to solve the problem so if you have a better one please let me know!
Getting the Source Package
Create a directory to use for building and change into it.
mkdir freetype-build
cd freetype-build
Get the sources for libfreetype6.
apt-get source libfreetype6
Install any dependencies needed for building the package (need root for this).
sudo apt-get build-dep libfreetype6
Change the Source Package
Switch into the source directory created by Apt. Depending on the version the directory may be named differently, as of this writing it is "freetype-2.1.7".
cd freetype-2.1.7
Edit the "changelog" file in the "debian" directory. (I use vim, but any editor will of course work like gedit for instance)
vim debian/changelog
I dug into the Makefile (actually the rules file) and it seems to extract it with a regular expression from the top of the file. At the current time of this writing, the top of file looks like this:
freetype (2.1.7-2.4ubuntu1) breezy; urgency=low
* Slightly relax the header check on Type1 fonts, enabling wider display of
PDFs, et al; based on a change to FreeType CVS (closes: Ubuntu#10087).
-- Daniel Stone <daniel.stone@ubuntu.com> Thu, 12 May 2005 12:41:38 +1000
Using your favorite text editor add an entry that adds to the version slightly this is to prevent apt-get from trying to install the "official" version over your custom one. Of course when a new version of libfreetype6 becomes available it will overwrite your custom package--for this minor change I find that okay, but if you don't you can consider other techniques like package "pinning" which I won't get into here. I made an entry on the top that looks something like this (note the additional minor up version):
freetype (2.1.7-2.4ubuntu1-nobytecode1) breezy; urgency=low
* Disabled patch for Bytecode Interpreter.
-- Almann Goo <almann.goo@somewhere.com> Sat, 29 Oct 2005 21:30:00 -0500
Now edit the "rules" file in the "debian" directory.
vim debian/rules
Find the line that patches in the enabling of the bytecode interpreter. It should look something like:
patch -p0 -i $(patchdir)/030-bytecode-interpreter.diff
Comment out the line with "#" so the line looks like this:
#patch -p0 -i $(patchdir)/030-bytecode-interpreter.diff
Build the Package
After making these slight changes, build the package:
fakeroot dpkg-buildpackage -rfakeroot -b -uc -us
This will create unsigned versions of the package in the parent directory. Change to that directory.
cd ..
You should see the built packages, libfreetype6_XXXXX.deb where XXXXX is the version of your freetype.
Install the Package
Install the package using "dpkg"
sudo dpkg -i libfreetype6_2.1.7-2.4ubuntu1-nobytecode1_i386.deb
Of course, use the filename of the deb you created (the above example shows the one I built on my own machine).
Conclusion
Hopefully, if I wrote my instructions right and you followed them correctly, you should now have a libfreetype that has no bytecode interpreter and OpenOffice 2.0 will look as good (IMO) as the rest of your GTK2+/GNOME applications.
Again, you may have to repeat this when a new version of libfreetype comes out, though by using "pinning" you can of course avoid that scenario.
Hope this is helps anyone having this problem! :)
Best Regards,
Almann