Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fccc1220 authored by Jerome Gaillard's avatar Jerome Gaillard
Browse files

Modify font metrics computation to match Android

On Android, font metrics top and bottom seem 15% larger than ascent and
descent. Paint_Delegate is modified to reflect this fact.

Test: layoutlib tests updated
Bug: 38117115
Change-Id: I4e9995ccbc991fbb857c8e3af45a908ad55db99e
parent 7b9cebcc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -596,10 +596,10 @@ public class Paint_Delegate {
            java.awt.FontMetrics javaMetrics = delegate.mFonts.get(0).mMetrics;
            if (fmi != null) {
                // Android expects negative ascent so we invert the value from Java.
                fmi.top = - javaMetrics.getMaxAscent();
                fmi.top = (int)(- javaMetrics.getMaxAscent() * 1.15);
                fmi.ascent = - javaMetrics.getAscent();
                fmi.descent = javaMetrics.getDescent();
                fmi.bottom = javaMetrics.getMaxDescent();
                fmi.bottom = (int)(javaMetrics.getMaxDescent() * 1.15);
                fmi.leading = javaMetrics.getLeading();
            }

+163 B (35.2 KiB)
Loading image diff...
+624 B (65.8 KiB)
Loading image diff...
+369 B (51.4 KiB)
Loading image diff...
+227 B (26.6 KiB)
Loading image diff...
Loading