History log of /frameworks/minikin/libs/minikin/LineBreaker.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
366f57fb4efd0ddf5d48cd232cd88d3777517ea2 09-Jan-2018 Seigo Nonaka <nona@google.com> Reorganize optimal line breaker

This CL contains:
- Rename LineBreakImpl.{h|cpp} with OptimalLineBreaker.{h|cpp}
- Extract line break candidate enumeration code from LineBreakerImpl
and rename LineBreakImpl with LineBreakOptimizer.
- Fix unexpected hyphenation by ordering hyphenation break point and
desperate break points.
- Refactor line break candidate enumeration code.

Compatibility:
To check the compatibility from current implementation, manually
compared the line break result for the UDHR text (http://unicode.org/udhr/).
Then verified new implementation completely replicate the same output as the
current implementation except for desperate breaks.

Here is the combination verified:
Langauge: ar, zh-CN, zh-TW, nl, fr, de, it, ja, ko, po, pl-PL, pl-BR,
ru, es-ES, th, tr, bg, ca, hr, cs, da, el, he, hi, hu, id,
lv, lt, no, ro, sr-Cyrl, sr-Latn, sk, sl, sv, uk, vi
Font Size: 14px, 15px, 16px, 17px, 18px, 19px
Line Width: 128px, 256px, 512px, 1024px

Performance:
Verified this doesn't cause performance regression.
Here is raw performance score.

StaticLayoutPerfTest(walleye-userdebug, w/o patch -> w/ patch, N=50):
Random Text, No Hyphen : 7,782,872 -> 7,754,140 (-0.37%)
Random Text, Hyphen : 19,028,618 -> 18,942,728 (-0.45%)
measured Text, No Hyphen : 346,625 -> 349,809 (+0.92%)
measured Text, Hyphen : 11,411,894 -> 11,379,360 (-0.29%)

Bug: 71709070
Bug: 65024629
Test: minikin_tests
Test: bit CtsTextTestCases:*
Test: bit FrameworksCoreTests:android.text.StaticLayoutTest
Change-Id: I1933335764405da6d7c82cf1d1af1692e6d10a04
/frameworks/minikin/libs/minikin/LineBreaker.cpp
0948fbb63636111c193365e01dbe952defd700f3 07-Dec-2017 Seigo Nonaka <nona@google.com> Move LineBreaker class definition to private

This is preparation of LineBreaker refactoring.

Bug: 65024629
Test: minikin_tests
Change-Id: Idba5b4678687c39ca6566c9f343f977a8b2edb0b
/frameworks/minikin/libs/minikin/LineBreaker.cpp
26ef1697ea9f110d58f99eb64118f15ae9c6f785 02-Dec-2017 Seigo Nonaka <nona@google.com> Move MeasuredText to its own file and store runs in it.

This lays the ground work for precomputed layout.

This also changes the MeasuredText in LineBreaker from
member variables to method argument.

Bug: 67504091
Test: minikin_tests

Change-Id: Ia5797aa918dd050feb96bcde30a1eb8112708113
/frameworks/minikin/libs/minikin/LineBreaker.cpp
6c8722e217ff5238f0b849152d7936959a728103 30-Nov-2017 Seigo Nonaka <nona@google.com> Apply clang-format

Bug: 65125938
Test: m
Change-Id: I4a4319cc34c186aa0a3ce1d0301af1cd4e0feb81
/frameworks/minikin/libs/minikin/LineBreaker.cpp
0dcb27d502afcb34f59ac85c886ec13a5fdaa0dd 22-Nov-2017 Seigo Nonaka <nona@google.com> Measure the text before starting line break.

To measure the text width before line breaking, extract measuring logic
from LineBreaker and accept measured text result as the argument of
LineBreaker.

LineBreaker still needs style information for hyphenation. Technically
we can measure all possible hyphenation patterns in measure part, but
that's too complex to do at the same time in this CL.

Locally verified this doesn't cause any performance regressions.

Here is a raw performance test result on marlin userdebug.

StaticLayoutPerfTest (median, N=100):
createRandom: 6,189,897 -> 6,121,704 (-1.10%)
createRandom Balanced: 6,183,420 -> 6,038,833 (-2.34%)

TextViewOnMeasurePerfTest (median, N=100):
measure_AtMost: 57,640,596 -> 56,786,386 (-1.48%)
measure_Exactly: 55,566,211 -> 55,305,721 (-0.47%)
measure_Unspecified: 96,236,366 -> 96,088,572 (-0.15%)

Bug: 65024629
Test: atest CtsTextTestCases
Test: atest CtsWidgetTestCases
Test: atest CtsGraphicsTestCases
Test: minikin_tests

Change-Id: Ib0ae50f173a805130d8622164b1b72dc10f5c49e
/frameworks/minikin/libs/minikin/LineBreaker.cpp
4f6f2c82672af34e7f28b769b5740d124fbd1db2 29-Nov-2017 Seigo Nonaka <nona@google.com> Fix crash due to de-reference of dangling pointer

The crash was introduced in If5e3481be6eba7e33f44c66151eb0f566ccee585
mLastGreedyBreak becomes a dangling pointer when mCandidate grows
and reallocation happens.
Fixing by storing index instead of pointer.

Note that mLastGreedyBreak may point outside of vector elements.
Introduces special index value for them.

Bug: 69549560
Test: The app reported was launched successfully.
Test: minikin_tests
Change-Id: I28f293cdc917103773c4c144eceb723890e6e181
/frameworks/minikin/libs/minikin/LineBreaker.cpp
b27a39233e1cc2d1230b02fe859969c9811095aa 15-Nov-2017 Seigo Nonaka <nona@google.com> Decouple the text measurement from the LineBreaker

This lays the groundwork for precomputed layout.
By extracting measureText call from LineBreaker to JNI, JNI
will be able to fill the precomputed layout result if possible.

Locally verified this doesn't regresses the performance.

This is the 2nd attempt of Ic26c2a8d526c05f3a38ee6a200221543fbb33713
The previous CL writes width into wrong address in ReplacementRun.
This CL fixes this issue with adding unit tests.
Also collected new performance scores. The result shows slight
improvement but there is no reason of improvement, so the difference
is likely noise.

Here is a raw performance test result on marlin.

StaticLayoutPerfTest (median, N=100):
createRandom: 6,247,032 -> 6,025,044 (-3.55%)
createRandom Balanced: 6,152,070 -> 5,959,571 (-3.13%)

TextViewOnMeasurePerfTest (median, N=100):
measure_AtMost: 57,639,794 -> 56,190,042 (-2.52%)
measure_Exactly: 56,124,250 -> 54,377,276 (-3.11%)
measure_Unspecified: 97,224,965 -> 94,837,311 (-2.46%)

Bug: 65024629
Bug: 69592296
Test: bit CtsTextTestCases:*
Test: bit CtsWidgetTestCases:*
Test: bit CtsGraphicsTestCases:*
Test: minikin_tests
Change-Id: I9b61434bdcba162698dcbedf968f6ee3a4680375
/frameworks/minikin/libs/minikin/LineBreaker.cpp
652814b0012a2a5d55e076a1023af41714e1640b 21-Nov-2017 Seigo Nonaka <nona@google.com> Revert "Decouple the text measurement from the LineBreaker"

Looks like this causes native crash.

Bug: 69592296
Test: N/A

This reverts commit ad63f0eb8e968bab5bf999b916f718a4437ca65b.

Change-Id: Id7da6492c4c232dd3b7a6d9e25a492264bb35d34
/frameworks/minikin/libs/minikin/LineBreaker.cpp
ad63f0eb8e968bab5bf999b916f718a4437ca65b 15-Nov-2017 Seigo Nonaka <nona@google.com> Decouple the text measurement from the LineBreaker

This lays the groundwork for precomputed layout.
By extracting measureText call from LineBreaker to JNI, JNI
will be able to fill the precomputed layout result if possible.

Locally verified this doesn't regresses the performance.
Here is a raw performance test result on marlin.

StaticLayoutPerfTest (median):
createRandom: 6,714,256 -> 6,644,276 (-1.04%)
createRandom Balanced: 6,675,482 -> 6,562,508 (-1.69%)

TextViewOnMeasurePerfTest (median):
measure_AtMost: 59,225,636 -> 60,388,310 (+1.96%)
measure_Exactly: 59,145,734 -> 58,801,274 (-0.58%)
measure_Unspecified: 99,063,403 -> 99,739,018 (+0.68%)

Bug: 65024629
Test: bit CtsTextTestCases:*
Test: bit CtsWidgetTestCases:*
Test: bit CtsGraphicsTestCases:*
Test: minikin_tests
Change-Id: Ic26c2a8d526c05f3a38ee6a200221543fbb33713
/frameworks/minikin/libs/minikin/LineBreaker.cpp
d565f7d88018f09a740ff6cf26cb2b068139c784 10-Nov-2017 Seigo Nonaka <nona@google.com> Rewrite LineBreaker with U16StringPiece and Range

There are lots of primitive types which represents the ranges of
text. It is good to replace them with Range class and utility
methods to be more readable.

Locally verified this doesn't regresses the performance.
Here is a raw perf test result on marlin. (w/o patch -> w/ patch)

StaticLayoutPerfTest (median):
createRandom: 6,696,561 -> 6,639,608 (+0.85%)
createRandom Balanced: 6,625,276 -> 6,563,600 (+0.93%)

TextViewOnMeasurePerfTest (median):
measure_AtMost: 59,128,766 -> 59,975,584 (-1.43%)
measure_Exactly: 57,584,917 -> 58,287,526 (-1.22%)
measure_Unspecified: 99,198,124 -> 98,851,486 (+0.35%)

Test: bit CtsTextTestCases:*
Test: bit CtsWidgetTestCases:*
Bug: 65024629
Change-Id: I3690e635a27d8e200ce25679d5bbbe95f6f3bd03
/frameworks/minikin/libs/minikin/LineBreaker.cpp
12bf54f4596e4237866ec39ef7c45ed1a8d84fdf 11-Nov-2017 Seigo Nonaka <nona@google.com> Revert "Store FontCollection in MinikinPaint"

This regresses the performance

Bug: 69165958

This reverts commit bcc364d35f9993b65f8717842a0b50e7c0d5b2ad.

Change-Id: Ic8da6bff67ee23e3d38ee50369126909eab9d9eb
/frameworks/minikin/libs/minikin/LineBreaker.cpp
bcc364d35f9993b65f8717842a0b50e7c0d5b2ad 09-Nov-2017 Seigo Nonaka <nona@google.com> Store FontCollection in MinikinPaint

Whenever FontCollection is used, MinikinPaint is used at the same time.
It would make sense for FontCollection to be a part of MinikinPaint.

Bug: 65024629
Test: minikin_tests
Test: minikin_stress_tests
Change-Id: I8041b8f638d33c67209c0c66f63a0ef7a54471a0
/frameworks/minikin/libs/minikin/LineBreaker.cpp
b1363f277a872e9b932059b3bd88bc17be1f3577 02-Nov-2017 Seigo Nonaka <nona@google.com> Introduce start/end hyphen edit enum and pass separately in most places

This CL contains following changes:
- Introduce StartHyphenEdit/EndHyphenEdit and use them instead of
uint32_t.
- MinikinPaint is now immutable.
- Stop copying MinikinPaint in LayoutContext.
- Make MinikinPaint in addStyleRun argument const.

Bug: 65024629
Test: minikin_tests
Change-Id: I3b901be3378337611093bad1195dfe33cd0d71bb
/frameworks/minikin/libs/minikin/LineBreaker.cpp
b24f09174bdf36d9431f306cef68ef8e35c1ec8c 08-Nov-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Implement desperate breaks in optimal line breaking"
730c8bc7e51ff002976c49aa91e6584c88471709 07-Nov-2017 Roozbeh Pournader <roozbeh@google.com> Implement desperate breaks in optimal line breaking

Desperate breaks for optimal line breaking were removed after
it was found that they depended on the width of the line based on
the greedy algorithm, which was wrong.

This CL restores it with a new implementation that is based on the
minimum width of all lines.

Fixes: 68058572
Test: bit CtsTextTestCases:android.text.cts.StaticLayoutLineBreakingTest
Change-Id: Ife4f2d0946ee4afa2f14e84f1fdf9756c82f3358
/frameworks/minikin/libs/minikin/LineBreaker.cpp
b47e9b21077d2a0847a64fa713aa9892196b5d2a 27-Oct-2017 Seigo Nonaka <nona@google.com> Move FontStyle to MinikinPaint member

FontStyle is always used with MinikinPaint except for itemization.
Also it is populated at the same time from Paint.
It would be good for it to be a member of MinikinPaint.

On the other hand, LocaleListId was stored in FontStyle is now used
everywhere, e.g. Hyphenator, WordBreaker, etc. It would be good
for it to be outside of FontStyle.

Bug: 65024629
Test: minikin_tests
Change-Id: I5199638ed21b0eaf1f426834933f64b603b6302a
/frameworks/minikin/libs/minikin/LineBreaker.cpp
ded75b02b62c5da2616aed00b6f9aacc1cc855a3 31-Oct-2017 Seigo Nonaka <nona@google.com> Strip control characters from the word range

The trailing control characters are now stripped from the word range.

Bug: 68669534
Test: minikin_tests
Test: Manually verified "a \tb" string doesn't crash on debug app.
Change-Id: Ie672231825aeb4a5e064367dad0dcf49168cd637
/frameworks/minikin/libs/minikin/LineBreaker.cpp
78aadd58c4500d73f266d34f1f2c1f88309987a6 26-Oct-2017 Seigo Nonaka <nona@google.com> Use enum class for Bidi flags

This is a mechanical refactoring of changing type definition of bidi flag.

Bug: 65024629
Test: checkbuild
Change-Id: I9304636899360cd730411e842c8eb432fb23f8e0
/frameworks/minikin/libs/minikin/LineBreaker.cpp
1d461589869ee5b7102f96271b0ef0a776ab513c 20-Oct-2017 Seigo Nonaka <nona@google.com> Style cleanup.

This CL contains following cleanups:
- Rename the following classes and corresponding file names:
FontLanguage -> Locale
FontLanguages -> LocaleList
FontLanguageListCache -> LocaleListCache
- Remove unnecessary #include lines.
- Define the Minikin's header include ordering and follow that style.
See doc/minikin_style.md for details.
- Always use std::string and std::vector instead of string and vector
with using-declaration.
- Replace LOG_ALWAYS_FATAL_IF with MINIKIN_ASSERT so that the assertion
is removed on build configuration for user.

This CL does not change any behavior.

Bug: 65024629
Test: make checkbuild
Change-Id: If41bb3c3389303053bbe95e349eb2dd4b619257c
/frameworks/minikin/libs/minikin/LineBreaker.cpp
b76fd0c864c1fc06eb25f214851b5f40e9c6a321 12-Oct-2017 Seigo Nonaka <nona@google.com> Use minikin's HyphenatorMap in LineBreaker.

This CL contains the following changes:
- Use language ID as the locale input of addStyleRun.
- Resolve Hyphenator with minikin's HyphenatorMap.
- Pool the ICU's LineBreaker.
Creating an ICU LineBreaker takes some time. Thus, pool
them and use the same instances later.
- Use FontLanguage as the locale input of WordBreaker.

Here is a performance scores: (w/o patch -> w/ patch)

StaticLayoutPerfTest (median):
createRandom: 4,044,875 -> 3,896,743 (-3.7%)
createRandom Balanced: 3,985,204 -> 3,821,016 (-4.1%)

TextViewOnMeasurePerfTest (median):
measure_AtMost: 44,064,070 -> 38,746,998 (-12.1%)
measure_Exactly: 43,028,018 -> 37,827,794 (-12.1%)
measure_Unspecified: 71,863,028 -> 65,774,110 (-8.5%)

Bug: 65024629
Bug: 67319341
Test: minikin_test
Change-Id: Ibf173e0b0b29c33eaad790b65dad6fd8a1190e47
/frameworks/minikin/libs/minikin/LineBreaker.cpp
01babd674448680dfcca67e18e31e13f4ce381e0 05-Oct-2017 Roozbeh Pournader <roozbeh@google.com> Separate greedy and optimal line breaking algorithms

1) The greedy algorithm and the optimal algorithm have been separated.
The greedy algorithm is now only run when needed (if there are tabs
in text, or a greedy algorithm has been asked for), as opposed to
every time.

