summaryrefslogtreecommitdiff
path: root/core/java/android/text/MeasuredText.java
Commit message (Collapse)AuthorAgeFilesLines
* Reorganize MeasuredText API (2nd)Seigo Nonaka2018-02-161-427/+0
| | | | | | | | | | | | | | | | | | | | | | | | This is 2nd attempt of I7db9e2ca4db68a16648cfb8fcf63555f501304c2 This CL changes the MeasuredText API: - Rename MeasuredText to PrecomputedText. - Introduce PrecomputedText.Param which holds all text layout parameters. - Add API to get PrecomputedText.Param from TextView. - Remove MeasuredText.Builder and add PrecomputedText.create method instead. - Remove setRange from MeasuredText since it is not for normal use case. (It can not be used for TextView) Bug: 67504091 Bug: 72861572 Test: bit FrameworksCoreTests:android.text. Test: atest CtsWidgetTestCases:EditTextTest \ CtsWidgetTestCases:TextViewFadingEdgeTest \ FrameworksCoreTests:TextViewFallbackLineSpacingTest \ FrameworksCoreTests:TextViewTest FrameworksCoreTests:TypefaceTest \ CtsGraphicsTestCases:TypefaceTest CtsWidgetTestCases:TextViewTest \ CtsTextTestCases Change-Id: Ie73bce52c6c673cda58973ddad04627a7cf2e5e9
* Revert "Reorganize MeasuredText API"Seigo Nonaka2018-02-141-0/+427
| | | | | | | | | | The last change needs more discussion and found some edge cases. Revert and make small step-by-step changes. Bug: 73091756 This reverts commit 7fd36d19e309ea515b4048cfaabb8035ceab7baf. Change-Id: I89ff52a70cf6a5d6c553afa20f83719e1f9eb726
* Reorganize MeasuredText APISeigo Nonaka2018-02-121-427/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL changes the MeasuredText API: - Rename MeasuredText to PrecomputedText. - PrecomputedText is no longer a Spanned. - Introduce PrecomputedText.Param which holds all text layout parameters. - Add API to get PrecomputedText.Param from TextView. - Remove MeasuredText.Builder and add PrecomputedText.create method instead. - Remove setRange from MeasuredText since it is not for normal use case. (It can not be used for TextView) Here is a performance scores: (median, walleye-userdebug, N=20) StaticLayout creation time (w/o patch -> w/ patch) PrecomputedText Balanced Hyphenation : 743,615 -> 737,145: (-0.9%) PrecomputedText Balanced NoHyphenation: 551,544 -> 542,715: (-1.6%) PrecomputedText Greedy Hyphenation : 500,343 -> 499,601: (-0.1%) PrecomputedText Greedy NoHyphenation : 497,987 -> 492,587: (-1.1%) RandomText Balanced Hyphenation : 19,100,592 -> 19,135,289: (+0.2%) RandomText Balanced NoHyphenation : 8,015,088 -> 7,954,260: (-0.8%) RandomText Greedy Hyphenation : 7,950,915 -> 7,877,424: (-0.9%) RandomText Greedy NoHyphenation : 7,939,337 -> 7,863,471: (-1.0%) PrecomputedText creation time (w/o patch -> w/ patch) NoStyled Hyphenation : 18,935,638 -> 18,925,422: (-0.1%) NoStyled Hyphenation WidthOnly : 18,469,726 -> 18,978,413: (+2.8%) NoStyled NoHyphenation : 7,940,792 -> 7,919,127: (-0.3%) NoStyled NoHyphenation WidthOnly : 7,463,230 -> 7,922,643: (+6.2%) Styled Hyphenation : 14,822,501 -> 14,809,017: (-0.1%) Styled Hyphenation WidthOnly : 13,891,770 -> 14,656,617: (+5.5%) Styled NoHyphenation : 14,511,134 -> 14,301,503: (-1.4%) Styled NoHyphenation WidthOnly : 13,495,345 -> 14,264,314: (+5.7%) StaticLayout draw time (w/o patch -> w/ patch) PrecomputedText NoStyled : 663,974 -> 661,610: (-0.4%) PrecomputedText NoStyled WithoutCache : 648,294 -> 648,766: (+0.1%) PrecomputedText Styled : 879,322 -> 852,770: (-3.0%) PrecomputedText Styled WithoutCache : 1,084,570 -> 1,110,147: (+2.4%) RandomText NoStyled : 565,682 -> 555,435: (-1.8%) RandomText NoStyled WithoutCache : 9,070,533 -> 9,064,825: (-0.1%) RandomText Styled : 2,955,202 -> 2,962,008: (+0.2%) RandomText Styled WithoutCache : 12,242,325 -> 12,228,573: (-0.1%) Bug: 67504091 Bug: 73091756 Test: bit FrameworksCoreTests:android.text. Test: atest CtsWidgetTestCases:EditTextTest \ CtsWidgetTestCases:TextViewFadingEdgeTest \ FrameworksCoreTests:TextViewFallbackLineSpacingTest \ FrameworksCoreTests:TextViewTest FrameworksCoreTests:TypefaceTest \ CtsGraphicsTestCases:TypefaceTest CtsWidgetTestCases:TextViewTest \ CtsTextTestCases Change-Id: I7db9e2ca4db68a16648cfb8fcf63555f501304c2
* Introduce MeasuredText related perf testsSeigo Nonaka2018-01-251-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL adds two perf test for MeasuredText: the memory usage and construction time of MeasuredText. Here is an example output on walleye-userdebug: Memory Usage (in bytes) Hyphenation : 28,448 Hyphenation WidthOnly : 8,856 NoHyphenation : 27,592 NoHyphenation WidthOnly: 8,000 MeasuredText creation time NoStyled Hyphenation : 18,977,877 NoStyled Hyphenation WidthOnly : 18,510,041 NoStyled NoHyphenation : 7,771,936 NoStyled NoHyphenation WidthOnly: 7,332,537 Styled Hyphenation : 13,514,428 Styled Hyphenation WidthOnly : 12,446,143 Styled NoHyphenation : 13,370,358 Styled NoHyphenation WidthOnly : 13,582,435 Bug: 72461923 Bug: 72462192 Test: See above Change-Id: I7d326a9e70a29c38c940e0085da2bc4edf2a098a
* Compute full text layout in MeasuredText and use it for drawingSeigo Nonaka2018-01-231-2/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The full layout is required for drawing text on UI thread. To save this work, store the full layout result in MeasuredText and compose the final layout from stored full layout if possible. Currently justification/hyphenation is not supported but works normally as before. Nothing changes on existing non measured text. StaticLayout creation time for no style text (w/o patch -> w/ patch, N=30) MeasuredText Balanced Hyphenation : 721,297 -> 720,657: (-0.1%) MeasuredText Balanced NoHyphenation: 550,588 -> 546,069: (-0.8%) MeasuredText Greedy Hyphenation : 503,582 -> 498,009: (-1.1%) MeasuredText Greedy NoHyphenation : 502,344 -> 498,507: (-0.8%) RandomText Balanced Hyphenation : 19,351,802 -> 19,176,024: (-0.9%) RandomText Balanced NoHyphenation : 8,033,830 -> 7,973,336: (-0.8%) RandomText Greedy Hyphenation : 7,957,335 -> 7,927,316: (-0.4%) RandomText Greedy NoHyphenation : 7,988,884 -> 7,929,717: (-0.7%) StaticLayout.draw time for no style text (w/o patch -> w/ patch, N=30) MeasuredText NoStyled : 644,453 -> 660,684: (+2.5%) MeasuredText NoStyled WithoutCache : 9,251,919 -> 648,992: (-93.0%) MeasuredText Styled : 3,092,353 -> 870,702: (-71.8%) MeasuredText Styled WithoutCache : 12,544,014 -> 1,114,557: (-91.1%) RandomText NoStyled : 582,167 -> 572,092: (-1.7%) RandomText NoStyled WithoutCache : 9,167,670 -> 9,056,447: (-1.2%) RandomText Styled : 3,064,490 -> 3,029,028: (-1.2%) RandomText Styled WithoutCache : 12,314,863 -> 12,283,026: (-0.3%) Test: minikin_test Test: bit CtsTextTestCases:* Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest Test: bit FrameworksCoreTests:android.text.MeasuredParagraphTest Bug: 63897135 Change-Id: I7e6ec5c953d7d0f767aba4f61f94e62b6f3a3a2b
* Compute hyphenated word pieces in MeasuredTextSeigo Nonaka2018-01-181-52/+145
| | | | | | Bug: 67504091 Test: bit CtsTextTestCases:* Change-Id: Id1ff5abbf6d433a2d8baad364133fca98d1fe450
* Rename PremeasuredText to MeasuredTextSeigo Nonaka2018-01-111-572/+166
| | | | | | | | | | There is already MeasuredText, so renamed existing MeasuredText to MeasuredParagraph, then renamed PremeasuredText to MeasuredText. Bug: 67504091 Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest Test: bit CtsTextTestCases:* Change-Id: Ie20bea9501b18fabb36f64d388a7851c4643d4c3
* Associate native MeasuredText with Java one.Seigo Nonaka2017-12-051-32/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | To measure text beforehand, remove static layout dependency from MeasuredText. Now MeasuredText can compute native measured text by itself and StaticLayout use it for line breaking. This CL introduce one additional JNI method call per paragraph during line breaking but looks negligible cost. Here is a raw performance test result on walleye-userdebug. StaticLayoutPerfTest (median, N=100): createRandom: 7,879,440 -> 7,964,789 (+1.08%) createRandom Balanced: 7,835,192 -> 7,848,151 (+0.17%) TextViewOnMeasurePerfTest (median, N=100): measure_AtMost: 92,599,175 -> 93,027,121 (+0.47%) measure_Exactly: 89,949,922 -> 90,439,886 (+0.54%) measure_Unspecified: 148,645,916 -> 150,047,694 (+0.94%) Bug: 67504091 Test: bit CtsTextTestCases:* Test: bit CtsWidgetTestCases:* Test: bit CtsGraphicsTestCases:* Test: bit FrameworksCoreTests:android.text.StaticLayoutTest Change-Id: Ie932903845645e50cfa0cb428babb31a44babc47
* Refactor MeasuredTextSeigo Nonaka2017-12-051-171/+460
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is 2nd attempt of I58d3020a3fa560d05576e18888fbfe46e2975e8f The root cause of the crash is passing end offset instead of passing length. This CL contains that fix and also has a test case for that. This refactoring contains: - Add lots of comments. - Mark private the internal fields and introduce accessors and helper methods. - Factor out the auto grow array implementation to another class. - Use SynchronizedPool for pool implementation. - Introduce three build methods for each use case. - Hide addStyleRun and compute all necessary informations in build method. Locally verified that this doesn't cause performance regressions. Here is a raw performance test result on walleye-userdebug. StaticLayoutPerfTest (median, N=100): createRandom: 7,846,449 -> 8,003,903 (+2.01%) createRandom Balanced: 7,810,436 -> 7,919,200 (+1.40%) TextViewOnMeasurePerfTest (median, N=100): measure_AtMost: 94,276,376 -> 94,124,658 (-0.16%) measure_Exactly: 91,629,352 -> 91,617,639 (-0.01%) measure_Unspecified: 151,006,181 -> 150,957,598 (-0.03%) Test: bit CtsTextTestCases:* Test: bit CtsGraphicsTestCases:* Test: bit CtsWidgetTestCases:* Test: bit FrameworksCoreTests:android.text.StaticLayoutTest Bug: 65024629 Bug: 70146381 Change-Id: I772f60444d0fe87f59609977af5ef712cab3eb37
* Revert "Refactor MeasuredText"Seigo Nonaka2017-12-041-459/+170
| | | | | | | | This reverts commit 75492afb1b6566c889025e9ca0a15a0d0fe422aa. Reason for revert: 70146381 Change-Id: Ibb6433b5e02608326ef51cc16d8d5d8efa86beec
* Refactor MeasuredTextSeigo Nonaka2017-11-301-170/+459
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This refactoring contains: - Add lots of comments. - Mark private the internal fields and introduce accessors and helper methods. - Factor out the auto grow array implementation to another class. - Use SynchronizedPool for pool implementation. - Introduce three build methods for each use case. - Hide addStyleRun and compute all necessary informations in build method. Locally verified that this doesn't cause performance regressions. Here is a raw performance test result on walleye-userdebug. StaticLayoutPerfTest (median, N=100): createRandom: 7,846,449 -> 8,003,903 (+2.01%) createRandom Balanced: 7,810,436 -> 7,919,200 (+1.40%) TextViewOnMeasurePerfTest (median, N=100): measure_AtMost: 94,276,376 -> 94,124,658 (-0.16%) measure_Exactly: 91,629,352 -> 91,617,639 (-0.01%) measure_Unspecified: 151,006,181 -> 150,957,598 (-0.03%) Test: bit CtsTextTestCases:* Test: bit CtsGraphicsTestCases:* Test: bit CtsWidgetTestCases:* Test: bit FrameworksCoreTests:android.text.StaticLayoutTest Bug: 65024629 Change-Id: I58d3020a3fa560d05576e18888fbfe46e2975e8f
* Reorganize JNI in StaticLayoutSeigo Nonaka2017-10-241-19/+24
| | | | | | | | | | | | | | | | | | | | | | | | This CL reorganize the JNI strategy as follows: - Remove nNewBuilder/nFreeBuilder. - Make addStyleRun/addReplacementRun CriticalNative. - Remove nSetupParagraph and pass necessary arguments to nComputeLineBreaks instead. Here is a performance scores: (w/o patch -> w/ patch) StaticLayoutPerfTest (median): createRandom: 3,755,090 -> 3,781,394 (+0.70%) createRandom Balanced: 3,702,837 -> 3,730,435 (+0.74%) TextViewOnMeasurePerfTest (median): measure_AtMost: 39,172,360 -> 35,883,014 (-8.4%) measure_Exactly: 38,005,066 -> 34,585,052 (-9.0%) measure_Unspecified: 67,191,780 -> 63,100,545 (-6.1%) Bug: 65024629 Test: bit CtsTextTestCases:* Test: bit CtsWidgetTestCases:* Change-Id: If9db1fdd2b03a1cf240f87322c1e852cf8085fff
* Replace JNI portion of AndroidBidi with calls to ICU4JRoozbeh Pournader2017-10-191-3/+3
| | | | | | | | We no longer need the native calls to ICU since we have ICU4J. Fixes: 67786879 Test: bit FrameworksCoreTests:android.text. Change-Id: Ib2ec93017000b4f0343756814ca388bd31457849
* Stop returning run width of StaticLayout.Builder.addStyleRun.Seigo Nonaka2017-10-031-3/+13
| | | | | | | | | | The return value of addStyleRun is not used. By no longer returning run width, the LineBreaker can defer the style and line breaking calculation. Bug: 65024629 Test: bit CtsTextTestCases:* Change-Id: I2c835ff1c58657863da12976e71007c29b1bb039
* Remove unused method setPos from MeasuredText.Seigo Nonaka2017-10-021-4/+0
| | | | | | Bug: 65024629 Test: Verified with TreeHugger Change-Id: I023532c9decbc7b798aa4cb2dedc5ca5fb8d96f0
* Remove StaticLayout.addMeasuredRunSeigo Nonaka2017-09-291-22/+8
| | | | | | | | | | | | StaticLayout.addMeasuredRun is used if the TextPaint is subclassed. However, developers can't do almost anything by subclassing TextPaint since most of default things are done in native code. So we don't need to support this tricky case anymore. Bug: 65024629 Bug: 67009717 Test: bit FrameworksCoreTests:android.text.StaticLayoutLineBreakingTest Change-Id: I290b8b7d3e1fcff7be78e4bd1e620d6c188a10ad
* Fix StaticLayoutLineBreaker testsSeigo Nonaka2017-09-281-3/+3
| | | | | | | | | | | | StaticLayoutLineBreaker fails due to not passing locales to word breaker. Also addReplacement needs locale and hyphenators. In addition, need to update mLocales in StaticLayout, otherwise always pases the locale to native. Bug: 67020487 Test: bit FrameworksCoreTests:android.text.StaticLayoutLineBreakingTest Change-Id: I9ef5f9a8d8beabbb4c341f6203635b649d2efed9
* Make ellipsis START and MIDDLE grapheme cluster aware.Keisuke Kuroyanagi2016-09-141-1/+3
| | | | | | | | | | | | | | When text contains 2 emojis and each emoji has 2-code units, the width array will be like [10, 0, 10, 0]. In this case, without this CL, just the first code unit can be replaced with the ellipsis marker. This CL makes ellipsis START and MIDDLE grapheme cluster aware. Note that ellipsis END is working properly even without this CL. Bug: 30613917 Change-Id: I38ff9793f2ea381460c50465c5470e0ad9a405b9
* Start moving text measurement into native codeRaph Levien2015-03-131-8/+38
| | | | | | | | | | | We want to move text measurement into native code, mostly so that alternate measurement for hyphens can be performant. This patch begins that migration, in the main StaticLayout case, but still surfaces the widths array to Java (for ellipsis calculation), and also includes a hack (used mostly for testing) for computing widths in Java and sending them down to native code when TextPaint is subclassed. Change-Id: I476c9e8b3aa8e4e3552eb18f66c4bcd5683f3a72
* Some refactoring of StaticLayoutRaph Levien2015-03-041-10/+16
| | | | | | | | | | | | | | | | This patch refactors construction of StaticLayout to use an explicit Builder object, which is intended to hold state used for constructing the layout but not needed for merely reading out the results. Builder objects are allocated from a pool and explicitly recycled, so there is insignificant additional allocation cost. This patch has very little impact on performance (it does avoid allocating a FontMetricsInt object) but opens the way for significant performance and functionality improvements as more of the Builder functionality migrates to native code. Change-Id: I2a576643e573a38b61f895a80d5d92a85c94b6b4
* Clean up dirFlags / bidiFlags confusionRaph Levien2014-06-161-5/+4
| | | | | | | | | | | | | | | | | | | The dirFlags and bidiFlags enums are distinct, and have different meanings. The former is a determined direction for a run of text, while the latter is a request for the bidi algorithm. They have been used interchangeably, and this has caused some problems, notably running the bidi algorithm needlessly when the direction for a run is already determined. This patch cleans up the confusion, by always naming each occurrence explicitly "boolean isRtl" or "int bidiFlags" (the previous code often just used "int flags", which added to the confusion), and converts between the meanings when a function takes an isRtl argument but passes it to another function expecting bidiFlags. Fixes b/15089607 Clean up bidi flag mess Change-Id: I410b6604376e853dd12c255e7f5a9d2b9a310dd9
* Uses VMRuntime.newUnpaddedArray for ideal array sizesAdam Lesinski2014-03-271-3/+3
| | | | | | Bug:13028925 Change-Id: I0a9301248b10a339afbdc5e4ffe3310ac4fa1fb7
* Make MeasuredText.sCached field finalBrian Carlstrom2013-08-291-1/+1
| | | | Change-Id: Id3be64c48be1bcf55ac1a4b00b76a40861bf2f61
* Revert "Clean Paint.mBidiFlags as it is no longer used"Fabrice Di Meglio2013-03-151-2/+5
| | | | This reverts commit 6d9fe5bd22b531bfce69b146254a4791c76acddc.
* Clean Paint.mBidiFlags as it is no longer usedFabrice Di Meglio2013-02-121-5/+2
| | | | | | See bug #7623824 Change-Id: Ie2f9422821f6dcc73c99e8695f448e966b587b1d
* Fix for bug 6716343. Use correct offset for mPos reset.Raph Levien2012-07-091-1/+1
| | | | | | | | | | The mPos field in the MeasuredText object is relative to the start of the text (mTextStart), but the pos passed in by the caller of the setPos() method is relative to the character sequence. When spans overlap break boundaries and the paragraph doesn't start at 0, the result is an out of bounds error. This fix uses the correct offset. Change-Id: I12c7a2311a9bdbbea7ab21554a922b7f665a17bf
* Fixed text rendering issue with spans.Gilles Debunne2012-06-151-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug 6598784 The algorithm uses three imbricated loops: - paragraphs - span regions (called "blocks" in that description) in these - characters in these We can ignore the paragraphs and assume paraStart==0. The span region loop cuts the text into blocks of text which share the same set of MetricAffectingSpan spans applied to them. Note that spanStart and spanEnd represent such a range, and not necessarily an actual span range. The third loop then iterates over the characters of these blocks, and creates a new line (calling out() as soon as the width has been reached. The core of the problem comes from the 'nextSpanStart' variable. It is used to restart the block loop from a previous position in case a line has been created that does not intersect with the current block. However, in case the current block is larger than the width of the text, the character loop is going to create other lines of text before we exit the j-loop. Going back to the block loop, we reset spanStart to the nextSpanStart, which may be too far back in the text. As a result, the same range of characters is measured again. The (spanStart == spanEnd) test was used to handle the case where nextSpanStart was indeed assigned to a value different than spanEnd. This fix simplifies this logic and removes the nextSpanStart variable: When the created line ends before the current block (here < spanStart), we immediately exit the character loop, re-starting the block loop from the current position. Patch 4: added a fix in measured to handle overlapping character ranges. Change-Id: Ie71b3cf4018b332e335ea916fef08acb43a6679e
* Ellipsize avoids spaces and starts right after textGilles Debunne2012-02-231-11/+15
| | | | | | | | | | | | | Bug 5509226 Change ellipsize bounds to take spaces into account The hardcoded ' ' character may be problematic with other langages. Note that a different ellipsize logic also exists in StaticLayout. Created 6062415 to track this. Change-Id: I3406ec23a592f952bf3e0ca68f0838ee807baba0
* Fix for AOOB in MeasuredTextGilles Debunne2012-01-231-0/+3
| | | | | | Bug 5707593 Change-Id: I3c21343b2938119d7ae9d7892733dc83a209c991
* Plug memory leak in EditText.Romain Guy2011-08-011-21/+21
| | | | Change-Id: I0b42c23ceeaa958d02255945c35ff6807c177114
* Implement textDirection heuristic selection.Doug Felt2011-07-141-2/+18
| | | | Change-Id: I2fcf18de573f2d66494fa5ed61e4273c3c6078c7
* Replacement spans correctly measured in TextViewGilles Debunne2011-05-271-2/+3
| | | | | | Bug 4444591 Change-Id: I74c94445806d6c00b0971146cac57363c7d3f205
* Remove MeasuredText debug messagesKenny Root2011-01-311-2/+5
| | | | | | | | MeasuredText debug messages were left in the tree. Remove them before shipping. Bug: 3408963 Change-Id: Ia220eae5835d1325bb6053de0025d8016a1edcad
* Move shaping to native.Doug Felt2010-06-101-48/+27
| | | | | | | | | | | | | | | | | Add internal API (getTextRunAdvances) to Paint, use when measuring. Add internal API (getTextRunCursor) to Paint, use when determining valid cursor positions. Remove java-level shaping code. Remove 'prep' code in TextLine (except for replacement text) since shaping now is done on the fly as needed in native. Provide explicit shaping context bounds to internal text measuring, cursor movement, and rendering APIs. Update for to changes in external API in ushape.h. Change-Id: I146958b624802ce8553125e5c3c6c03031bc9608
* Refactor Styled utility functions into reusable objects.Doug Felt2010-04-071-0/+250
This takes utility functions from Styled and a few other classes and incorporates them into two new utility classes, TextLine and MeasuredText. The main point of this is to support shaping by skia, to experiment with how this will look, this also introduces character-based Arabic shaping. MeasuredText is used by code that determines line breaks by generating and examining character widths in logical order. Factoring the code in this way makes it usable by the ellipsize functions in TextUtils as well as by StaticLayout. This class takes over the caching of widths and chars arrays that was previously performed by StyledText. A small number of MeasuredText objects are themselves cached by the class and accesed using static obtain and recycle methods. Generally only these few cached instances are ever created. TextLine is used by code that draws or measures text on a line. This unifies the line measuring and rendering code, and pushes assumptions about how rtl text is treated closer to the points where skia code is invoked. TextLine implements the functions that were previously provided by Styled, working on member arrays rather than explicitly-passed arguments. It implements the same kind of static cache as MeasuredText. TextLine and MeasureText simulate arabic glyph generation and shaping by using ArabicShaping, ported with very minor changes from ICU4J's ArabicShaping. This class generates shaped Arabic glyphs and Lam-Alef ligatures using Unicode presentation forms. ArabicShaping is not intended to be permanent, but to be replaced by real shaping from the skia layer. It is introduced in order to emulate the behavior of real shaping so that higher level code dealing with rendering shaped text and cursor movement over ligatures can be developed and tested; it also provides basic-level support for Arabic. Since cursor movement depends on conjuncts whose formation is font-dependent, cursor movement code that was formerly in Layout and StaticLayout was moved into TextLine so that it can work on the shaped text. Other than these changes, the other major change is a rework of the ellipsize utility functions to combine multiple branches into fewer branches with additional state. Updated copyright notices on new files. Change-Id: I492cb58b51f5aaf6f14cb1419bdbed49eac5ba29