--- old/src/java.desktop/share/native/libfontmanager/freetypeScaler.c 2018-11-10 19:33:03.000000000 +0300 +++ new/src/java.desktop/share/native/libfontmanager/freetypeScaler.c 2018-11-10 19:33:03.000000000 +0300 @@ -461,6 +461,8 @@ /* See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=657854 */ #define FT_MulFixFloatShift6(a, b) (((float) (a)) * ((float) (b)) / 65536.0 / 64.0) +#define contextAwareMetricsX(vx, vy) (FTFixedToFloat(context->transform.xx) * (vx) - FTFixedToFloat(context->transform.xy) * (vy)) +#define contextAwareMetricsY(vx, vy) (-FTFixedToFloat(context->transform.yx) * (vx) + FTFixedToFloat(context->transform.yy) * (vy)) /* * See FreeType source code: src/base/ftobjs.c ft_recompute_scaled_metrics() * http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1659 @@ -491,9 +493,13 @@ my = 0; metrics = (*env)->NewObject(env, - sunFontIDs.strikeMetricsClass, - sunFontIDs.strikeMetricsCtr, - ax, ay, dx, dy, bx, by, lx, ly, mx, my); + sunFontIDs.strikeMetricsClass, + sunFontIDs.strikeMetricsCtr, + contextAwareMetricsX(ax, ay), contextAwareMetricsY(ax, ay), + contextAwareMetricsX(dx, dy), contextAwareMetricsY(dx, dy), + bx, by, + contextAwareMetricsX(lx, ly), contextAwareMetricsY(lx, ly), + contextAwareMetricsX(mx, my), contextAwareMetricsY(mx, my)); return metrics; }