JDK-6378474 : GTK L&F: Menu font and spacing do not match native UI using Ubuntu
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 1.4.2_16,6
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux,linux_redhat_3.0
  • CPU: x86
  • Submitted: 2006-01-30
  • Updated: 2011-02-24
  • Resolved: 2006-03-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b77Fixed
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.6.0-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-rc-b68)


ADDITIONAL OS VERSION INFORMATION :
Linux elite 2.6.12-10-686 #1 Mon Jan 16 17:58:04 UTC 2006 i686 GNU/Linux


EXTRA RELEVANT SYSTEM CONFIGURATION :
I'm running Ubuntu 5.10 (breezy) with the gnome desktop. Furhter, I'm using the standard theme called 'Human', which ships with this distribution.

A DESCRIPTION OF THE PROBLEM :
The Menu font and spacing do not match native UI using the GTK L&F. It would be great if the menu wouldn't be distinguishable from the other gnome applications, if the standard font (Dialog Bold 12?) is used in Java. (I use no setFont call at all!).

The see the difference, I've made two screenshots, both showing a selfmade JSwing Application and the Rhythmbox Music Player (native Gnome App).

Btw using the famous 'Clearlooks' there is also a little difference, but in contrast to that one, the spacing seems to be a bit smaller, but almost not noticable.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Either write the code for showing a JMenu by hand or use an GUI Editor like the one from Netbeans.

Start a native GTK2 application and compare both with the 'Human' theme.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The two menu bars should have the same font and spacing.
ACTUAL -
The font and spacing in the JMenu is much bigger than in the native GTK app.

REPRODUCIBILITY :
This bug can be reproduced always.

Comments
EVALUATION Although its not the full imagined fix for 6275318, we can go a long way there by doing something similar to what happens for the windows L&F. We can extract the primary font via platform API (libfontconfig) and use that with the rest of the most appropriate logical composite font as a fallback as the font that's use by the GTK L&F. This means for the most part, all the text the user sees will come from the same physical font as native GTK apps. It will be rasterised by 2D which means that some differences will remain : eg 2D performs full truetype hinting unlike the freetype rasteriser used by GTK apps. Inspection for the most typical modern case of using TrueType fonts (specifically the Bitstream one) shows that the differences are "small". The font "height" is based on the bitstream one. So any menu differences that remain ought to be largely addressed by other GTK L&F bugs. For example mnemonics are usually displayed too low. I also measured the peformance hit on start up : it added about 40-50ms on my Solaris 10 SPARC box which in the context of a minimal "JButton" displaying GTK L&F app was roughly 4% added to the 1000ms start up time as measured by time to return from painting that JButton component. The Swing GTK L&F loads the GTK native libs anyway so some of the libfontconfig initialisation cost was apparently already being taken. This 40ms is a fixed penalty that only affects GTK L&F.
24-02-2006

EVALUATION Likely a duplicate of this bug: 6275318 RFE: use fontconfig to expand GTK logical font definitions Need to check back when this RFE is fixed.
03-02-2006