2) The previous desperate line breaking assumed that the words are
supposed to end up in the same line as they would in the greedy
algorithm. This was wrong for optimal line breaking and resulted in
incorrect line breaks. We now limit desperate line breaking to the
greedy algorithm, and don't even add desperate candidates to the line
breaking candidates.

3) Extent calculations have been moved to when breaks are added as
opposed to during addition of style runs. The running time is the
same, but the code is now simpler.

4) The fields, types, and methods in LineBreaker.h are reorganized so
they could be understood better.

Test: adb shell /data/nativetest/minikin_tests/minikin_tests
Test: bit FrameworksCoreTests:android.text.
Test: bit CtsTextTestCases:*
Bug: 65024629
Bug: 63938206
Bug: 28963299
Change-Id: If5e3481be6eba7e33f44c66151eb0f566ccee585
Fixes: 67018920
/frameworks/minikin/libs/minikin/LineBreaker.cpp
208916a9499af90cd07f21dd5a57553f986c3aaf 05-Oct-2017 Roozbeh Pournader <roozbeh@google.com> Remove optimal-only fields in line breaker candidates

The two fields 'prev' and 'score' in candidate data were only used in
computing optimal line breaks. We now move them outside mCandidates and
only allocate them in the optimal line breaker.

Bug: 65024629
Test: adb shell /data/nativetest/minikin_tests/minikin_tests
Test: bit FrameworksCoreTests:android.text.
Change-Id: I477c1553a7eb4b707f305d85a33d6470db373697
/frameworks/minikin/libs/minikin/LineBreaker.cpp
5881c06cb05d7344c8ddfd5788ccce755ba74e18 04-Oct-2017 Roozbeh Pournader <roozbeh@google.com> Use overhang information in the greedy line breaker

