JDK-2194662 : FontMetrics.getLeading() may be negative in freetype-based OpenJDK builds
  • Type: Backport
  • Backport of: JDK-6961732
  • Component: client-libs
  • Sub-Component: 2d
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2010-06-16
  • Updated: 2010-12-03
  • Resolved: 2010-06-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 7 Other
7Fixed OpenJDK6Fixed
Comments
SUGGESTED FIX # HG changeset patch # User neugens # Date 1276713970 -7200 # Node ID 388276965253fbfd368d9d095cfb1efd746181d9 # Parent 40ad1b388fc2df199ee50d233fdc3f1eac273701 6961732: FontMetrics.getLeading() may be negative in freetype-based OpenJDK builds. Summary: Fix premature integer roundings to preserve correct height, width and descent values for fonts Reviewed-by: prr --- a/src/share/native/sun/font/freetypeScaler.c Fri Jun 18 01:18:22 2010 -0700 +++ b/src/share/native/sun/font/freetypeScaler.c Wed Jun 16 20:46:10 2010 +0200 @@ -490,22 +490,23 @@ Java_sun_font_FreetypeFontScaler_getFont /* ascent */ ax = 0; - ay = -(jfloat) FT26Dot6ToFloat( - scalerInfo->face->size->metrics.ascender + - bmodifier/2); + ay = -(jfloat) FT26Dot6ToFloat(FT_MulFix( + ((jlong) scalerInfo->face->ascender + bmodifier/2), + (jlong) scalerInfo->face->size->metrics.y_scale)); /* descent */ dx = 0; - dy = -(jfloat) FT26Dot6ToFloat( - scalerInfo->face->size->metrics.descender + - bmodifier/2); + dy = -(jfloat) FT26Dot6ToFloat(FT_MulFix( + ((jlong) scalerInfo->face->descender + bmodifier/2), + (jlong) scalerInfo->face->size->metrics.y_scale)); /* baseline */ bx = by = 0; /* leading */ lx = 0; - ly = (jfloat) FT26Dot6ToFloat( - scalerInfo->face->size->metrics.height + - bmodifier) + ay - dy; + ly = (jfloat) FT26Dot6ToFloat(FT_MulFix( + (jlong) scalerInfo->face->height + bmodifier, + (jlong) scalerInfo->face->size->metrics.y_scale)) + + ay - dy; /* max advance */ mx = (jfloat) FT26Dot6ToFloat( scalerInfo->face->size->metrics.max_advance +
22-06-2010

PUBLIC COMMENTS See http://hg.openjdk.java.net/jdk6/jdk6/jdk/rev/388276965253
22-06-2010

EVALUATION Backport.
16-06-2010