We no longer need the native calls to ICU since we have ICU4J.
Fixes: 67786879
Test: bit FrameworksCoreTests:android.text.
Change-Id: Ib2ec93017000b4f0343756814ca388bd31457849
This CL contains the following changes:
- Replace Hyphenator mapping in Java with minikin::HyphenatorMap.
- Remove locale tracking code from StaticLayout.java
- Stop creating Hyphenator pointer array in StaticLayout.
Bug: 65024629
Bug: 67319341
Test: bit CtsTextTestCases:*
Test: bit FrameworksCoreTests:android.text.
Test: bit FrameworksCoreTests:android.widget.TextViewTest
Change-Id: Ib88c8e816c70959057abe296cc434ddb70bc397a
After I7e2ece979181d12ac1adbede14995ec9b7b87d21, the special hyphenation
logic for Catalan and Policy was not working.
Bug: 65024629
Bug: 67702053
Test: N/A
Change-Id: I985253e24cf0ce4e537c01074e75054381a7816a
nGetWidths was always called just before nComputeLineBreaks. It would be
an improvement to pass the result array as the argument of
nComputeLineBreaks.
Bug: 65024629
Test: bit FrameworksCoreTests:android.text.StaticLayoutLineBreakingTest
Test: bit CtsTextTestCase:*
Test: Manually checked no regression in TextViewOnMeasurePerfTest
Test: Manually checked no regression in StaticLayoutPerfTest result
Change-Id: I566be66558a22b3a3ff79d502bebbbfec75dd065
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
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
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
Even if the same data file is used, different hyphenation is applied
based on the locale. Now Hyphenator keeps locale and use it for
hyphenation.
Bug: 65024629
Test: bit CtsTextTestCases:android.text.cts.StaticLayoutTest
Test: bit CtsTextTestCases:android.text.cts.DynamicLayoutTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: I7e2ece979181d12ac1adbede14995ec9b7b87d21
This is useful for figuring out if we should adjust width of text
in case the overhangs are more than available padding.
Bug: 63938206
Test: pending
Change-Id: I04592a7cbce264fe133e17e4df0daee626a99d85
The new constants were introduced in [1] 9f7a444, but the comment used the
wrong prefix - DIR_ instead of RUN_ in the actual names.
[1] Change-Id Iea8bb46c678a18820e237c90f76007a084c83051
Commit hash 9f7a4442b8
Test: comment update, no tests performed
Change-Id: I4e13600b16ebd9be7ac40cf6c6292ea13f0806c2
nSetLocales needed to be done at the same time of addStyleRun.
So it is natural to be the arguments of addStyleRun.
Since locale change detection take longer time in native, check it
in Java and pass null if not changed.
Here is an example of StaticLayoutPerfTestResult.
Before (median):
createRandom: 3,422,247
createRandom(breakBalanced): 3,448,865
create: 183,642
After:
createRandom: 3,493,079
createRandom(breakBalanced): 3,495,381
create: 193,363
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit CtsTextTestCases:android.text.cts.DynamicLayoutTest
Test: bit CtsTextTestCases:android.text.cts.StaticLayoutTest
Test: minikin_tests
Bug: 65175766
Bug: 65024629
Change-Id: I4586cef626f631d4736b0db59ba9f3f6abd3d4ff
Previously, the text direction was not passed from StaticLayout to
Layout when a StaticLayout was constructed using a builder, resulting
in inconsistency between the direction of a StaticLayout and the
Layout itself. Now we pass the text direction to Layout.
Fixes: 66463721
Test: bit CtsTextTestCases:android.text.cts.DynamicLayoutTest
Test: bit CtsTextTestCases:android.text.cts.StaticLayoutTest
Test: bit CtsWidgetTestCases:android.widget.cts.EditTextTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit FrameworksCoreTests:android.text.DynamicLayoutTest
Test: bit FrameworksCoreTests:android.text.StaticLayoutTest
Test: bit FrameworksCoreTests:android.widget.TextViewTest
Change-Id: Ifaa9d108283292469f0f41c80350162b1d042a93
Previously, we were calling the wrong constructor for Layout, which
didn't have a text direction.
Bug: 65330510
Test: bit FrameworksCoreTests:android.widget.EditorCursorTest
Test: bit FrameworksCoreTests:android.text.DynamicLayoutTest
Test: bit CtsTextTestCases:android.text.cts.DynamicLayoutTest
Change-Id: Idf0ac781dc8d6641184b7deabe990cd0e451ad26
MeasureUnit.internalGetUnit() is a method on ICU MeasureUnit which is
used to construct and register MeasureUnits. Calling it from non-ICU
code makes future calls to MeasureUnit.getAvailable(type) return the
newly-created MeasureUnit, but that MeasureUnit will not be fully
supported by ICU (no translations, ...).
This code creates a MeasureUnit by calling a constructor reflectively to
avoid the registration, which is a workaround.
The correct long-term fix is for ICU/CLDR to support petabyte correctly
(http://bugs.icu-project.org/trac/ticket/13355) and for us to just use
that instead.
Bug: 65632959
Test: bit CtsIcuTestCases:android.icu.dev.test.format.MeasureUnitTest
Test: coretests android.text.format.FormatterTest
Change-Id: I494fb59a3b3742f35cbdf6b8705817f404a2c6b0
TYPE_TEXT_FLAG_NO_SUGGESTIONS is just a hint and does not mean
IME should never show a UI to display suggestions.
This CL makes that point clear in JavaDoc.
Test: checkbuild
Bug: 35875399
Bug: 38139781
Bug: 38184682
Fixes: 65693181
Change-Id: Id0c3b6bc05689a5f1c8b52637664f59d45850a60
Constant definitions do not currently work in bat_land - they are not
reachable from the test, thus breaking the build.
Test: lunch bat_land && make tests
Test: bit FrameworksCoreTests:android.text.LayoutTest
Bug: 65449093
Change-Id: I6c71fe13fc86a8e2a17e49b16fd558c6714c6f5b
In order to properly perform the smart select animation on right-to-left
and mixed text, we need the information about the direction of the text
that is present below the selection rectangle.
Test: manual - verify selection still works and that the generated
directions match the directions of the text on the screen
Test: bit FrameworksCoreTests:android.text.LayoutTest
Change-Id: I564ee2db59ab583c9bff807ad0d0dfeacaf1386f
The last indent should be repeated, so we need to pass an int array
instead of null even if the indent offset is out of array length.
Bug: 65024629
Test: bit CtsTextTestCases:android.text.cts.StaticLayoutTest
Test: bit CtsTextTestCases:android.text.cts.DynamicLayoutTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Bug: 65024629
Change-Id: Ic1274d797db27ae1921135a27bab55e475369710
The motivation of this clean up is:
- Use the precomputed indents for all paragraphs.
- Pass the indents as a part of setup paragraph since indents are a
per-paragraph parameter.
- Remove the nSetIndents call from Builder.setIndents since indents will
be overwritten in generate() function.
Bug: 65024629
Test: bit CtsTextTestCases:android.text.cts.StaticLayoutTest
Test: bit CtsTextTestCases:android.text.cts.DynamicLayoutTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: Ie49d14a38654280bdae8d0e40441cc877c5185b2
The change in I0b95a10c05711350950d6c8d6501f6af9414d413 copied the
Paint to a work paint to make sure we don't modify it, but missed
actually using that Paint, resulting in hyphenation basically getting
ignored in getLineExtent().
Now we correctly pass the work paint to the TextLine used.
Change-Id: Ida89ba2b11d35d93012abb0adf9bb29d1b09c2d2
Fixes: 64998667
Bug: 33388205
Bug: 64452136
Test: bit FrameworksCoreTests:android.widget.TextViewTest
Test: bit FrameworksCoreTests:android.text.
Test: bit CtsTextTestCases:android.text.cts.
The builder mostly copies the structure and the logic of
StaticLayout.
We also improve various parts of code and documentation in
StaticLayout's builder.
Bug: 28963299
Test: bit FrameworksCoreTests:android.text.
Test: bit FrameworksCoreTests:android.widget.TextViewTest
Test: bit CtsTextTestCases:*
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.EditTextTest
Change-Id: I5c4a6e031bd0f41f765a3d85e0b9b7e9be42ad4b
Previously we added mMaxLineHeight to track the line height at the
maxLines value. However when maxLines is set to zero, mMaxLineHeight is
not calculated and remains 0. When maxLines is set to zero, the capped
height of the layout should be 0.
Test: Added a test case to coretests/StaticLayoutTest
Test: bit FrameworksCoreTests:android.text.StaticLayoutTest
Test: bit FrameworksCoreTests:android.text.DynamicLayoutTest
Test: bit FrameworksCoreTests:android.text.StaticLayoutLineBreakingTest
Test: bit FrameworksCoreTests:android.text.StaticLayoutBidiTest
Test: bit FrameworksCoreTests:android.text.StaticLayoutTextMeasuringTest
Test: bit FrameworksCoreTests:android.text.StaticLayoutDirectionsTest
Test: bit CtsTextTestCases:android.text.cts.StaticLayoutTest
Test: bit CtsTextTestCases:android.text.cts.DynamicLayoutTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Bug: 64822158
Change-Id: Id9240ee7b893f8af9cd0d91329617c24da80c7d2
Merged-In: a8d982d6c8
(cherry picked from commit a8d982d6c8)
StaticLayout.mEllipsized and mMaxLineHeight was set for proper
calculation of static ellipsized text height. However, since
DynamicLayout uses a static instance of StaticLayout, and nobody reset
the mEllipsized, this caused configuration discrepancies for different
DynamicLayout instances.
Test: bit -t CtsTextTestCases:android.text.cts.DynamicLayoutTest
Test: bit -t CtsTextTestCases:android.text.cts.StaticLayoutTest
Bug: 64372088
Change-Id: I8ea6697d29da2ccbb433b64f17b4d1d6f254e8e1
Merged-In: a19cd51d2c
(cherry picked from commit a19cd51d2c)
Previously we added mMaxLineHeight to track the line height at the
maxLines value. However when maxLines is set to zero, mMaxLineHeight is
not calculated and remains 0. When maxLines is set to zero, the capped
height of the layout should be 0.
Test: Added a test case to coretests/StaticLayoutTest
Test: bit FrameworksCoreTests:android.text.StaticLayoutTest
Test: bit FrameworksCoreTests:android.text.DynamicLayoutTest
Test: bit FrameworksCoreTests:android.text.StaticLayoutLineBreakingTest
Test: bit FrameworksCoreTests:android.text.StaticLayoutBidiTest
Test: bit FrameworksCoreTests:android.text.StaticLayoutTextMeasuringTest
Test: bit FrameworksCoreTests:android.text.StaticLayoutDirectionsTest
Test: bit CtsTextTestCases:android.text.cts.StaticLayoutTest
Test: bit CtsTextTestCases:android.text.cts.DynamicLayoutTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Bug: 64822158
Change-Id: I5a2a40661501b5778ef8687b342f3e790c6f716a
* Increase the ascent and descent of individual lines in StaticLayout
as needed, if any fallback fonts that end up getting used call for
it. For backward compatibility, this is hidden behind a builder
flag.
* Document in Paint.java that the returned parameters are only for
the default font, and a layout may need more space based on
fallbacks used.
Also update for changes in minikin API:
* MinikinFont now requires a method for getting vertical extents
(ascent, descent, and line gap).
* minikin API now allows asking for vertical extents of laid out
text.
* minikin API's LineBreaker now returns ascents and descents for each
line.
Finally, added performances test for creating a StaticLayout.
Follwing are the numbers on a marlin with a stable clock before and
after this CL.
For fixed text almost always hitting the cache:
Before: mean=260684 median=260188 min=258532 standardDeviation=1897
After: mean=262432 median=261509 min=260429 standardDeviation=2185
For random text almost never hitting the cache:
Before: mean=5971827 median=5991126 min=5886871 standardDeviation=83724
After: mean=6337093 median=6317010 min=6311222 standardDeviation=40213
Bug: 28963299
Bug: 29063863
Bug: 32057121
Bug: 37756858
Test: bit FrameworksCoreTests:android.text.
Test: bit CtsTextTestCases:*
Change-Id: I482a98ff8f472e8bab4f0ba9d1d7b368858038ff
Minikin already supports multiple languages specified per font in
I7f13b51464c9b01982bb573251d77052b9ddbd70. This CL adds a couple of
such cases into fonts.xml and clarifies in the method and the
variable names and parameters that the frameworks is handling a
multi-language string when it is.
Fixes: 26687969
Test: make -j checkbuild
Test: bit FrameworksCoreTests:android.graphics.TypefaceSystemFallbackTest
Change-Id: Ifa540a95f87921983f9069330d1dd0892538a8df
In order to generate the Smart Select animation, we need a list of
rectangles which represent a given selection. The current
getSelectionPath code can only fill out a Path, which loses the
rectangle information in the process.
Instead of working directly with a Path, a RectangleConsumer is
introduced, which is an abstraction over an element that can accept
rectangles (for example, a Path or a List<Rect>).
getSelectionPath is now implemented with this new method using a simple
consumer which takes the rectangles and feeds them to the path.
Test: cts-tradefed run cts-dev -m CtsWidgetTestCases -d -t android.widget.cts.TextViewTest#testGetFocusedRect
Test: manual - verify text selection still works
Change-Id: I32a24f237a4b1b89df23c982fe06566f30fec464
This method is needed in settings to avoid code duplication.
Add a test to verify that is24HourLocale does not take the 12/24h clock
system setting into account.
Bug: 32761619
Test: bit CtsTextTestCases:android.text.format.cts.DateFormatTest
Test: adb shell am instrument -w -e class android.text.format.DateFormatTest \
com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I21a871c11149550c7cf91aea299724a8b4fbff78
Previously, Layout would modify the HyphenEdit of the Paint passed to it
for its internal operations, potentially leaving the Paint in a different status than when
it was created. Now we use an internal copy of the Paint to modify.
Fixes: 64452136
Test: bit CtsTextTestCases:android.text.cts.
Test: bit FrameworksCoreTests:android.text.
Change-Id: I0b95a10c05711350950d6c8d6501f6af9414d413
Bug: 64269689
Test: m checkbuild
Test: bit CtsGraphicsTestCases:*
Test: bit CtsViewTestCases:*
Test: bit CtsTextTestCases:*
Change-Id: Idc9f2b4612741be949204cd06efc41e1738d6587