The calculated overhangs are now considered in greedy line breaking:
if the overhangs don't fit the available padding, they are considered
a part of the advance of the line and some width would be allocated
for them.

Bug: 63938206
Test: adb shell /data/nativetest/minikin_tests/minikin_tests
Test: bit FrameworksCoreTests:android.text.
Test: bit CtsTextTestCases:*
Change-Id: Ib90ff12591b5016986d0bf2fff5524f5054a6bd4
/frameworks/minikin/libs/minikin/LineBreaker.cpp
f6596e3f30ebe2cbe506c144c09d959dada1ae4a 03-Oct-2017 Roozbeh Pournader <roozbeh@google.com> Improve algorithm for greedy line breaker

Previously, we had a worst case O(N^2) algorithm for greedy line
breaking since we only saved the best line break, and needed to
recalculate the best break when the line still didn't fit after a
line break. Now we use an O(N lg N) algorithm that saves all the
best breaks in a queue in case we need to use some lesser candidates
later.

Bug: 63938206
Bug: 34185255
Test: adb shell /data/nativetest/minikin_tests/minikin_tests
Test: bit FrameworksCoreTests:android.text.
Test: bit CtsTextTestCases:*
Change-Id: I72b826a5461065cfb8795e918ba5a95b26c57879
/frameworks/minikin/libs/minikin/LineBreaker.cpp
fcbf920c3ce183597b4c36eedb46ed7d99bc4809 03-Oct-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Remove addStyleRun return value."
6ab65445a3d9833248214f07873799de83a0d0b8 03-Oct-2017 Seigo Nonaka <nona@google.com> Remove addStyleRun return value.

