Playing nice with Gnome desktop
September 29th, 2007 | 2 Comments »A few months ago i wrote about Mac-specific font policy in Substance look-and-feel that makes all Substance-powered Swing application pick the correct font sizes when running under Mac OS. In the past few days i’ve added a font policy for Gnome desktops (Ubuntu among the rest), following a bug report opened by one of the users.
It pretty much follows the implementation of GtkLookAndFeel in JDK 6.0, querying the gnome.Gtk/FontName and gnome.Xft/DPI desktop properties to honor both the default desktop font size and the custom DPI setting.
Here is how an application looks like when it runs under Ubuntu 7.04 with the latest 4.1dev drop of Substance:

Here is how the same application looks like under TSCu_Times font with base size 9 and 144DPI setting (the default is 96DPI):

Note that you don’t need to change anything in your application – Substance handles the font size computation on its own. In addition, it also picks up the desktop anti-aliasing settings when it runs under JDK 6.0 and later.
Related posts:
- Playing nice with KDE desktop Following my entries on platform-specific font policies for Mac and Gnome, one of Substance users...
- Matching desktop fonts and native font rasterization Three weeks ago the following RFE was filed in the bug tracker under Java2D team:...
- Revolutionizing media playing in Java It is always exciting to see an elegant and polished desktop application, and it is...
Possibly this would be a nice thing for other Laf to have? I know you have a common infrastructure project with other look and feels so can this be moved there?
Thanks for the suggestion. The project you’re talking about was refactored out of Substance in May 2006, and since then Substance is still the only LAF that is using it as far as i know. So, in the meantime, the font policy layer (that is based on Looks font policy layer) will stay in Substance codebase.