6961732: FontMetrics.getLeading() may be negative in freetype-based OpenJDK builds
Fix premature integer roundings to preserve correct height, width and descent values for fonts Reviewed-by: prr
This commit is contained in:
parent
599d2d5eaf
commit
cb437cbfe4
@ -490,22 +490,23 @@ Java_sun_font_FreetypeFontScaler_getFontMetricsNative(
|
|||||||
|
|
||||||
/* ascent */
|
/* ascent */
|
||||||
ax = 0;
|
ax = 0;
|
||||||
ay = -(jfloat) FT26Dot6ToFloat(
|
ay = -(jfloat) FT26Dot6ToFloat(FT_MulFix(
|
||||||
scalerInfo->face->size->metrics.ascender +
|
((jlong) scalerInfo->face->ascender + bmodifier/2),
|
||||||
bmodifier/2);
|
(jlong) scalerInfo->face->size->metrics.y_scale));
|
||||||
/* descent */
|
/* descent */
|
||||||
dx = 0;
|
dx = 0;
|
||||||
dy = -(jfloat) FT26Dot6ToFloat(
|
dy = -(jfloat) FT26Dot6ToFloat(FT_MulFix(
|
||||||
scalerInfo->face->size->metrics.descender +
|
((jlong) scalerInfo->face->descender + bmodifier/2),
|
||||||
bmodifier/2);
|
(jlong) scalerInfo->face->size->metrics.y_scale));
|
||||||
/* baseline */
|
/* baseline */
|
||||||
bx = by = 0;
|
bx = by = 0;
|
||||||
|
|
||||||
/* leading */
|
/* leading */
|
||||||
lx = 0;
|
lx = 0;
|
||||||
ly = (jfloat) FT26Dot6ToFloat(
|
ly = (jfloat) FT26Dot6ToFloat(FT_MulFix(
|
||||||
scalerInfo->face->size->metrics.height +
|
(jlong) scalerInfo->face->height + bmodifier,
|
||||||
bmodifier) + ay - dy;
|
(jlong) scalerInfo->face->size->metrics.y_scale))
|
||||||
|
+ ay - dy;
|
||||||
/* max advance */
|
/* max advance */
|
||||||
mx = (jfloat) FT26Dot6ToFloat(
|
mx = (jfloat) FT26Dot6ToFloat(
|
||||||
scalerInfo->face->size->metrics.max_advance +
|
scalerInfo->face->size->metrics.max_advance +
|
||||||
|
Loading…
x
Reference in New Issue
Block a user