Bug: 65024629
Test: bit CtsTextTestCases:*
Change-Id: I5a70924dde0d20f3694d2240e730f9b496f54adb
/frameworks/minikin/libs/minikin/LineBreaker.cpp
54c69ab922ed2595aa0fa9c2e508b20d34ab04a5 29-Sep-2017 Roozbeh Pournader <roozbeh@google.com> Add overhangs to candidate information in LineBreaker

Compute amount of overhang for all line breaking candidates and them
to candidate data. The infromation is presently ignored in line
breaking.

Also clear mCharOverhangs in LineBreaker::finish() which was
previously missed.

Bug: 63938206
Test: adb shell /data/nativetest/minikin_tests/minikin_tests
Change-Id: Ib47b9de5705917bb8efbcf2dff619f30da1a7b7c
/frameworks/minikin/libs/minikin/LineBreaker.cpp
0261224adbab3a3735d37b41a38bdea046248406 29-Sep-2017 Seigo Nonaka <nona@google.com> Clean Up: Fix tests, remove verbose logs, use StringPiece.

Bug: 65024629
Test: minikin_tests
Change-Id: I585469a3c8c5fe8f6f910bf640f716166f560df8
/frameworks/minikin/libs/minikin/LineBreaker.cpp
2bc5642d62023da77ec4d77434f4e2450c491d30 29-Sep-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Use left-side overhang info for post-hyphenated subwords"
87c2e24b6d714a7f960d2220d40ce96f8b89ba41 29-Sep-2017 Roozbeh Pournader <roozbeh@google.com> Use left-side overhang info for post-hyphenated subwords

Also refactor and add comments to various parts of LineBreaker.

Bug: 63938206
Test: adb shell /data/nativetest/minikin_tests/minikin_tests
Change-Id: Ibef38a27ec38de181508f7b0d834148d8e0a502e
/frameworks/minikin/libs/minikin/LineBreaker.cpp
4cf0e3763c5087db642757933de1fcae3074c76c 29-Sep-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Pass locale and hyphenators to addReplacement"
44452cc1a819f9cd6b704803286d4ce367771d06 28-Sep-2017 Seigo Nonaka <nona@google.com> Pass locale and hyphenators to addReplacement

Locale and Hyphenators are also necessary for addReplacement.

Bug: 67020487
Test: bit FrameworksCoreTests:android.text.StaticLayoutLineBreakingTest
Change-Id: I3243c76a1208a10416f41cb614af0ae7638b800d
/frameworks/minikin/libs/minikin/LineBreaker.cpp
5aa870f7ccd5138af60c96ec232192b52f967530 01-Sep-2017 Seigo Nonaka <nona@google.com> Remove mLocale and save locale into Hyphenator.

Save locale to Hyphenator so that LineBreaker would no longer need to
track the locales to be used for hyphenation separately.

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: I688624b1984f7e9111bed6df106f41828ad3be0f
/frameworks/minikin/libs/minikin/LineBreaker.cpp
8135e0206905f1d2cd206fba644b34bca53cc0d1 31-Aug-2017 Seigo Nonaka <nona@google.com> Restart word breaker from the start of the run when locale changed

If locale is changed, the current word break point may not be valid
since that position was calculated based on previous locale.
Need to re-calculate with the new locale.
To achive this, need to reset the internal current position of the
word breaker to the start position of the run.

After this change, addStyleRun should be used for setting locale
instead.

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: Ic9034c04c9e27ede613e7a49b4fbf4a7c1067c28
/frameworks/minikin/libs/minikin/LineBreaker.cpp
9a5572ee64349a81deddd1d7dd1897920f2b4358 31-Aug-2017 Seigo Nonaka <nona@google.com> Make LineBreaker and WordBreaker testable.

By mocking icu::BreakIterator we can test the LineBreaker and
WordBreaker implementation.

Test: minikin_tests
Bug: 65024629
Bug: 65175766
Change-Id: I871fe51eb781e09a5d8ac9dd529f69408d71fbfb
/frameworks/minikin/libs/minikin/LineBreaker.cpp
f58d27e7e10160319fcf58e2d1a5f080a2f59e5e 31-Aug-2017 Roozbeh Pournader <roozbeh@google.com> Use overhang information in LineBreaker

The usage is presently limited to overhangs of automatically
hyphenated words, where the width of the overhang is added to the
width of the hyphen.

Also add various comments to LineBreaker to clarify variables.

Test: adb shell /data/nativetest/minikin_tests/minikin_tests
Test: adb shell am instrument -w -e package android.text com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Change-Id: Id8f8d676021ba580be023641d5c81de50ec9623c
/frameworks/minikin/libs/minikin/LineBreaker.cpp
24e446c8f35deb11675dd92ed7bcaaebce391dd3 31-Aug-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Calculate overhangs in Layout"
9ad437ea74743bd7eaaa4377c38b7b4a827ae1e8 31-Aug-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Move the line width calculation outside of minikin."
77cf2c14c5600b233965490f1470ec8f64bd8a3b 30-Aug-2017 Roozbeh Pournader <roozbeh@google.com> Calculate overhangs in Layout

