commit | fccc122027c2bc5c590e26dd1d93dac7754dcb4c | [log] [tgz] |
---|---|---|
author | Jerome Gaillard <jgaillard@google.com> | Tue May 09 18:23:23 2017 +0100 |
committer | Jerome Gaillard <jgaillard@google.com> | Tue May 09 18:23:23 2017 +0100 |
tree | da31bedc2c0d016ab1f9df22e710445e95a6b0ef | |
parent | 7b9cebcc4bbdd893d9e01848cd50733368e48775 [diff] |
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
diff --git a/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java index 1bb56e3..60e5cd9 100644 --- a/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
@@ -596,10 +596,10 @@ 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(); }
diff --git a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/activity.png b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/activity.png index affc31e..773c5be 100644 --- a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/activity.png +++ b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/activity.png Binary files differ
diff --git a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/allwidgets.png b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/allwidgets.png index bd78353..4391f47 100644 --- a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/allwidgets.png +++ b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/allwidgets.png Binary files differ
diff --git a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/allwidgets_tab.png b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/allwidgets_tab.png index 88fa9dd..bb69ca8 100644 --- a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/allwidgets_tab.png +++ b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/allwidgets_tab.png Binary files differ
diff --git a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/array_check.png b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/array_check.png index ee72a6f..0835d51 100644 --- a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/array_check.png +++ b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/array_check.png Binary files differ
diff --git a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/font_test.png b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/font_test.png index 736b287..7e0c29a 100644 --- a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/font_test.png +++ b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/font_test.png Binary files differ
diff --git a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/four_corners.png b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/four_corners.png index a8567b3..ffba2b5 100644 --- a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/four_corners.png +++ b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/four_corners.png Binary files differ
diff --git a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/four_corners_translucent.png b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/four_corners_translucent.png index 5ae95ea..b73b359 100644 --- a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/four_corners_translucent.png +++ b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/four_corners_translucent.png Binary files differ
diff --git a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/four_corners_translucent_land.png b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/four_corners_translucent_land.png index b2b6a97..09fd279 100644 --- a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/four_corners_translucent_land.png +++ b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/four_corners_translucent_land.png Binary files differ
diff --git a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/shadows_test.png b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/shadows_test.png index 4951629..f1eecf0 100644 --- a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/shadows_test.png +++ b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/shadows_test.png Binary files differ
diff --git a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/simple_activity-old-theme.png b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/simple_activity-old-theme.png index e0abcf4..b6f3737 100644 --- a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/simple_activity-old-theme.png +++ b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/simple_activity-old-theme.png Binary files differ
diff --git a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/simple_activity.png b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/simple_activity.png index 3d0fbd6..fd6e6b6 100644 --- a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/simple_activity.png +++ b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/simple_activity.png Binary files differ
diff --git a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/simple_activity_noactionbar.png b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/simple_activity_noactionbar.png index 86b00415..ef20727 100644 --- a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/simple_activity_noactionbar.png +++ b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/simple_activity_noactionbar.png Binary files differ