Comment 23 for bug 271283

Mike Kasick (mkasick) wrote :

Hi folks,

I ran into this issue with OpenOffice.org 3 on Debian unstable (I use a port of the Ubuntu cairo/xft lcd filter patches). I looked into it a bit, and there seems to be two underlying problems that, if either of them were solved, would fix the issue:

1. OpenOffice.org doesn't pay attention to the "lcdfilter" option in fontconfig (/etc/fonts/fonts.conf, ~/.fonts.conf, etc.). Instead, it appears to rely on the Xrm database configuration (Xft.lcdfilter) for that (and other?) antialiasing option.

2. The GNOME Font preferences (gnome-settings-daemon?) doesn't support setting the lcdfilter option.

I believe the way things work is that gnome-settings-daemon populates the Xrm database with the configured antialiasing options (Xft.*) on startup, using /etc/fonts/fonts.conf as defaults. Applications use the Xrm database to determine what the options are, but if they don't exist (e.g., "xrdb -remove -all") then the fontconfig parameters are used instead. Indeed this appears to be the behavior of most GTK/Qt applications.

Unfortunately OpenOffice.org doesn't follow this behavior, it relies on the Xrm database exclusively for the lcdfilter option (problem #1). And since GNOME doesn't know about the lcdfilter option, it doesn't populate the Xrm database with it (problem #2).

Fortunately there's an easy fix that appears to work without needing to downgrade packages or sacrifice font options. It's quite simple to add the Xft.lcdfilter parameter manually. This can be done for the current X11 session by running the following command in a terminal:

echo "Xft.lcdfilter: lcddefault" | xrdb -merge

After doing so, OpenOffice.org should have interface fonts that appear approprately filtered. To make the change persist after reboot, it can be stored in an Xresources file:

echo "Xft.lcdfilter: lcddefault" >> ~/.Xresources

Or to make the option system wide:

sudo sh -c 'echo "Xft.lcdfilter: lcddefault" > /etc/X11/Xresources/lcd-filter-lcddefault'

I've tested this on an Intrepid Live CD and it works well. I've not tested it on Jaunty, but I suspect it works there as well.