At the moment, the overhangs are not yet used in calculations.

Bug: 63938206
Test: pending
Change-Id: I078ddbf8fb3ca6eca53deb50e359135aa032a13e
/frameworks/minikin/libs/minikin/LineBreaker.cpp
c9421a96ac99be65955f47567146411772171cc1 30-Aug-2017 Seigo Nonaka <nona@google.com> Move the line width calculation outside of minikin.

The minikin only need to know the width of the each lines.
Move the line width calculation to JNI binding part.

Also, removing isRectangle flag from computeBreaksOptimal since the
line width calculation is cheap.

Test: bit CtsTextTestCases:android.text.cts.StaticLayoutTest
Test: bit CtsTextTestCases:android.text.cts.DynamicLayoutTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: minikin_tests
Bug: 65024629

Change-Id: I93b2a5e07466fffe34c7788d2a7a7e1368b049bc
/frameworks/minikin/libs/minikin/LineBreaker.cpp
5d9d65c8e389f94d3e33f6829315008a49e0ad84 29-Aug-2017 Seigo Nonaka <nona@google.com> Clean Up: remove unnecessary vector pooling from LineBreaker

The overhead of std::vector is quite small. No strong motivation to
keep myHyphBuf in LineBreaker.

Bug: 65024629
Test: minikin_tests
Test: bit CtsTextTestCases:android.text.cts.StaticLayoutTest
Test: bit CtsTextTestCases:android.text.cts.DynamicLayoutTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: Performance Result:
android.text.StaticLayoutPerfTest#testCreate
Before 172,636
After 156,328

android.text.StaticLayoutPerfTest#testCreateRandom
Before 3.824,803
After 3,756,380
Change-Id: I837b7e35b13ebd39bc210da2c41f85509a89facc
/frameworks/minikin/libs/minikin/LineBreaker.cpp
33ead53d74e8c8cb5331d7612d4f26d993a4a88b 10-Aug-2017 Roozbeh Pournader <roozbeh@google.com> Compute vertical extents needed for layout

Text laid out in multiple fonts may need more vertical space in
order to make sure it doesn't overlap lines above and below it. But
the information was previously not available to users of Minikin.

Now we allow a parameter in various layout methods that returns the
ascent, desent, and line gap based on the maximum values of the fonts
actually used in laying out the text.

Also, LineBreaker now keeps and returns ascents and descents per
line, which callers can use to only allow extra linespacing on lines
that have such characters.

Finally, font run calculations have been modified to not check
support for \n and \r in cmap tables, as they are not needed. This
reduces the number of font runs and avoids cases where a fallback
font mistakenly gets used and increases the requested ascent and
descent.

Bug: 28963299
Bug: 29063863
Bug: 32057121
Bug: 37756858
Test: adb shell /data/nativetest/minikin_tests/minikin_tests
Test: bit FrameworksCoreTests:android.text.
Test: bit CtsTextTestCases:*
Change-Id: I959017210f19ced71db05b127148203dcf9a2d42
/frameworks/minikin/libs/minikin/LineBreaker.cpp
510047d8fd99c960d131c701bdee217d1970987f 14-Jul-2017 Roozbeh Pournader <roozbeh@google.com> Hyphenate words adjacent to NBSP

Previously, a sequence of words separated by NO-BREAK SPACE (U+00A0)
were treated as one long non-hyphenatable word. Now each such word
is processed separately and can get hyphenated.

Also fix an incorrect assumption that it's safe to cache words
separated by NBSP since NBSP can be used as a base for a combining
character, in which case it should not be separated from the
character following it.

Change-Id: Ia4351d29098d1f8015f797088d0255ea3a4de9df
Fixes: 27250514
Test: Manual (words separated by NBSP now get hyphenated)
Test: adb shell /data/nativetest/minikin_tests/minikin_tests
/frameworks/minikin/libs/minikin/LineBreaker.cpp
e970da33adc5f77890517b029e6caf61ee411aa6 11-Jul-2017 Roozbeh Pournader <roozbeh@google.com> Remove last-line-too-short penalty am: fb3356b578
am: b46068fb4b

Change-Id: I271239a2ee7a34649987632631b2e20aeee5dfd3
fb3356b57821ef1dd147e14736189c87572e85d5 10-Jul-2017 Roozbeh Pournader <roozbeh@google.com> Remove last-line-too-short penalty

Previously, we were applying a penalty for cases where the last line was
too short. This was causing weird line breaks in CJK paragraphs.

Test: Manual (line breaks look better for CJK text)
Test: adb shell /data/nativetest/minikin_tests/minikin_tests
Test: adb shell am instrument -w -e package android.text com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Test: bit CtsTextTestCases:*
Test: bit CtsWidgetTestCases:.TextViewTest
Change-Id: I3e9b1558f9e0d247dc942deaaa18aa1c1b4c6acb
Fixes: 63053767
Fixes: 62934959
/frameworks/minikin/libs/minikin/LineBreaker.cpp
728f42cbd5acd0fa8d8dbe07d0302d41475eb95c 16-Jun-2017 Roozbeh Pournader <roozbeh@google.com> Support locale lists in LineBreaker

For now, only the first locale is looked at.

Bug: 21571721
Bug: 25122192
Test: adb shell /data/nativetest/minikin_tests/minikin_tests
Change-Id: I46f9220b74a0a7b572fec021897b6ea65b9199a2
/frameworks/minikin/libs/minikin/LineBreaker.cpp
67d1601c603970aecd737cf8b82f6a13648e0820 14-Mar-2017 Roozbeh Pournader <roozbeh@google.com> In greedy line breaking, repeat breaks until the line fits

Previously, in greedy line breaking, when a line overflowed, we found
the best line breaking candidate before it and broke the line there.
But we didn't check to see if the remaining part now fits in a line.

With this change, we now repeat checking for overflows, and break
again until we have no breaking opportunity or the remaining text now
fits in a line.

Also found an issue with greedy line breaking and keeping the
hyphenation edit for the next line which is now fixed.

