[OpenJDK 2D-Dev] fix for 6697721 is incomplete

Omair Majid omajid at redhat.com
Thu Sep 2 14:51:31 UTC 2010


Hi,

I recently ran into a problem with using fractional font metrics with 
OpenJDK. The attached code (FractionalTextMetricsBug.java) reproduces 
the problem and the attached image shows the result on OpenJDK6 (which 
is the same as the result on OpenJDK7).

I believe this problem was introduced with the fix for 6697721 [1] as I 
observed this behaviour with OpenJDK6 after that particular fix was 
backported. The value of advh is based on ftglyph->linearHoriAdvance, 
which is the advance for the unhinted glyph [2]. If the glyph is hinted 
(which is often the case), ftglyph->metrics.horiAdvance gives a better 
value.

The attached patch is one attempt at fixing the problem. I am not sure 
if TEXT_AA_OFF (the antialiasing mode) is related to hinting - even 
though the comments in freetypescaler say that it is. With the patch, my 
test case works, and the text is rendered correctly with antialising set 
to either VALUE_TEXT_ANTIALIAS_ON, VALUE_TEXT_ANTIALIAS_OFF or 
VALUE_TEXT_ANTIALIAS_LCD_HRGB.

Thanks,
Omair

[1] http://hg.openjdk.java.net/jdk7/2d/jdk/rev/4092c04aeae7
[2] 
http://freetype.sourceforge.net/freetype2/docs/reference/ft2-base_interface.html#FT_GlyphSlotRec
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openjdk-fractional-metrics-advance-bug.png
Type: image/png
Size: 8439 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20100902/c73d616b/openjdk-fractional-metrics-advance-bug.png>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: FractionalTextMetricsBug.java
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20100902/c73d616b/FractionalTextMetricsBug.java>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openjdk-fractional-metrics-bug.patch
Type: text/x-patch
Size: 723 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20100902/c73d616b/openjdk-fractional-metrics-bug.patch>


More information about the 2d-dev mailing list