You are not logged in.

#1 2004-11-25 15:29:03

glynadgie
Member
From: Birmingham, England
Registered: 2003-12-17
Posts: 7
Website

Font rendering and legacy X applications

For some time, I have had problems keeping older applications working well as the X font system evolves. For example, I have many drawings created in Xfig, and the fonts stopped being rendered correctly some time ago. Converting all these files for a new drawing package like Inkscape would be a pain. The other main problem occurs with a commercial CAD package (Eagle), which is statically linked to Qt2, and does not play nicely when anti-aliasing is applied to Qt3/KDE apps.

Xfig and others

The problem here is that Xfig would render fonts with the letters too closely spaced, such that the on-screen representation no longer matches the printed or PDF output. I fixed this by forcing 75 x 75 DPI resolution, rather than using the resolution determined by the X server from probing the monitor. To do this, put a line in the Monitor section of XF86Config or xorg.conf:

    DisplaySize 433 347

The above x and y values were calculated for a resolution of 1280 x 1024.

Another fix I have done for Xfig is to patch the sources to pick up the URW font names instead of the Adobe names for the standard Postscript fonts. If anyone is interested, I could make a proper Arch package for this.

Forcing the resolution is admittedly a kludge. I might look into font rendering in an Xlib application, to see if there is some extra code needed to handle the proper resolution correctly.

Gtk-2.0 UI fonts at 75DPI

An unfortunate side effect of forcing 75 x 75 DPI resolution is that the menu and other UI fonts in Gtk apps end up too small. This was noticed on Gvim and Gnumeric. KDE and Qt programmes appear to be unaffected. This can be fixed by creating a .gtkrc-2.0 file in your home directory with the following contents:

    gtk-font-name = "Bitstream Vera Sans 12"

Put whatever font and size you like. I have no information on the format of the gtkrc file. The above was adapted from a page found on Google.

Mozilla (which uses Gtk) needs some individual tweaking, as the UI fonts end up far too big. In preferences->fonts, set the resoultion to 72 DPI.

The above measures should only be required if you have forced 75DPI. I had no problems with Gtk apps prior to doing that.

Eagle

The problem with Eagle appears to be related to the fact that it uses Qt2 (statically linked) in a Qt3 environment. This might also occur with other apps, but Eagle is the only one I know about. When antialising is turned on via KDE control center, this modifies .qt/qtrc, and so affects all Qt applications. If I have anti-aliasing turned on, the fonts in Eagle are very ragged and badly spaced.

I fixed this by modifying the font path in XF86Config, to remove the entry /usr/X11R6/lib/X11/fonts/TTF. The problem appears to be that Eagle is picking up one of the True Type fonts, instead of a Type 1 or bitmapped font. Turning on antialing in Qt appears to alter its font selection behaviour (fontconfig?) as well as font rendering.

An interesting outcome of experimenting with the font path is that removing entries only affects older applications. KDE and other modern apps work perfectly well with only the mandatory /usr/X11R6/lib/X11/fonts/misc entry present. As far as I know, this is because modern toolkits like Qt3 and Gtk2 use fontconfig to find fonts.

Offline

Board footer

Powered by FluxBB