Test: Manual. The issue reported in the bug is now fixed.
Bug: 34185255
Bug: https://code.google.com/p/android/issues/detail?id=231437
Bug: 33560754
Change-Id: I93bdd341e4f8e1257710e453e4938f224cb2a1ff
/frameworks/minikin/libs/minikin/LineBreaker.cpp
c7ef4000c1e840c3d3b66e85a40ebd34a5a2a8ee 18-Feb-2017 Roozbeh Pournader <roozbeh@google.com> Correct hyphenation for various complex cases

This adds better support for Arabic script languages, Armenian,
Catalan, Hebrew, Kannada, Malayalam, Polish, Tamil, and Telugu by
adding various hyphenation types and edits appropriate for the
locales.

For Arabic script languages, soft hyphens act transparently with
regard to joining: If a line is broken at a soft hyphen where the two
characters around the soft hyphen were joining each other before,
they will continue to appear joining if the line is broken at the
soft hyphen and a hyphen glyph is inserted. This is needed for
Central Asian languages such as Uighur.

For Armenian, U+058A ARMENIAN HYPHEN is used for line breaks caused
by either automatic hyphenation or soft hyphens.

For Catalan, nonstandard line breaks are implemented for "l·l", which
hyphenates as "l-/l".

For Polish, when there is a line break at a hyphen, the hyphen is
repeated at the next line.

For the South Indic languages, when breaks happen due to soft breaks
or automatic hyphenation, no visible hyphen is inserted, although a
penalty is added.

For Hebrew, support for using U+05BE HEBREW PUNCTUATION MAQAF has
been implemented, but it's turned off pending confirmation of
desirability.

Also, hard hyphens, which previously had no penalty added for
breaking the line after them, now have the same penalty as an
automatic or soft break, with the difference that no hyphen is
inserted when they break.

Finally, some bugs have been fixed with hyphenating multiscript and
multi-font words.

Bug: 19950445
Bug: 19955011
Bug: 25623243
Bug: 26154469
Bug: 26154471
Bug: 33387871
Bug: 33560754
Bug: 33752592
Bug: 33754204
Test: Unit tests added, plus thorough manual testing
Change-Id: Iaccf776ce8d1d434ee8b1c534ff3659d80fdc338
/frameworks/minikin/libs/minikin/LineBreaker.cpp
dfbc6e374259f9d81940b5195ac013b02429af27 10-Feb-2017 Seigo Nonaka <nona@google.com> Remove MinikinRefCounted and use shared_ptr instead

Let's use shared_ptr since manual ref counting can be a bug-prone and
using the global mutex inside destructor is not useful for some time.

To remove raw pointer manipulation, needed to change Layout
constructors. Layout is no longer copyable and need to pass
FontCollection to constructor.

Bug: 28119474
Test: minikin_tests passed
Test: hwui_unit_tests passed
Test: No performance regression in minikin_perftest.
Change-Id: I8824593206ecba74cbc9731e298f045e1ae442a3
/frameworks/minikin/libs/minikin/LineBreaker.cpp
afc31403d5c6322cd67e38439f41c1466c699b5b 11-Jan-2017 Seigo Nonaka <nona@google.com> Merge "Tune line breaking for justification"
77baca2bda0f8d313f48af2df0b397d5de94a132 10-Jan-2017 Mark Salyzyn <salyzyn@google.com> resolve merge conflicts of dff2a9d to master

Test: compile
Bug: 30465923
Change-Id: I9bcbf910e90a9160ed2fd2f75c5d72dba6ad6fcf
39ab40115fae6d0c948e435233b3dd997ee7d8e5 09-Jan-2017 Mark Salyzyn <salyzyn@google.com> minikin: use log/log.h when utilizing ALOG macros

Use log/log.h to harden code against liblog changes.

Test: compile
Bug: 30465923
Change-Id: I3dea82e76d28d9ef52d7c0f11e038c4298863eb9
/frameworks/minikin/libs/minikin/LineBreaker.cpp
3a74bcd0b4c4150cd524a37cdfa4e0ffe490cca6 24-Nov-2016 Seigo Nonaka <nona@google.com> Tune line breaking for justification

Add an "mJustified" for justification, and tune the line breaking to
produce good results. Major differences for fully justified text include:
- Space can be shrunk in justified text.
- Hyphenation should be more aggressive in justified text.

Also adds a penalty for the last line being very short. This is tuned
to be more aggressive for ragged right than for justified text.

This is based on a patch by Raph Levien (raph@google.com).

Bug: 31707212
Test: Manually tested with Icbfab2faa11a6a0b52e6f0a77a9c9b5ef6e191da
Change-Id: If366f82800831ccc247ec07b7bc28ca4c6ae0ed6
/frameworks/minikin/libs/minikin/LineBreaker.cpp
32c12c0ac825453f4c3bba07718cfe684ec90bec 28-Dec-2016 Mark Salyzyn <salyzyn@google.com> resolve merge conflicts of 2377a00 to master

Test: build
Bug: 26552300
Bug: 31289077
Change-Id: I6181ae7e84f9bdcbed50841c70d07f6906a10eb7
555d84c6f98eafcbe677cdcb8e9605760acd8ce5 29-Sep-2016 Mark Salyzyn <salyzyn@google.com> minikin: Replace cutils/log.h with android/log.h or log/log.h

- replace cutils/log.h with android/log.h (main buffer logging)
- replace cutils/log.h with log.log.h (+SafetyNet logging)
- define LOG_TAG before use.

Test: compile
Bug: 26552300
Bug: 31289077
Change-Id: I7a4803dd66f31b7103e09e5ff5b8fa523fa0fd60
/frameworks/minikin/libs/minikin/LineBreaker.cpp
14e2d136aaef271ba131f917cf5f27baa31ae5ad 09-Jun-2016 Seigo Nonaka <nona@google.com> Always use minikin namespace.

Here is a new policy of the namespace of minikin.
- All components should be in minikin namespace.
- All tests are also in minikin namespace and no anonymous namespace.

Bug: 29233740
Change-Id: I71a8a35049bb8d624f7a78797231e90fed1e2b8c
/frameworks/minikin/libs/minikin/LineBreaker.cpp
879e8a3a479b2cedd05e652f082683a02aa57dcf 13-Apr-2016 Raph Levien <raph@google.com> Clear mLineWidths in LineBreaker::finish()

