Skip to content
Commit e88b5df5 authored by Roozbeh Pournader's avatar Roozbeh Pournader
Browse files

Make ellipsize retry if text doesn't fit

This fixes the cases where the replacement of parts of text with
ellipsis may result in more-than-expected width of text due to
contextual width changes in the font, such as kerning or Arabic
shaping.

The calculations in TextUtils.ellipsize() and StaticLayout are fixed
to recalculate the new width and reduce it further until the text
actuall fits. BoringLayout and DynamicLayout get fixed too since
they use the other two implementations indirectly.

Also reverse a recently-introduced incorrect check for
multi-character ellipsis in Layout.java.

Fixes: 31537595
Fixes: 64156587
Test: Manual (Arabic edge cases ellipsize correctly)
Test: bit CtsTextTestCases:*
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.EditTextTest
Test: bit CtsWidgetTestCases:android.widget.cts.CheckedTextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.AutoCompleteTextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.MultiAutoCompleteTextViewTest
Test: bit FrameworksCoreTests:android.text.
Test: adb shell am instrument -w com.android.documentsui.tests/android.support.test.runner.AndroidJUnitRunner
Change-Id: Iaddcc8b01c78d477e2c29b339d321c9631426f34
parent a19cd51d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment