History log of /frameworks/base/core/java/android/text/StaticLayout.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
78f0d83550d70f043e1b9d35f56efa8c7572f44f 10-May-2016 Keisuke Kuroyanagi <ksk@google.com> Sum up character widths to get the last line width for ellipsis.

To properly apply ellipsis, we virtually concatenate the last line and
overflowed lines after line breaking for a paragraph.
Previously, width of the concatenated line was computed by summing up all
line's width. However, the width is wrong when there are any trailing
white spaces that can be normal white spaces by concatenating lines.
With this CL, we sum up widths of all characters in lines except the last
overflowed line.

Bug: 28599066
Change-Id: I41d828ee8eb8a702cd5096d626b307cbb3467047
/frameworks/base/core/java/android/text/StaticLayout.java
f9a0886da0bddcb7db84b46bfee0129acc8276b8 13-Apr-2016 Siyamed Sinir <siyamed@google.com> Fix StaticLayout left/right indent

Because of a min/max issue, while processing each paragraph StaticLayout
would trim the left/right indent arrays incorrectly.

Bug: 28090810
Change-Id: Ib2b9b48963861e0952bd45a079179e3cca86ffcf
/frameworks/base/core/java/android/text/StaticLayout.java
07e6c237d3f19b98bbec237892a785fd3895368a 04-Apr-2016 Raph Levien <raph@google.com> Apply correct bottom padding to layouts

The returned descender value for BoringLayout and StaticLayout should
be equal to the font's "bottom" metric in the includePadding case.
Previously, the calculation incorrectly included an addition
mBottomPadding value in some cases (which was an attempt to work
around the case where maxLines was set on TextView but not the
corresponding StaticLayout, no longer the case).

Bug: 27901763
Change-Id: I008c5974b979087725a9bb9104e4771b0caac01c
/frameworks/base/core/java/android/text/StaticLayout.java
ca9dbf596df379c5e280235b7a88011b2197f982 17-Oct-2015 Roozbeh Pournader <roozbeh@google.com> am ebdf60e7: am 0221328c: am b3538082: am 5362f273: Merge "Fix line height problem with inline images in StaticLayout." into mnc-dr-dev

* commit 'ebdf60e7c800b2ccda01887a304ddc0edce0361d':
Fix line height problem with inline images in StaticLayout.
431e506b53e59b21a7d18bf46476b8c1528fabf1 16-Oct-2015 Roozbeh Pournader <roozbeh@google.com> Fix line height problem with inline images in StaticLayout.

Previously, paragraphs with ImageSpans in their middle would continue to
carry the height of the image into the line height of next lines. This was
a regression from L.

The bug was due to StaticLayout's out() method almost always
modifying the value of its parameter "fm", although that was only
intended when there were LineHeightSpans in the text. The method
generate() was assuming that it can restore fmTop etc to metrics of
the current span by setting them from "fm" after out() was run, while
"fm" was modified by out() and its original values was lost!

The fix makes sure to set chooseHt back to null if there were no
LineHeightSpans, so out() would not modify "fm" unless necessary.

AOSP bug: https://code.google.com/p/android/issues/detail?id=188042
Bug: 24548073

Change-Id: I0d00af384c35a9d863377972318da9db7668118f
/frameworks/base/core/java/android/text/StaticLayout.java
63aa02e47fa0fdd877b9fde7f1f6eda75b645f92 15-Oct-2015 Roozbeh Pournader <roozbeh@google.com> Merge "Load binary hyphen data files" into mnc-dr-dev
35e026929b10bf05c4c78fce6f05d7569972c5cb 01-Sep-2015 Raph Levien <raph@google.com> Load binary hyphen data files

Support for loading the pre-compiled binary format for hyphenation
patterns.

Bug: 21562869
Bug: 21826930
Bug: 24570591
Change-Id: Iaeaa9c9ac9dac236af6b0d7894c2e2396bc8447d
(cherry picked from commit 091dba2de1e5fa7d4db9f8ccbf1f86e5825d0f52)
/frameworks/base/core/java/android/text/StaticLayout.java
0453112de6663e4711f50f1235bca92c39be4041 08-Aug-2015 Roozbeh Pournader <roozbeh@google.com> Make Hyphenator#get() return an object.

Previously, a native pointer was returned. After this change, callers
should call getNativePtr() if they want to get the native pointer instead.

Bug: 21492297
Bug: 24570591
Change-Id: I745bd88e6e8c86078fffb07f90f8d8f24215410c
(cherry picked from commit e7eac6f540b09892172edd5b584605ea90f5a1ba)
/frameworks/base/core/java/android/text/StaticLayout.java
091dba2de1e5fa7d4db9f8ccbf1f86e5825d0f52 01-Sep-2015 Raph Levien <raph@google.com> Load binary hyphen data files

Support for loading the pre-compiled binary format for hyphenation
patterns.

Bug: 21562869
Bug: 21826930
Change-Id: Iaeaa9c9ac9dac236af6b0d7894c2e2396bc8447d
/frameworks/base/core/java/android/text/StaticLayout.java
e7eac6f540b09892172edd5b584605ea90f5a1ba 08-Aug-2015 Roozbeh Pournader <roozbeh@google.com> Make Hyphenator#get() return an object.

Previously, a native pointer was returned. After this change, callers
should call getNativePtr() if they want to get the native pointer instead.

Bug: 21492297
Change-Id: I745bd88e6e8c86078fffb07f90f8d8f24215410c
/frameworks/base/core/java/android/text/StaticLayout.java
112d9c7f116bec0a52badde81bd778e59e88cb63 07-Aug-2015 Roozbeh Pournader <roozbeh@google.com> Remove EmojiFactory and its mentions from frameworks.

Bug: 18134313
Bug: 20158206
Change-Id: If46cdbd9d558e6592280b2b95f00b87d04de70a2
/frameworks/base/core/java/android/text/StaticLayout.java
22ba7869f6e211f5a692235f52687a6acdd71afc 29-Jul-2015 Raph Levien <raph@google.com> Release text when finishing StaticLayout.Builder