There was the possibility of stale indents from previous invocations
persisting in the mLineWidths across multiple invocations. This patch
clears them.

Bug: 28090810
Change-Id: I3621dfbe983512046289373711709aeade52eab4
/frameworks/minikin/libs/minikin/LineBreaker.cpp
ea408fc18e8e78d984ebdf63703da668a15720de 18-Feb-2016 Keisuke Kuroyanagi <ksk@google.com> Optimize: Use measureText instead of doLayout.

With this CL, measureText is used for getRunAdvance,
getOffsetForAdvance and line breaking.

Bug: 24505153
Change-Id: Ib699f6b1391b46537736fc274cdb41686586b550
/frameworks/minikin/libs/minikin/LineBreaker.cpp
aa736d00548da691e75a09a70deb886e1f68b060 18-Feb-2016 Raph Levien <raph@google.com> Disable hyphenation when word overlaps style boundary

In cases when a word (as defined by the ICU break iterator) overlaps a
style boundary, the returned wordStart can be extend before the range
currently being measured for layout. When we try to hyphenate the
resulting substrings, we get a negative range, which crashes. This
patch disables hyphenation in this case.

Bug: 27237112
Change-Id: I76d04b39dd3b4d6d267aaaf4bebc9ab361891646
/frameworks/minikin/libs/minikin/LineBreaker.cpp
c88ef135fcc2661ec7addc171ebc60787df38aff 09-Sep-2015 Raph Levien <raph@google.com> Add penalty for breaks in URLs and email addresses

Recent changes have added special cases for line breaks within URLs
and email addresses. Such breaks are undesirable when they can be
avoided, but at other times are needed to avoid huge gaps, or indeed
to make the line fit at all.

This patch assigns a penalty for such breaks, equal to the hyphenation
penalty. The mechanism is currently very simple, but would be easy to
fine-tune based on more detailed information about break quality.

Bug: 20126487
Bug: 20566159
Change-Id: I0d3323897737a2850f1e734fa17b96b065eabd9c
/frameworks/minikin/libs/minikin/LineBreaker.cpp
57b6dae9894b9362ef04517ff477fd491f9d433b 05-Sep-2015 Raph Levien <raph@google.com> Refine hyphenation around punctuation

Implement a WordBreaker that defines our concept of valid word
boundaries, customizing the ICU behavior. Currently, we suppress line
breaks at soft hyphens (these are handled specially). Also, the
new WordBreaker class has methods that determine the start and end
of the word (punctuation stripped) for the purpose of hyphenation.

This patch, in its current form, doesn't handle email addresses and
URLs specially, but the WordBreaker class is the correct place to do
so. Also, special case handling of hyphens and dashes is still done
in LineBreaker, but all of that should be moved to WordBreaker.

Bug: 20126487
Bug: 20566159
Change-Id: I492cbad963f9b74a2915f010dad46bb91f97b2fe
/frameworks/minikin/libs/minikin/LineBreaker.cpp
bae347682989d2627081310129a5b60541ed6ad0 27-Oct-2015 Seigo Nonaka <nona@google.com> Add -Werror -Wall -Wextra to compiler option.

This is 2nd trial of I30a0914a4633bd93eb60957cdf378770f04d8428

- To suppress noisy unused parameter warnings, comment out unused
arguments.
- Add -Werror for suppressing further warning.
- Add -Wall -Wextra for safety.
- Use "z" prefix for format string of size_t.

Verified that compile succeeded on all arm,arm64,mips,x86,x86_64.

Change-Id: I7ad208464486b8a35da53929cb1cfe541ed0052f
/frameworks/minikin/libs/minikin/LineBreaker.cpp
e9ec9a1d1b9e177659b7cc2cd3a102760fcfec14 21-Jul-2015 Raph Levien <raph@google.com> Consistently apply break opportunities in text spans

It's essential not to apply a break opportunity within a replacement
span, otherwise things can happen such as displaying the span twice.
The old code tested this case based on zero-width characters.
However, this test was both imprecise, and also in some cases read
uninitialized values from the mCharWidths array, which in turn led
to inconsistent line breaking of the same text.

This patch applies all line break opportunities (as identified by
ICU) within text (as opposed to replacement spans), and also applies
break opportunities at the beginning and end of replacement spans,
but avoids breaks within a replacement span.

Bug: 20138621
Change-Id: I36baeb44d6808356649e1bb69ca57f093fc8c723
/frameworks/minikin/libs/minikin/LineBreaker.cpp
daf62d0eef9e339c9d3269e5eaa2007d25c18194 15-Jul-2015 Roozbeh Pournader <roozbeh@google.com> Add missing hyphen-like characters.

This adds various hyphen-like characters missed in the previous
patch, that should disallow automatic hyphenation of words containing
them.

Bug: 22484266
Change-Id: Ie972cb50384dbe0aa1ab5ec50286b75f9877953a
/frameworks/minikin/libs/minikin/LineBreaker.cpp
baf6d0a41fdabb0f859bd065f3724921a3e91089 14-Jul-2015 Roozbeh Pournader <roozbeh@google.com> Avoid re-hyphenating already-hyphenated phrases.

Previously, automatic hyphenation blindly took almost every line
breaking opportunity as a word break, so words like "low-budget" were
treated as two separate words, "low-", and "budget", each
automatically hyphenated.

This patch makes sure the subwords in already-hyphenated phrases are
not passed to the automatic hyphenator, while keeping the possibility
of a potential line break where a hyphen already exists.

Bug: 22484266
Bug: 22287425
Change-Id: Ie46dbdd70e993d64a9b9cf44b4ae93b21459dbc2
/frameworks/minikin/libs/minikin/LineBreaker.cpp
91425f0564581e258d3f9b2f44d13f3b6d7a60ea 29-Jun-2015 Raph Levien <raph@google.com> Fix logspam and incorrect cluster offset

An incorrect cluster offset calculation was causing a lot of log
messages to appear. Separately, a confusion between #if and #ifdef was
causing unintended logging of line breaks. This patch fixes both.

Bug: 22178333
Change-Id: I2b3673ed66c784f5082fd127a8dc10bd3df6ed79
/frameworks/minikin/libs/minikin/LineBreaker.cpp
a6f8bf6f530f80b00a7cc64605667dd1d75a971c 24-Jun-2015 Raph Levien <raph@google.com> Separate additional penalty for last line with hyphen

