[OpenJDK 2D-Dev] Font Metrics in OpenJDK vs Sun JDK

Phil Race Phil.Race at Sun.COM
Thu Jun 12 14:19:06 UTC 2008

The -1 for leading is probably a bug somewhere. Maybe you can look into it
The difference in advance may be due to the absence of byte code hinting 
in the freetype found by OpenJDK.
Since you have Tahoma I have to assume you are running on windows and 
built your own freetype,
rather than using the one on the O/S. If you build freetype with hinting 
for testing purposes then
the difference may be much less.


Ben Loud wrote:
> 2D Folk,
> Since working with OpenJDK, I've notice that text just doesnt look 
> right. I made a simple comparison between Sun's JDK6 and OpenJDK see: 
> http://benloud.com/fonts.png You can see there are clearly significant 
> differences in the horizontal character spacing, particularly 
> noticable in "Beagle" and "Spirit", and also the heights are 
> different. I also compared the font metrics of a string:
> For Tahoma, plain, 11pt, "The Quick Brown Fox Jumped Over The Lazy Dog."
> AWT FontMetrics:
>            Ascent  Descent Leading Height  String Width
> Sun JDK:     11       3       0      14        241
> OpenJDK:     11       3      -1      13        265
> TextLayout:
>          Ascent       Descent     Leading   Advance    Bounds
> Sun JDK:  11.005371   2.2719727     0.0      240.0   
> [x=0.0,y=-8.359375,w=238.29688,h=10.625]
> OpenJDK:  11.0          3.0        -1.0      264.0   
> [x=0.0,y=0.0,w=263.29688,h=18.453125]
> Again you can see there are significant differences, particularly in 
> the advances and bounds, and the -1 for leading is a bit odd.
> Will it be possible to get metrics that are consistent with Suns JDK? 
> Because right now, Swing apps on OpenJDK look quite wrong to me.
> Thanks.

More information about the 2d-dev mailing list