DynamicLayout reuses a StaticLayout.Builder object to avoid having to
allocate. There is a "finish" method that releases any expensive
internal state of the builder object, but it didn't release a
reference to the text object (which in turn may contain references to
lots of other things, especially if it's a Spannable).

This patch releases the text, as well as a few other arrays, at time
of finish.

Bug: 22822416
Change-Id: Icc8b6cd41a9a2d11689df7bd1b9f524c6524f706
/frameworks/base/core/java/android/text/StaticLayout.java
04a84559fd11b36196872b1ac0cb82e5f7367806 10-Jul-2015 Raph Levien <raph@google.com> Fix StaticLayout crash when maxLines = 0

An app setting maxLines = 0 is an edge case, but it can happen. We
had some logic that would index an array at -1 in that case. This
patch just skips the fixup of the ellipsis line break in that case.

Bug: 22353342
Change-Id: I940cf0782b319010f5aedf75b9291df4ac2976d8
/frameworks/base/core/java/android/text/StaticLayout.java
2ea5290ffb9efe0a7c187fb1177ef8ecd089803c 01-Jul-2015 Raph Levien <raph@google.com> Fix problems with StaticLayout indentation

The implementation of indendataion had two issues. First, the indent
pattern would restart on a new paragraph, which created problems when
a multi-paragraph text would flow into a shape. Second, the indents
didn't affect drawing position, which is ok for centered text but not
most of the other alignments. This patch fixes both.

Bug: 21904268
Change-Id: I53a3eb1c192fc0f8f0beace304832eed61b38497
/frameworks/base/core/java/android/text/StaticLayout.java
f4a3f3a03c72b6a38dc2f3f965531dc2a12460df 10-Jun-2015 Keisuke Kuroyanagi <ksk@google.com> Fix: Ellipsis is wrongly applied or not applied in TextView.

In current implementation, ellipsis is applied after
coptuting line breaks without limiting line count. As a
result, ellipsis can be skipped or- wrongly applied because
the breaks are computed to fit with the width.
With this change, the last line and overflowed part are
treated as a single line when the number of breaks exceeds
the remaining line count.

Bug: 6615676
Bug: 18514378
Bug: 20177499

Change-Id: I1d90e299404960cdd22746bad572411b119f7360
/frameworks/base/core/java/android/text/StaticLayout.java
a6a082862b9e2ea4c9e9a1a945927c4040993f6e 03-Jun-2015 Raph Levien <raph@google.com> Rename setTextDir to setTextDirection

StaticLayout.Builder used "setTextDir" as a shorthand, but it's not
as clear as spelling it out. So, setTextDirection.

Bug: 21572282
Change-Id: Ia94476562d70678f963196b87bb63511d30836b6
/frameworks/base/core/java/android/text/StaticLayout.java
95c7a13f2ac4f31ed3aaec9b47b9a29a3dbca978 12-May-2015 Roozbeh Pournader <roozbeh@google.com> Add hyphenationFrequency attribute to TextView and StaticLayout.

This patch adds plumbing to TextView and StaticLayout to control the
frequency of automatic hyphenation used in laying out paragraphs.

Bug: 21038249
Change-Id: Ib45de190eb0a1ed738e69fd61f2b39561b11aec7
/frameworks/base/core/java/android/text/StaticLayout.java
3bd60c7b1125ee42cd7e8746aeaebdb43e8211d8 06-May-2015 Raph Levien <raph@google.com> Clear all StaticLayout.Builder fields on pool recycle

When returning a StaticLayout.Builder object to the pool, it is
important to clear everything out. If not, then the object may have
stale state from a previous layout operation. This was causing CTS
test failures and probably other mischief.

Bug: 20636917
Change-Id: I76fb20076ee954fcb476131a8fbe8833d72fbc0d
/frameworks/base/core/java/android/text/StaticLayout.java
531c30c62b14881aab31a5133920a971b1fbb50e 01-May-2015 Raph Levien <raph@google.com> Expose StaticLayout.Builder publicly

Expose the new Builder pattern for creating StaticLayout. This allows
access to a number of features that have been available to TextView
through a hidden constructor. Some of these features have existed
for a while (mostly maxLines), while others are new (breakStrategy,
indents).

The builder is cleaner and has a better upgrade path than the old
pattern of lots of constructors with varying numbers of arguments.

Bug: 20190561
Change-Id: Ia3cd124825ab0cb469d22d1fc576ad26454545b8
/frameworks/base/core/java/android/text/StaticLayout.java
ebd66ca600dc2c43edb0830bcf1a92fafec30a5a 01-May-2015 Raph Levien <raph@google.com> Make Paint a required field of StaticLayout Builder

This patch moves the Paint parameter from being an option set from
setPaint to being a required field passed into the obtain() method
of StaticLayout.Builder. Thus, it is now possible to get a valid
StaticLayout object just doing .build() on the Builder; all other
fields are optional.

This is in preparation for exposing the builder publicly, but that
is to be a separate CL.

Bug: 20190561

Change-Id: Iefd7800203004e565d068b0c76502cf7cf52d91f
/frameworks/base/core/java/android/text/StaticLayout.java
e319d5a3627aa3cd73c6ec0c76f8593ddefbab9d 15-Apr-2015 Raph Levien <raph@google.com> Add left and right indent arrays to TextView

In support of layout of paragraphs to non-rectangular regions, add
arrays for left and right indents to TextView, along with supporting
StaticLayout builder setters.

Bug: 20182243
Change-Id: I015bcef8f258c89001fcf8a54c179d2dfc0d7943
/frameworks/base/core/java/android/text/StaticLayout.java
ed2eea1bfc1fb57d3b34f2c1e6062b541737e73e 14-Apr-2015 Keisuke Kuroyanagi <ksk@google.com> Fix crash when ellipsize="start" is applied to short line.

Bug: 19833548
Change-Id: I05a36f00f5c7aa6f0ce1993337585f6cfc64649a
/frameworks/base/core/java/android/text/StaticLayout.java
39b4db73c3340ff955f67e4e5318159d19d1ab3a 25-Mar-2015 Raph Levien <raph@google.com> Add breakStrategy attribute to TextView

This patch adds plumbing to TextView to control the strategy used
for breaking paragraphs into lines.

The default for TextView is "quality", while the default for EditText
is "simple", largely to avoid too much re-layout when editing.

StaticLayout now has a builder which provides access to more
functionality and is also cleaner than the old mechanism of having
lots of constructors with varying numbers of arguments. This patch
changes TextView to use that builder, and also contains cleanups
of the Builder within StaticLayout.

Change-Id: Iee3cf3a05a3e51ba0834554e4a3ec606e9cabca5
/frameworks/base/core/java/android/text/StaticLayout.java
26d443aee4ee5a8791417b4ca09e8c78ba8dc78b 30-Mar-2015 Raph Levien <raph@google.com> Revert "Fix build: Revert "Record hyphens from Minikin and draw them""

This reverts commit 5a6eeb3cbe0896ddf4bdccc0b1a81d7aac49821e and
fixes the underlying issue (needed to @hide getHyphen() for subclasses
of Layout, not just the base class), and layoutlib changes for
checkbuild.

Change-Id: I7a2b5f20ae014ea8e224d8c4079cf9131e17e1c1
/frameworks/base/core/java/android/text/StaticLayout.java
5a6eeb3cbe0896ddf4bdccc0b1a81d7aac49821e 30-Mar-2015 Ed Heyl <edheyl@google.com> Fix build: Revert "Record hyphens from Minikin and draw them"

This reverts commit 27fb878c04e18d3bdd6c42ed347194a7c816ed97.

Change-Id: I2b3390cb0b258a2e1a38ad72ae9686177d6ffdb8
/frameworks/base/core/java/android/text/StaticLayout.java
71cbc72e70a6f0e086535c51e35262eb3a4d4bd9 20-Mar-2015 Raph Levien <raph@google.com> Record hyphens from Minikin and draw them

This patch plumbs up hyphens computed in Minikin's LineBreaker,
records them in a new column in StaticLayout, and draws them.
DynamicLayout mirrors the new column, and TextLine is also changed to
make sure the hyphen is only drawn for the last run in a line.

There is a rather primitive mechanism for loading hyphenation
patterns, for testing only at this point.

Change-Id: Ib208568c0f6cff12cf834047500ec1da9ea9f430
/frameworks/base/core/java/android/text/StaticLayout.java
c94f742f7e07a3b86c8f603836c19638472b3e83 07-Mar-2015 Raph Levien <raph@google.com> Calculate line breaks using Minikin

This patch moves the calculation of line breaks for StaticLayout into
the new LineBreaker class provided by Minikin. This specific patch
should preserve existing functionality, but perhaps performance is
better, and the movement opens the door to much more sophisticated
line-breaking.

Change-Id: Iafccb9da4e3559bbeaeb2c7c85f86ddfd8ae2fa1
/frameworks/base/core/java/android/text/StaticLayout.java
70616ecd22fafccf2fab7565ccfbb3b5f91c5580 04-Mar-2015 Raph Levien <raph@google.com> Start moving text measurement into native code

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
/frameworks/base/core/java/android/text/StaticLayout.java
ce4155a204144ae5462f547f7738af24be5a1f77 11-Mar-2015 Raph Levien <raph@google.com> Fix android.text.cts.StaticLayoutTest#testGetEllipsisCount

The "moreChars" predicate (which is used in ellipsis computation) was
slightly incorrect, sometimes being computed as false when the line
break is at the end of a paragraph but not the end of the buffer.
This patch makes the behavior consistent with shipping versions.

Bug: 19676414
Change-Id: I72e16794e895c2eb765b21feaf59fcdccc4857f1
/frameworks/base/core/java/android/text/StaticLayout.java
4c1f12efcf24e404df40f19075eb95a148a9d6a1 03-Mar-2015 Raph Levien <raph@google.com> Add JNI StaticLayout.Builder

This patch adds a native C++ Builder object for StaticLayout to
complement the Java one introduced in a previous patch.

The Builder object contains state used in constructing a layout, as well
as temporary buffers, to avoid having to allocate such. In particular,
it holds a break iterator, so avoids the cost of constructing that in
the common case of a single locale.

Change-Id: I1125103b7ccf00b8674c1586c3ea8d5d915fdd5b
/frameworks/base/core/java/android/text/StaticLayout.java
d3ab692d28018825578ff05832644cfad60233fb 02-Mar-2015 Raph Levien <raph@google.com> Some refactoring of StaticLayout

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
/frameworks/base/core/java/android/text/StaticLayout.java
0b1b82473d78b0887fe8b22d30812d0d2b7b6338 06-Feb-2015 Neil Fuller <nfuller@google.com> am 022cf57f: am a08934cf: am f789d45b: Merge "Avoid static initialization of Layout from TextUtils" into lmp-mr1-dev
automerge: c63efbd

* commit 'c63efbd928cc14e32fe19b2dec41d15ffc584182':
Avoid static initialization of Layout from TextUtils
d29bdb266d54b4551f42776bb790e80147a279d0 06-Feb-2015 Neil Fuller <nfuller@google.com> Avoid static initialization of Layout from TextUtils

This works around a bug in standalone (e.g. non-Zygote)
runtimes when a device is attached to a host that is running
DDM.

There is a race condition:

When the runtime receives a HELLO from DDM it calls
TextUtils.isEmpty().

Calling any TextUtils methods statically initializes
Layout. Layout has dependencies on other classes, which in
turn have dependencies on native methods that are not always
registered when the call takes place. Registration and DDM
handling are done in separate threads.

This is not a fix, merely a workaround until the race can
be resolved.

Bug: 18081539
Change-Id: If1bd3de6597bc93da381c8f86dacf40156449561
/frameworks/base/core/java/android/text/StaticLayout.java
4c02e831728daf9374b52e2fe3fdbf7ce982bfc4 12-Dec-2014 Raph Levien <raph@google.com> Revert "Fix missing ellipsis when just one character is truncated"

This reverts commit 93e48e8cf18610bfb3f88ccd29891b2959dd606b.

The existing code in master already worked correctly for the original
problem, and this change just introduced a new problem.

Bug: 18576264
/frameworks/base/core/java/android/text/StaticLayout.java
1a91d8df50562510084cd041501a3099f962a71c 08-Dec-2014 Raph Levien <raph@google.com> resolved conflicts for merge of b9d21d62 to master

Change-Id: I2936c2a47290c3ea0fc66d460215f9e75d17ebf2
0e3c5e827235911d33312e431975533f046421e7 04-Dec-2014 Raph Levien <raph@google.com> Fix off-by-one error in computeEllipsis

In the Truncate.MIDDLE case, when the line is less than half the layout
width, the computeEllipsis logic could go past the left edge of the
string. This patch fixes the off-by-one and avoids the resulting index
out of bounds crash, and also changes the behavior so that when
ellipsizing at the middle, the string to the end of the paragraph is
taken into account.

Bug: 18508627
Change-Id: I24be09c23a5aa158791a9717419307613b8a22e8
/frameworks/base/core/java/android/text/StaticLayout.java
93e48e8cf18610bfb3f88ccd29891b2959dd606b 17-Nov-2014 Raph Levien <raph@google.com> Fix missing ellipsis when just one character is truncated

The "moreChars" test in StaticLayout's generate method would evaluate to
false when the last character in a word caused the break. This in turn
suppressed the ellipsis in this case. The proposed fix is always to set
moreChars true in the code path where the line is broken because more
text wouldn't fit.

Bug: 17738112
Change-Id: Ifa1a69841ca952da4d1937dc8326778179b026b3
/frameworks/base/core/java/android/text/StaticLayout.java
396879f3f88e6384588c421c7e57ceef932aad59 17-Nov-2014 Raph Levien <raph@google.com> Fix missing ellipsis when just one character is truncated

The "moreChars" test in StaticLayout's generate method would evaluate to
false when the last character in a word caused the break. This in turn
suppressed the ellipsis in this case. The proposed fix is always to set
moreChars true in the code path where the line is broken because more
text wouldn't fit.

Bug: 17738112
Change-Id: Ifa1a69841ca952da4d1937dc8326778179b026b3
/frameworks/base/core/java/android/text/StaticLayout.java
7053919a3a55ad1b58e6db701afda18850037732 16-Oct-2014 Deepanshu Gupta <deepanshu@google.com> Add Optimized Line breaking to LayoutLib

Change-Id: I308a7d07d98ddd7747f16e06bcffcfd14d667534
/frameworks/base/core/java/android/text/StaticLayout.java
26c87cfb584d4533c9b47f7cbf75f6921c52b928 28-Aug-2014 Raph Levien <raph@google.com> Ignore width of trailing whitespace for computing ellipsis

We used the full width of a line, including trailing spaces, to compute
ellipsis, sometimes causing spurious ellipsization when the space pushed
it past the layout width. This patch uses only the width up to the last
graphing character.

Fix for bug 17186801 "First line of title text is getting truncated even
if there's space on second line"

Change-Id: I49d07c18c8dd1d3b279f591224d23e10645dc8c0
/frameworks/base/core/java/android/text/StaticLayout.java
969e7b949633baebd3f6090a60d622ee475a5b22 22-Jul-2014 Anish Athalye <aathalye@google.com> Add optimizing line breaker

Change-Id: I1eabc863e7f027c4c19a9ab23e561c774c721993
/frameworks/base/core/java/android/text/StaticLayout.java
c8f9e6218681640d5f384c12edf06619be56a583 22-Jul-2014 Anish Athalye <aathalye@google.com> Implement line breaking in native code

The main purpose for this change is to prepare for adding support for
alternative line breaking algorithms (such as optimal line breaking).

The existing implementation of line breaking was intertwined with
measurement, so it wasn't structured in a way such that other line
breaking algorithms could be easily added. In addition to this,
algorithms (such as optimal line breaking) are usually fairly complex
and computation-intensive, so it is advantageous to implement them in
native code.

This has several other advantages:

* Unlike the Java code in the previous version of generate(), this
implementation separates line breaking from measurement. This
makes it easier to understand and modify the line breaking process
without affecting measurement (and vice versa).

* This native implementation of greedy line breaking is identical to
the Java version in terms of functionality, and it is similar in
terms of performance, depending on the use case. The performance
gains from this change are not significant due to increased JNI
overhead. However, this change is a step in the right direction in
terms of increasing performance. Once more code moves to C++,
there will be fewer JNI crossings per layout call and less data
will be passed from Java to C++, resulting in better performance.

This change moves line breaking from Java to native C++ code. Inspired
by the "Breaking Paragraphs into Lines" paper by Knuth and Plass (1981),
we express the line breaking problem in terms of 'box', 'glue', and
'penalty' primitives, along with a few others. Our implementation
differs in a couple ways:

* We do not want to clip text when words are wider than the view, so
we add a new primitive type to represent break opportunities
between letters. These breaks are avoided whenever possible, but
when single words do not fit on lines by themselves, they can be
broken so the entire word is visible.

* We have to support tab characters, along with user*specified tab
stops, so we add a new primitive type for that purpose.

* We are left*aligning text, and so we are not using shrinking /
stretching glue.

* We do not support hypenation, so we do not use penalties that have
widths.

Change-Id: Ia22d1d1275ef26ff3d7b41ee2658e4db525a0305
/frameworks/base/core/java/android/text/StaticLayout.java
c56c9ee7185cfac3c649499a0205530faf88ee82 15-Aug-2014 Anish Athalye <aathalye@google.com> am c255033f: am 675f13bf: am 2f2e3797: Merge "Make LeadingMarginSpan2 behavior more consistent" into lmp-dev

* commit 'c255033f0a4b55f8d4279a9a5b283ed742a5e642':
Make LeadingMarginSpan2 behavior more consistent
ab08c6d38ab2e575f809ca8ce4c7f095e49d258c 08-Aug-2014 Anish Athalye <aathalye@google.com> Make LeadingMarginSpan2 behavior more consistent

This addresses b/16486549.

This change updates public documentation to specify the behavior of
LeadingMarginSpan2s. This change specifies what happens when a
LeadingMarginSpan2 is combined with other LeadingMarginSpans. This
behavior was not previously documented.

LeadingMarginSpan2s specify the number of lines used for the leading
margin. When laying out and rendering, for all LeadingMarginSpans, the
first line margin is applied for the number of lines specified by the
LeadingMarginSpan2.

Previously, this behavior was slightly buggy -- the LeadingMarginSpan2
affected all LeadingMarginSpans when laying out text, but not when
rendering.

This change is designed to cause the least amount of breakage in
existing code while achieving consistency with the way
LeadingMarginSpan2 is handled in layout and drawing.

For the most common use of LeadingMarginSpan2 -- getting a multi-line
first margin in the first paragraph of text in a layout -- this should
cause no change in behavior. For any other uses, the old (buggy)
implementation most likely did not exhibit correct behavior to begin
with, so developers were most likely not relying on that functionality.

Change-Id: I6f69df09c0130e703458e65bf3eaac4a905df56e
/frameworks/base/core/java/android/text/StaticLayout.java
46514a75e33e87d3461a502a5a0821c46b2783eb 07-Aug-2014 Anish Athalye <aathalye@google.com> Fix performance bug in layout

When processing text ending with a newline character, calling
MeasuredText#setPara() on the whole buffer is inefficient because the
call results in a copy of the entire buffer.

Change-Id: I6fa038d950f6287665bad3dc0070234c98bc8a7a
/frameworks/base/core/java/android/text/StaticLayout.java
9cd3bccdb23bfb06da8ac19a44b4216039699ff9 27-Jun-2014 Anish Athalye <aathalye@google.com> Fix line breaking for clusters in narrow views

Clusters were broken incorrectly when in narrow views (when the width of
the cluster was greater than the width of a view). Also, out() calls
were modifying fm, so clusters that were too wide were not positioned
correctly.

Change-Id: I521f8dc6338f5f1de6858af3f0c0bd320aa46bc0
/frameworks/base/core/java/android/text/StaticLayout.java
88b5b0be887fc5dc3b0b879b4179dde200d2e4d6 24-Jun-2014 Anish Athalye <aathalye@google.com> Implement line breaking using ICU break iterator

Change-Id: I4ad98757aa2eab5dbc2ae44c0391e900ef20c4d0
/frameworks/base/core/java/android/text/StaticLayout.java
54dacbe7ca6d8a8c71d601fcf773e7b27eba3a53 29-Apr-2014 Yuling Liang <yulingliang@google.com> am 3914a33c: am 26a5c2dd: Merge "Followon fix for 14276128 Clipping at bottom of TextView" into klp-modular-dev

* commit '3914a33c01102f5de51e33d006c0aeedf2693af0':
Followon fix for 14276128 Clipping at bottom of TextView
d97b097a5b7a906e8d30c6d3b0f41c55650ce7a9 24-Apr-2014 Raph Levien <raph@google.com> Followon fix for 14276128 Clipping at bottom of TextView

The previous fix did not work when the text was ellipsized, because the
test for whether the line was the last line was incorrect. The new test
handles both the end of the buffer and the case where it is the last
line because of ellipsizing.

So this should be the proper fix for bug 14276128 Clipping at bottom of
TextView when lineSpacingMultiplier < 1

This version of the patch also handles the single-line case (which is
computed in BoringLayout rather than StaticLayout).

Change-Id: I88791acc2aa493cc8c599b374f4d213571260b4b
/frameworks/base/core/java/android/text/StaticLayout.java
2be1f8c3f4d338c7b7c73bb642bc410ef27c8ee4 25-Apr-2014 Yuling Liang <yulingliang@google.com> am 69a9d925: am eea94f06: Merge "Revert "Followon fix for 14276128 Clipping at bottom of TextView"" into klp-modular-dev

* commit '69a9d92502428a4cf6eb6b5bf6577d9e525796a2':
Revert "Followon fix for 14276128 Clipping at bottom of TextView"
10973c777648a5893f9c668d2675061f359c223d 25-Apr-2014 Yuling Liang <yulingliang@google.com> Revert "Followon fix for 14276128 Clipping at bottom of TextView"

This reverts commit a10e19845ce76c0e4dd38018c84b83c9255dc9fe.

Change-Id: I6d40451c9eb6285859e16d251b55947663a3553a
/frameworks/base/core/java/android/text/StaticLayout.java
ec2b7d6dd7caa8ad14de90c3d2da5a3f66f46050 25-Apr-2014 Yuling Liang <yulingliang@google.com> am 60f8349b: am 243e551a: Merge "Followon fix for 14276128 Clipping at bottom of TextView" into klp-modular-dev

* commit '60f8349b9819130e81e28106a35bf3362d337045':
Followon fix for 14276128 Clipping at bottom of TextView
a10e19845ce76c0e4dd38018c84b83c9255dc9fe 24-Apr-2014 Raph Levien <raph@google.com> Followon fix for 14276128 Clipping at bottom of TextView

The previous fix did not work when the text was ellipsized, because the
test for whether the line was the last line was incorrect. The new test
handles both the end of the buffer and the case where it is the last
line because of ellipsizing.

So this should be the proper fix for bug 14276128 Clipping at bottom of
TextView when lineSpacingMultiplier < 1

Change-Id: Iac5c96f2273142031c18a27f504f7d6d5fcf823e
/frameworks/base/core/java/android/text/StaticLayout.java
79cb5505a97a0465fb849dc20dcaf3dd2f608c9f 24-Apr-2014 Raph Levien <raph@google.com> am 07bed492: am e4ee0e31: Merge "Fix bug 14276128 Clipping at bottom of TextView" into klp-modular-dev

* commit '07bed4921a05e717a4b7f10a25e3830e346426b7':
Fix bug 14276128 Clipping at bottom of TextView
936df680166bd0cd6146f1a0c8fa8ad9b807f794 24-Apr-2014 Raph Levien <raph@google.com> Fix bug 14276128 Clipping at bottom of TextView

Avoid applying "extra" linespacing to the last line of a layout, because
when that is negative, it causes clipping.

Change-Id: I4cc8792fd3444e4118604cc3d0f816d59dfc1e74
/frameworks/base/core/java/android/text/StaticLayout.java
63b3d8c62ef24121f40b2262e89b3f37527beab3 04-Apr-2014 Raph Levien <raph@google.com> Fix extra text appearing after ellipsis

This is a fix for bug 7615701 TextView: calling setText with long
strings causes ellipsize to not work correctly. The problem is that the
"break" when the last line was ellipsized did not fully break out of
both loops of the processing logic, but only the inner loop. This
caused the outer loop to restart at the next span, causing the next span
boundary to overwrite the line end of the last visible line.

The fix simply returns from the function in that case, as there is no
further processing needing to be done.

Change-Id: I5b34233ffba6f0f6f1c12b9565b4fc53e83a4892
/frameworks/base/core/java/android/text/StaticLayout.java
776abc24cdd18610232a50b997cce3cffa74609b 07-Mar-2014 Adam Lesinski <adamlesinski@google.com> Uses VMRuntime.newUnpaddedArray for ideal array sizes

Bug:13028925

Change-Id: I0a9301248b10a339afbdc5e4ffe3310ac4fa1fb7
/frameworks/base/core/java/android/text/StaticLayout.java
e631889e1ae7edc6a2fae495ba504f85820b6a4b 19-Jun-2013 Fabrice Di Meglio <fdimeglio@google.com> Fix bug #9073962 - Carret is still on the left with an empty EditText in Arabic Locale

- fix StaticLayout special case with empty string or new line

Change-Id: Icb51feedce49db661ed17b6907eb0db83d0b763c
/frameworks/base/core/java/android/text/StaticLayout.java
8d087c349f0a3b7946a95869562f020892d47a86 29-Mar-2013 Raph Levien <raph@google.com> Make zero width space a line breaker

This patch makes ZWSP (U+200B, zero width space) a potential line break
in text layouts. This is a fix for bug 8501809.

Change-Id: I18c1f8464e6c821ff75f819141bacc714a878700
/frameworks/base/core/java/android/text/StaticLayout.java
7c3255f14f83afb00da32aede43664e16da51f53 24-Aug-2012 Raph Levien <raph@google.com> Fix bug 7054190 line breaks at inappropriate places

We were doing line breaks after punctuation as long as they weren't
surrounded by digits. This is a misinterpretation of the Unicode line
breaking algorithm. Punctuation (class IS) is not hugely different than
the default classes (NU and AL) - there are breaks after punctuation
that are allowed (for example, followed by an open parenthesis), but
we're not implementing the algorithm with anything near that level of
fidelity.

The long term fix is to really implement the algorithm. In the shorter
term, the easiest thing to do is to remove the special case altogether.

Change-Id: Ic4dc3216c2a4191fbb7cfa06e9dc038d1a56398c
/frameworks/base/core/java/android/text/StaticLayout.java
81541491946bfc4f2e26c171b4ebff4249dca51c 27-Jun-2012 Gilles Debunne <debunne@google.com> Better handling of spaces at ends of lines in StaticLayout.

Skipping spaces at ends of line used to be done only when ok != here
(a potential line break was found).

Moved this logic up one level to handle all cases.

Also moved maxLine test in the block that actually adds a new line.

Updated the unit tests accordingly.

Change-Id: Ib10bc838b1ffa5b8a60259ea4b622d9fecb2ec70
/frameworks/base/core/java/android/text/StaticLayout.java
badf5a9442e639dc6ae2c4794c202143f6d2f16d 19-Jun-2012 Gilles Debunne <debunne@google.com> Merge "Fixed text rendering issue with spans." into jb-dev
cd943a7a013952af9b7286fd506fd63bf0993ac1 08-Jun-2012 Gilles Debunne <debunne@google.com> Fixed text rendering issue with spans.

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
/frameworks/base/core/java/android/text/StaticLayout.java
8d44fff7e62f77c3b3072a96712cc1389e63ca64 14-Jun-2012 Fabrice Di Meglio <fdimeglio@google.com> Fix bug #6661824 Hebrew Text can be clipped

- use the correct ellipsis char in both measurement and rendered string

Change-Id: Ia00285fc16da528f18702719026503b5d0610642
/frameworks/base/core/java/android/text/StaticLayout.java
34a126e51aaf22e32c7af808ec6b5a0c41ae3311 01-Mar-2012 Fabrice Di Meglio <fdimeglio@google.com> Fix bug #3389545 android:ellipsize="end" doesn't work without using android:singleLine="true" which is deprecated

- take care of single line case too

Change-Id: I73c3dcb96f22241b35d7cbaf43cd9bd46a4abcaa
/frameworks/base/core/java/android/text/StaticLayout.java
d300e75eff0d5e54390400cbd3f80dc4cea8b617 17-Oct-2011 Gilles Debunne <debunne@google.com> Wrong word cut at end of lines with spaces

Bug 5185017: when the line length is exceeded at a space character,
we use the previous ok width, and the last word is wrapped to next line
although it fits.

This back-track also generates problem with the span parsing, where the
spanStart indexes are no longer monotonuously increasing.

Plus some refactoring in this code (unused parameters, calls to out())

Change-Id: Ia8cd310a732752af3bd370bf0a16db23d40e83f2
/frameworks/base/core/java/android/text/StaticLayout.java
ad0b051b133baf92f199c96a8ac1e81b3393190c 05-Oct-2011 Fabrice Di Meglio <fdimeglio@google.com> Revert "Fix bug #5387832 [UI/Visual] Address of the website is not displayed properly(second line of the address is partly shown)"

This reverts commit a130e5f59dc6b2117e4c1a8ffef54828e9ea44c7
/frameworks/base/core/java/android/text/StaticLayout.java
a130e5f59dc6b2117e4c1a8ffef54828e9ea44c7 29-Sep-2011 Fabrice Di Meglio <fdimeglio@google.com> Fix bug #5387832 [UI/Visual] Address of the website is not displayed properly(second line of the address is partly shown)

- make DynamicLayout honor max lines
- make StaticLayout.generate() take maxLines as a parameter instead of using the field mMaximumVisibleLineCount

Change-Id: I9eafb1be4b8bb2aa881514955a6903f559cb6a1e
/frameworks/base/core/java/android/text/StaticLayout.java
cb332649e44db86ff8b4e7f006db4bbfd82fed55 24-Sep-2011 Fabrice Di Meglio <fdimeglio@google.com> Fix bug #5366547 TruncateAt.MARQUEE should be replaces with "two dot" ellipsis on hardware that dont support MARQUEE

- introduce TruncateAt.END_SMALL
- code refactoring for suppressing use of hardcoded constants

Change-Id: I70e24857cd5d6bd012a743cbc0ba46fbd06d5457
/frameworks/base/core/java/android/text/StaticLayout.java
aef455fd5b4c667267deb050bc7997e737b7507e 30-Aug-2011 Fabrice Di Meglio <fdimeglio@google.com> Fix bug #5197549 android.text.cts.StaticLayoutTest#testGetEllipsisCount fails on IRK49E mysid-userdebug

- make the ellipsizing condition easier to read
- allow ellipsizing only and only if
- not MARQUEE
- single line
- END only on the last visible line when multiple lines

Change-Id: I6b08e4a735ebc4875a208f0538d9cf937240316e
/frameworks/base/core/java/android/text/StaticLayout.java
8059e0903e36cbb5cf8b5c5d5d653acc9bbc8402 11-Aug-2011 Fabrice Di Meglio <fdimeglio@google.com> Fix bug #3388534 Long file names are improperly displayed when played

- force ellipsising when there are more lines found than maxLines
- do not care about lines when we have reached maxLines
- also fix relayouting when changing maxLines thru setMaxLines()
- do not allow START / MIDDLE ellipsis when there are multiple lines
(and print a log accordingly)

Change-Id: I90f5a7f5200a220aceee01fb7300bec2c4c3a075
/frameworks/base/core/java/android/text/StaticLayout.java
e5ea4403ce58982522554b7ff23f41e6551923c1 01-Aug-2011 Romain Guy <romainguy@google.com> Plug memory leak in EditText.

Change-Id: I0b42c23ceeaa958d02255945c35ff6807c177114
/frameworks/base/core/java/android/text/StaticLayout.java
cb379120456d8065d742021fc5c66748fc8a11a8 07-Jul-2011 Doug Felt <dougfelt@google.com> Implement textDirection heuristic selection.

Change-Id: I2fcf18de573f2d66494fa5ed61e4273c3c6078c7
/frameworks/base/core/java/android/text/StaticLayout.java
1e3ac18e7ad03e02819f3e1a89d6a80a2bb7645f 08-Mar-2011 Gilles Debunne <debunne@google.com> Empty spans are not considered in text layout/rendering process.

Bug http://code.google.com/p/android/issues/detail?id=14786

Empty spans are affecting the text before and after them. See the
comment in TextUtils.removeEmptySpans for details.

Change-Id: I40376c32fd56a17efde6219f9b2593e4b4ab1ba1
/frameworks/base/core/java/android/text/StaticLayout.java
f3fa0cdbaea109b114f7facbb5d42de3fc12bbc8 03-Feb-2011 Gilles Debunne <debunne@google.com> Bugfixes in StaticLayout.

Bug 3422121

With ellipsize, lines starting with a very long word that does not
fit inside the width were simply ignored. Cut the long word instead.

start - widthStart index offset shift in BiDi.

The original ellipsize-end patch that added '...' after the last
word on end-ellipsized lines has been punted in favor of a true
ellipsize support in I.

I believe the StaticLayout calculateEllipsise is a no-op since textwidth <= avail
by construction: fitWidth and okwidth are < outerWidth. The only exception is the
paraEnd != here case in generate (when not a single character fits in width).
This case is exercised by StaticLayoutTest in cts (width of 8 pixels) and revealed
an offset error in widstart.

All in all, it looks like this code was probably never really tested. I tried some
typical text configuration to make sure these changes improved the situation.

Change-Id: Ibee410bd7db453abf93e10e8beb844eae998922c
/frameworks/base/core/java/android/text/StaticLayout.java
121c82c8130c2658f73fb19f3a62eb88c8679968 16-Feb-2011 Fabrice Di Meglio <fdimeglio@google.com> Code cleaning

- remove unused local variables
- add char constants
- some variables renaming to be more understandable

Change-Id: Id54dd671b1449cca6463bf77160dc72c8bf0c805
/frameworks/base/core/java/android/text/StaticLayout.java
be46d1456beb7e2f3e8b82bda2d0a5023db3debd 05-Feb-2011 Paul Eastham <eastham@google.com> Revert "Fix for StaticLayout bug with ellipsized text"

This reverts commit bbc910f229dec45fa7481a62fbf051f7ff3130e7.
/frameworks/base/core/java/android/text/StaticLayout.java
bbc910f229dec45fa7481a62fbf051f7ff3130e7 04-Feb-2011 Gilles Debunne <debunne@google.com> Fix for StaticLayout bug with ellipsized text

This fixes the test, but I believe this class still needs a lot of fixing.

Change-Id: Ib6386196908ea8432b175d6994f9299778a322d2
/frameworks/base/core/java/android/text/StaticLayout.java
0a4db3c5270440eeb7e4e44a7029926e239ec3bd 14-Jan-2011 Gilles Debunne <debunne@google.com> Pixel were missing on the last line of text when using MaxLines.

Bug 3295544

Only the last line of text includes the bottomPadding (extra line
spacing below the characters' descent. When The text is clipped using
maxLines, the desired height correctly added this value, but getLineTop
and getLineDescent are also used when the layout is drawn.

The fix is to make the layout aware of its clipping so that these
values are correctly updated.

Change-Id: I703656cf45022d34a90f55f0ed8fc5e4b30f80b1
/frameworks/base/core/java/android/text/StaticLayout.java
d434d2334d2362f77d3a3fb0b1f788f667039bbf 05-Jan-2011 Gilles Debunne <debunne@google.com> MaxLines is respected in TextViews, even when ellipsize is set to end.

Bug 3322607

Re-applying the revert that fixed the ANR (https://android-git.corp.google.com/g/#change,87129),
whith an updated here value that seems to fix the problem.

This layout code is pretty involved, with destabilizing variable names and
uses. Althought I tested it, this fix is not 100% garanteed.

Change-Id: I1f4b09b329fb8a328ae8ab26ae472e343453beda
/frameworks/base/core/java/android/text/StaticLayout.java
4cf435df2e485e405f085982ac8fd9c82fb57d47 05-Jan-2011 Gilles Debunne <debunne@google.com> Revert "Fix for ellipsized text that has two lines at maximum."

This reverts commit 32ea4ffdca0f4706e447d0a275f259fe121b9e6a.

This change introduces an ANR in AutoComplete text view. There is
an infinite loop when the suggestion TextView is measured.

Reverted to fix the ANR, opening a new bug for the ellipsize.

Bug 3315813, 3320375, 3318059

Change-Id: I1872116ca1f39324ed4500d338bafac7e0d195ec
/frameworks/base/core/java/android/text/StaticLayout.java
32ea4ffdca0f4706e447d0a275f259fe121b9e6a 21-Dec-2010 Gilles Debunne <debunne@google.com> Fix for ellipsized text that has two lines at maximum.

The breakOnlyAtSpaces test did not include the reset at the end of the loop
which resets j and w (current position and width). As a result, the second line
was too long from the start and never cut again.

Hours a debug, a simple { change.

Bug 2969667

Change-Id: I1e5b4a37cd9e64d115e6343d7788db3a6ef881e0
/frameworks/base/core/java/android/text/StaticLayout.java
6611147383118cd91cc29b31bff9aaf4c853f39d 19-Nov-2010 Gilles Debunne <debunne@google.com> Clean-up in StaticLayout

Change-Id: I81ac5d8bef7ce8f4f65e3a8c7da8393ce0a87558
/frameworks/base/core/java/android/text/StaticLayout.java
74d31ef2b2c42b54fa1f7cf94ea955ea67ab69a0 06-Aug-2010 Eric Fischer <enf@google.com> Fix a bug where paragraph styles could leak onto an adjacent empty line.

When the text ends with an empty line, the getSpans() call to retrieve
styles for it would also retrieve the styles of the preceding line.
Add a special case to detect and prevent this.

Change-Id: I888131cacce6bf45e68c53c931ebe8d58db0b7a9
/frameworks/base/core/java/android/text/StaticLayout.java
24ca4545f3fa9ffaf0a84af11f1ab74cd14d232e 23-Jun-2010 Kenny Root <kroot@google.com> Check for spanned before computing tab stops

Don't try to check for tab stop spans in non-Spanned text input.

Change-Id: I54d69c8e0246f5a38d0713a89b8b455a478285f0
/frameworks/base/core/java/android/text/StaticLayout.java
c982f60e982c1d2df9f115ed9a5c3ef3643d0892 25-May-2010 Doug Felt <dougfelt@google.com> Fix alignment issues with RTL paragraphs.

Also remove unused debugging code that depends on junit.
Remove trailing whitespace in changed code.

Change-Id: Ie02d1b8220c599a672ee6e91af0fba634e0f620c
/frameworks/base/core/java/android/text/StaticLayout.java
23241887515ed77687c23e29a4a3ffff671666bd 02-Jun-2010 Doug Felt <dougfelt@google.com> Fix IndexOutOfBoundsException when measuring text.

Some line wrapping conditions caused the same style run to be measured
twice, incorrectly advancing the position in the width buffer and
occasionally causing measurement to run out of room. The fix is to
not remeasure the same style run.

Change-Id: Iceb29729c1c27bb602df20fdf83af1da28c82e11
/frameworks/base/core/java/android/text/StaticLayout.java
e8e45f2c05cb3b6d23f30c8f96d8e0b3699cea7a 29-Mar-2010 Doug Felt <dougfelt@google.com> Refactor Styled utility functions into reusable objects.

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
/frameworks/base/core/java/android/text/StaticLayout.java
4e0c5e55e171532760d5f51e0165563827129d4e 16-Mar-2010 Doug Felt <dougfelt@google.com> Don't measure for a secondary caret unless we have one.

Also, clean up imports and trailing whitespace.

Change-Id: I5ebaaceb756600a1ca7370ab3ef078ce200545ef
/frameworks/base/core/java/android/text/StaticLayout.java
9f7a4442b89cc06cb8cae6992484e7ae795323ab 01-Mar-2010 Doug Felt <dougfelt@google.com> Enable nested bidi levels in a paragraph.

Changes the internal representation of direction information in the Directions object to be a visually-ordered list of start/length+direction pairs instead of a list of directionality inversion offsets.

Rewrite Layout.getOffsetToLeft/RightOf to use run information instead of width metrics.

Remove java Bidi, use native. Switch bidi tests to test native, expect levels instead of dirs.

Add test of directionality. Leave in switch to turn new code off and restore previous behavior for now.

Change-Id: Iea8bb46c678a18820e237c90f76007a084c83051
/frameworks/base/core/java/android/text/StaticLayout.java
de61f78340ae23384e16ad675aefdd01ddf07c76 10-Mar-2010 Eric Fischer <enf@google.com> Don't break lines in the middle of a smiley or other graphic replacement.

The code that was supposed to keep this from happening was not being
executed when the text was all ASCII.

Bug 1899722

Change-Id: Ifc97a4423d6136e19abbc4c82eb36ac0216ce415
/frameworks/base/core/java/android/text/StaticLayout.java
20178d62cf669af18467a16d3c4c4237ed42151c 22-Feb-2010 Doug Felt <dougfelt@google.com> Factor bidi algorithm into separate method.

Add rudimentary support for overriding default base line direction heuristic.
Add some simple tests of the bidi implementation.
/frameworks/base/core/java/android/text/StaticLayout.java
1065758a0f8966a8597a61492112f7859a7050a4 22-Feb-2010 Doug Felt <dougfelt@google.com> Fix rounding of extra spacing when it is negative.
/frameworks/base/core/java/android/text/StaticLayout.java
71b8dd71e49016e057c46a257f79162d186a3c3a 17-Feb-2010 Doug Felt <dougfelt@google.com> Enhance text docs, rename some variables for clarity, comment places in the code
for further investigation.
/frameworks/base/core/java/android/text/StaticLayout.java
7b5676e4d40a09ccdbc8b6f691a3d8be23e480d3 16-Oct-2009 Mark Wagner <mxw@google.com> support for multiline paragraph style indentation

This change is likely incomplete and perhaps not right in other ways.
The gist of the change is that the span can return the number of lines
to which to apply the "leading margin".
Some specific things that should be looked at:

1) if the user has nested multiple
LeadingMarginSpans then they will inherit the "line count" feature.
This is wrong but I didn't want to spend time fixing it until it
was clear that this overall approach was acceptible.

2) The units for how many lines should indented is "lines" rather than
something like dips.

3) I wasn't sure what our strategy was for binary compatibility so
I didn't want to modify the methods in LeadingMarginSpan. Instead I
made another interface with extends LeadingMarginSpan that has the
extra method to return the line count.
/frameworks/base/core/java/android/text/StaticLayout.java
a9f1dd021f8f6ee777bc4d27913bd40c42e753af 13-Aug-2009 Eric Fischer <enf@google.com> Make <font size> and <font height> in string resources respect density.

This unfortunately requires API changes because the existing text markup
classes had no access to the screen density.

TextPaint gains a "density" field so that TextView can pass the density
along. AbsoluteSizeSpan gains a new flag to indicate that its argument
is in dip instead of in physical pixels. LineHeightSpan gains an inner
interface whose chooseHeight() method includes a TextPaint argument so
it can get at the density. And when StringBlock creates the markup
objects, it now uses the density-aware versions.

Bug 1976971, Bug 2031746
/frameworks/base/core/java/android/text/StaticLayout.java
549d7243ff9cf638a63a0d5cc82c792b39484e8e 31-Mar-2009 Eric Fischer <> AI 143709: am: CL 143678 am: CL 143540 Try not to start TextView lines with non-starter characters.
TextView was previously following the "relaxed" line breaking
convention and would allow a line break between any two
ideographic characters. Tighten that up and do not allow
line breaks before non-starter characters (sound and iteration
marks and small Hiragana and Katakana).
Original author: enf
Merged from: //branches/cupcake/...
Original author: android-build
Merged from: //branches/donutburger/...

Automated import of CL 143709
/frameworks/base/core/java/android/text/StaticLayout.java
423f0e4205e3c49c6a87b389fa6025772aa7010c 28-Mar-2009 Eric Fischer <> AI 143314: am: CL 143165 am: CL 142861 Make TextView Emoji scale to match the size of the text.
Original author: enf
Merged from: //branches/cupcake/...
Original author: android-build
Merged from: //branches/donutburger/...

Automated import of CL 143314
/frameworks/base/core/java/android/text/StaticLayout.java
105925376f8d0f6b318c9938c7b83ef7fef094da 19-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake_rel/...@140373
/frameworks/base/core/java/android/text/StaticLayout.java
9066cfe9886ac131c34d59ed0e2d287b0e3c0087 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/java/android/text/StaticLayout.java
d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/java/android/text/StaticLayout.java
d24b8183b93e781080b2c16c487e60d51c12da31 11-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@130745
/frameworks/base/core/java/android/text/StaticLayout.java
f013e1afd1e68af5e3b868c26a653bbfb39538f8 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
/frameworks/base/core/java/android/text/StaticLayout.java
54b6cfa9a9e5b861a9930af873580d6dc20f773c 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/frameworks/base/core/java/android/text/StaticLayout.java