A recent change added a penalty for a hyphen at the last line break,
which is visually undesirable. However, the penalty was assessed to
"widthScore", which broke the assumption (used for another
optimization) that widthScore increases monotonically. This patch
separates the penalty into a different parameter, restoring the
validity of the monotonicity assumption.

Bug: 22066119
Change-Id: I6a47a350ef3ceee2f00ee430d6954d0c307227f0
/frameworks/minikin/libs/minikin/LineBreaker.cpp
abae97a39c26e191e350575932611a90e6b04d06 08-Jun-2015 Raph Levien <raph@google.com> Increase hyphenation penalty for short last line

Tuning for hyphenation parameters. We discourage hyphenation on the
last line, but offset this penalty by also applying a penalty for
each line, which optimizes for minimizing the number of lines. Thus,
when hyphenation can reduce the number of lines, it increases the
chance they're used.

There's probably more tuning and refinement that can be done, but
testing suggests that the tunable parameters are appropriate.

Bug: 20883322

Change-Id: Ida7eaf8aced109e426694f5a386924a842d29c4b
/frameworks/minikin/libs/minikin/LineBreaker.cpp
a019665898d830283a99f505f72d3899ba137b62 01-Jun-2015 Raph Levien <raph@google.com> Disable hyphenation for unreasonably long words

Very long words cause O(n^2) behavior. These are unlikely to happen in
real text, but do happen with synthetic strings, so in those cases we
just disable hyphenation.

Bug: 20790394
Change-Id: Idf957dd40b24efe1476f619f17093a48b5bc56f7
/frameworks/minikin/libs/minikin/LineBreaker.cpp
0dc07c0be325b7c12c50729e04c4b2785a673fd7 12-May-2015 Roozbeh Pournader <roozbeh@google.com> Support hyphenation frequency in Minikin.

Three hyphenation frequencies are now supported:

kHyphenationFrequency_None, which turns off both automatic
hyphenation and soft hyphens.

kHyphenationFrequency_Normal, which has aconservative amount of
hyphenation useful as a conservative default.

kHyphenationFrequency_Full, which has a typographic-quality amount of
hyphenation useful for running text and tight screens.

Bug: 21038249
Change-Id: I2800f718c887c9389a1a059d7ec07d7fa2ca1dee
/frameworks/minikin/libs/minikin/LineBreaker.cpp
68ae337aa05f598af18b09fe4125146d4d67db83 23-Apr-2015 Raph Levien <raph@google.com> Don't include trailing newline in width for line breaking

In a paragraph with a trailing newline, the width of the newline
character was included in the line width for breaking purposes,
basically as if it were a non-breaking space. This caused a
discrepancy, where Layout.getDesiredWidth() suggested that the text
would fit in a single line, but StaticLayout would break it because of
the added width of the newline character.

The proposed fix is simply to consider newline to be a space that
disappears at the end of a line.

Bug: 20152308
Change-Id: I539574c5b8ea892c8ed6aca6c59e90ccdf74a680
/frameworks/minikin/libs/minikin/LineBreaker.cpp
bb86b433f97a301c11800806b1ce5331fa227d4a 16-Apr-2015 Raph Levien <raph@google.com> Rename "margins" to "indents"

The name "margin" conflicts with another meaning, so we're making the
name in the public api "idents" and the code consistent in naming.

Change-Id: I9170116b4d972e4b25f0f319e78376310288eb41
/frameworks/minikin/libs/minikin/LineBreaker.cpp
dc7bc6e39e1ef6b713b927baf24db8b4f02f1a3f 15-Apr-2015 Raph Levien <raph@google.com> Add margins array to line widths object

In order to support layout in non-rectangular regions, the LineWidths
object needs to accept an arbitrary array of margins. This is
implemented in addition to the existing firstWidthLineCount/restWidth
mechanism for convenience, though using only arrays would have the
same expressive power.

Bug: 20182243
Change-Id: Iea96bca1a92012314ac27e617c67f306c1f1b2f2
/frameworks/minikin/libs/minikin/LineBreaker.cpp
5cdad92c300a65cab89b172e952186f0c5870657 30-Mar-2015 Raph Levien <raph@google.com> Revert "Fix build: Revert "Add hyphenation to line breaking""

This reverts commit 0b25d5ac85533f64764a0d53d5e5d33b46b715fa.
/frameworks/minikin/libs/minikin/LineBreaker.cpp
0b25d5ac85533f64764a0d53d5e5d33b46b715fa 30-Mar-2015 Ed Heyl <edheyl@google.com> Fix build: Revert "Add hyphenation to line breaking"

This reverts commit daf6a6bdbf2ff1f66496d6200cb253e2f50759d5.

Change-Id: I3fed65046274d3aeb748f0730585ab89927f5741
/frameworks/minikin/libs/minikin/LineBreaker.cpp
daf6a6bdbf2ff1f66496d6200cb253e2f50759d5 19-Mar-2015 Raph Levien <raph@google.com> Add hyphenation to line breaking

This patch adds hyphenation using the Liang hyphenation algorithm,
similar to TeX. It also improves the optimized line breaker so that
it works correctly and efficiently even when the line width is not
constant (there is a specialization for constant width, which is
probably worthwhile, but performance TODOs remain).

Still to be done:

* hyphenator has many shortcuts, only tested with English

* interaction between punctuation and hyphenation is problematic

Change-Id: I2d94a1668ebc536398b7c43fcf486333eeb7c6aa
/frameworks/minikin/libs/minikin/LineBreaker.cpp
01f526614431e3a0a6e1a48039e00b8a9b7d6fbf 14-Mar-2015 Raph Levien <raph@google.com> Add LineBreaker to Minikin

This patch adds a LineBreaker class to Minikin, which will be used for
computing line breaks in StaticLayout. The version in this patch
contains basically the same functionality that existed before, but
hopefully better performance and an interface that's suitable for more
sophisticated paragraph layout.

Note that this version contains a high quality strategy, which mostly
works but doesn't respect varying line width.

Change-Id: I02485d58b1e52856296a72cdd4efd963bc572933
/frameworks/minikin/libs/minikin/LineBreaker.cpp