提交 3e407e10 编写于 作者: N neugens

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
上级 6f6362ef
......@@ -490,22 +490,23 @@ Java_sun_font_FreetypeFontScaler_getFontMetricsNative(
/* 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 +
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册