History log of /frameworks/base/core/java/android/text/Layout.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
7557a5a090204dccfd32096af4a6ded1f9bb5b17 12-Apr-2017 Roozbeh Pournader <roozbeh@google.com> Revert "Make selection end handle stick to selection at line end."

This reverts commit 7c263ddd582abacbbe9c71341a6ef4c704d12100.

Fixes: 35944608
Bug: 21305922
Test: Manual
Test: Updated CTS and core tests pass.
Change-Id: Ic840f8771c3d5850f4f6f44ea199b144cac740c0
/frameworks/base/core/java/android/text/Layout.java
4b4730d90eef9dd4140cf750e2feba61acae9044 31-Mar-2017 Seigo Nonaka <nona@google.com> Change justification parameter from boolean to int.

Bug: 35766005
Bug: 35764323
Test: Manually done
Change-Id: Ic6d78bb9a3213160cd013f1ca8294307872bf0d0
/frameworks/base/core/java/android/text/Layout.java
846946ec06e4f7b31d5a414f026ef03e13793df7 13-Jan-2017 Keisuke Kuroyanagi <ksk@google.com> Merge "Make selection end handle stick to selection at line end."
7c263ddd582abacbbe9c71341a6ef4c704d12100 12-Jan-2017 Keisuke Kuroyanagi <ksk@google.com> Make selection end handle stick to selection at line end.

At line break, one offset can be mapped to two phisical
position: previous line end and next line start.
Previously, all cursor handles are placed at next line
start.
With this CL, selection end handle is placed at the
previous line end in such cases.

Test: FrameworksCoreTests
Bug: 21305922

Change-Id: I00d9f9a0cd417ca92534e93b3d3f655cd62f25d3
/frameworks/base/core/java/android/text/Layout.java
09da71a6dcfe07e0efdc35933322fba16091f555 28-Nov-2016 Seigo Nonaka <nona@google.com> Introduce full justification.

Adds a new get/setJustify API to TextView and StaticLayout.Builder for
justification, and fully justifies text when it's enabled.

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

Bug: 31707212
Test: Manually done and CTS will introduced with
I0f3bbf39d60a66b71b30e1351f7c741208f05dce passes.
Change-Id: Icbfab2faa11a6a0b52e6f0a77a9c9b5ef6e191da
/frameworks/base/core/java/android/text/Layout.java
9863f67469794af8b63666126e5d60b4eed7cdeb 14-Dec-2016 Seigo Nonaka <nona@google.com> Fix getLineExtent for hyphen width.

Need to set hyphen edit before measuring line.

Bug: 33388205
Test: Manually done
Change-Id: I32b1639d03ddd9bddb1f3ab34b577544ae358a6a
/frameworks/base/core/java/android/text/Layout.java
9aba698bd11b01a3c85884c425a5a16c2ef6e83c 08-Nov-2016 Siyamed Sinir <siyamed@google.com> Merge "StaticLayout visual fix for maxLines"
fcef4a3b62a34cdf1114ee34a5cd9432fc5ffffa 30-Jun-2016 Siyamed Sinir <siyamed@google.com> Merge "Visibility fixes for text related tests."
ed09ae1fccfb1c02109a0c1428ddff52daa939d5 16-Feb-2016 Siyamed Sinir <siyamed@google.com> Visibility fixes for text related tests.

Some of the text and text layout related tests fail because of the
visibility of parameters/functions they use. This CL updates
annotations and visibility of related classes.

Bug: 29871441
Change-Id: Ia06072815261379ff839c440482d94570ec05a80
/frameworks/base/core/java/android/text/Layout.java
79bf9d19f2f76cbfbd6659c9323e519deaa887c7 19-May-2016 Siyamed Sinir <siyamed@google.com> Fix bidi desired width calculation

Layout.getDesiredWidth measured text with TextDirectionHeuristics.LTR,
whereas the real calculations used the active direction heuristic set
in the TextView instance. This CL uses the same heuristics for both of
them by passing the value to Layout.getDesiredWidth function.

Bug: 28845953
Change-Id: I68d23f55fe5a86255d62e83bc62df38a047e4bca
/frameworks/base/core/java/android/text/Layout.java
0745c729653eeeeb6468d4ec9f3ec81b18ff9b64 01-Jun-2016 Siyamed Sinir <siyamed@google.com> StaticLayout visual fix for maxLines

When maxLines is set on StaticLayout, the height calculation includes
the lineSpacing for the lastLine, which causes the ellipsized version
and non-ellipsized version to have different heights. With this CL:
* maxLines is always set on StaticLayout
* the correct line count for a given text is preserved, in other words a
text that would be n lines will not be cut at maxLines.
* The visual height for StaticLayout for ellipsized and non-ellipsized
cases are the same when maxLines is set.

Bug: 28988744
Bug: 18864800
Change-Id: I1e1cae31cf33d503a8cf1c942f422893efc480bb
/frameworks/base/core/java/android/text/Layout.java
f0bb87b7c40efeeaee58d4c7b767961c9800463e 08-Feb-2016 Keisuke Kuroyanagi <ksk@google.com> Improve selection handle behavior for bidi text.

A point on a direction boundary can be mapped to two offset and
one offset on a direction boundary can be mapped to two points.
Previously, paragraph's primary direction is always used for deciding
offset and coordinates; thus, handle movement around a direction
boundary is often nonintuitive.

With this CL:
1. For selection end handle, direction of character at offset - 1 is
used for deciding handle shape and position.
2. For getting offset from coordinates, previous offset is used to
minimize the offset delta and primary .
3. For getting coordinates form offset, new logic chooses primary or
secondary horizontal coordinate depending on the current run
direction and paragraph direction.
4. When a handle passes another one because it passes a direction
boundary, new logic keeps the handle at the run boundary instead of
minimizing the selection.

Bug: 19199637
Bug: 21480356
Bug: 21649994


Change-Id: I2a7e87ad08416f4bd01a5f68e006240f77d9036b
/frameworks/base/core/java/android/text/Layout.java
fa05ba0b0d39fae1d2cb3d98fbee0aef6a9fed88 12-Jan-2016 Siyamed Sinir <siyamed@google.com> Sort the result of SpannableStringBuilder.getSpans

SpannableStringBuilder used to return the result of getSpans in the
order of start indices because of the interval tree it uses. However,
style spans has to be applied in the order of insertion to get
predictable results. Sorted the results of getSpans ordered first by
priority flag and then by insertion time. Moreover improved the
performance of SpannableStringInternal copy constructor.

Bug: 26240132
Change-Id: I0b0fa7bb30a3bd9ca37dedca66d8993718586027
/frameworks/base/core/java/android/text/Layout.java
e53e428a7efd624459961da3f932b408f896453b 13-Jan-2016 Raph Levien <raph@google.com> resolve merge conflicts of 957bdc56c5 to master.

Change-Id: I4c8749f92a1fa39bf0d08e10155d9e68c87401c0
5bff01d72f2a49add74dd36c8d1ed5038611f20b 08-Jan-2016 Keisuke Kuroyanagi <ksk@google.com> Respect grapheme clusters in Layout#getOffsetForHorizontal.

TextUtils#getOffsetAfter was used for getting the next
offset in Layout#getOffsetForHorizontal. However, this
method doesn't treat grapheme clusters properly.
Changed to use TextLine#getOffsetToLeftRightOf instead of
TextUtils#getOffsetAfter.

Bug: 25375561
Change-Id: I96c9e6e5da65adfb5266446ecab852c52628dbb5
/frameworks/base/core/java/android/text/Layout.java
720edf95db6c908f87dbbb33c6bde67aedb36899 27-Aug-2015 Keisuke Kuroyanagi <ksk@google.com> Fix: Cursor can be at an invalid offset in EditText.

"getLineEnd(line) - 1" is used as the return value when the
"horiz" is beyond the line end for multiple line text.
In this case, the returned value can point an invalid
offset like the middle point of a surrogate pair.

Bug: 23069901
Change-Id: I1afef7205a15079a42bb0018df73f70fe9ada862
(cherry picked from commit 00ad16d1cd24b788262ab4f62935e720a392da6d)
/frameworks/base/core/java/android/text/Layout.java
00ad16d1cd24b788262ab4f62935e720a392da6d 27-Aug-2015 Keisuke Kuroyanagi <ksk@google.com> Fix: Cursor can be at an invalid offset in EditText.

"getLineEnd(line) - 1" is used as the return value when the
"horiz" is beyond the line end for multiple line text.
In this case, the returned value can point an invalid
offset like the middle point of a surrogate pair.

Bug: 23069901
Change-Id: I1afef7205a15079a42bb0018df73f70fe9ada862
/frameworks/base/core/java/android/text/Layout.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/Layout.java
7209deedcde98ea0cca519e73d910bafa5193334 09-Jul-2015 John Reck <jreck@google.com> Delete dead code

Bug: 22378829

Every time setText is called a BoringLayout is created.
BoringLayout internally creates a new Paint called mWorkPaint.

However, creating a Paint turns out to be somewhat substantial
amount of work, and mWorkPaint is never actually used. Deleting
this shaves off roughly 50ms and 1,000 object creations during
a fling on a listview.

Change-Id: I5d03402b9027df6ce0f3e58160752c66c69a4d2d
/frameworks/base/core/java/android/text/Layout.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/Layout.java
edb27f14ec03d9f4e1dd3959e81f58d4f1389971 01-Jun-2015 Raph Levien <raph@google.com> Revert "Revert "Use getRunAdvance to position cursor""

This reverts commit 5730c974800a0ffed59a041d9e249a5c42e417db.
/frameworks/base/core/java/android/text/Layout.java
5730c974800a0ffed59a041d9e249a5c42e417db 01-Jun-2015 Raph Levien <raph@google.com> Revert "Use getRunAdvance to position cursor"

This reverts commit cb5499c85097450c48f66f6c08a35bab2ad5ab12.

Bug: 21549197
/frameworks/base/core/java/android/text/Layout.java
cb5499c85097450c48f66f6c08a35bab2ad5ab12 29-May-2015 Raph Levien <raph@google.com> Use getRunAdvance to position cursor

TextLine used to use getTextRunAdvances on a substring to compute a
cursor position, but this had a number of problems, especially when
the substring is a wider than the full string (as can happen in
certain Tamil ligatures).

This patch changes the implementation to use getRunAdvance, which was
explicitly designed for this use case.

We should also change Layout.getHorizontal to use the dual
getOffsetForAdvance, but that's basically a performance optimization,
the functionality should be basically equivalent.

Bug: 21125816
Change-Id: I669b85eaecfbf6f7aa6c6a9dddbf1a210eb94571
/frameworks/base/core/java/android/text/Layout.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/Layout.java
9a174dda4227f602fd0b5f69909339b433a70f59 08-Apr-2015 Raph Levien <raph@google.com> Clear hyphenEdit from Layout's paint

The paint of a layout may be reused with other things (in particular,
it can be passed to a BoringLayout), so make sure the hyphenEdit is
zeroed out after use.

Change-Id: If58c5588af9642c3ba827acefea7895e814daab9
/frameworks/base/core/java/android/text/Layout.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/Layout.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/Layout.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/Layout.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/Layout.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/Layout.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/Layout.java
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/Layout.java
875062059c4932ddf5649720c26e7f59b6ab9978 04-Sep-2014 Raph Levien <raph@google.com> Fix Layout.isRtlCharAt

We weren't getting correct results from Layout.isRtlCharAt, because it
was only testing half of the correct predicate for whether the argument
was inside the run. This patch restores the correct predicate.

Bug: 17381011
Change-Id: Ib0a77cc182f4ca4bfe824e85b7aff7268f465d73
/frameworks/base/core/java/android/text/Layout.java
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/Layout.java
c14b3ada5cccfdd872ccf72d928fb0088f3ce00d 25-Jul-2014 Anish Athalye <aathalye@google.com> Fix bug in measurement of paragraphs

This fixes b/16510772.

When measuring paragraphs, leading margins should be taken into account.
When computing line width, the margin should be added to the absolute
value of the extent (there were missing parenthesis). Both of these
caused views with leading margins to be rendered incorrectly.

Change-Id: I5029b2790a249192a858eb226d7b793d0622a70d
/frameworks/base/core/java/android/text/Layout.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/Layout.java
373b7a8d4e9dce4f71539d4dbcf627fd3e1a39da 21-Sep-2013 Raph Levien <raph@google.com> Fix for "Can't place cursor after combining accent"

This patch fixes behavior where attempting to place the cursor at
the end of a string where the last character is a combining accent
actually placed it before that accent. This was especially annoying
for editing Thai text, because it made it difficult to delete a
trailing tone mark.

Fixes bug 8947569 "Can't place cursor after combining accent" and bug
10398332 "[Thailand] Thai Language(IME) -- Can't delete Thai tone mark
while writing message"

Change-Id: Ida1933c8f0ab6cdb0200db39891e9389e4bdba86
/frameworks/base/core/java/android/text/Layout.java
afe8e9b6d033cb854afa3024d8198a32896a804a 20-Dec-2012 Raph Levien <raph@google.com> Suppress horizontal scrolling with trailing blanks

The existing behavior of EditText is that trailing blanks can cause a
line to exceed the layout width, causing the cursor to extend past the
line, which in turn causes horizontal scrolling. This patch clamps the
cursor to the layout width in the non-scrolling case, which makes the
spaces effectively invisible when they're at the end of the line, but at
least suppresses the scrolling.

The clamping only works reliably in left-to-right alignments, so this
patch checks for than and only enables the clamping in those cases.

Fix for bug 7699295.

Change-Id: I22bc4e6c9ded3d7716edfcf10dd2b5c31a5da9de
/frameworks/base/core/java/android/text/Layout.java
db24f0a73f4385aea104367a4bc71b78f25dbc3f 04-Oct-2012 Fabrice Di Meglio <fdimeglio@google.com> Fix bug #7282594 EditText does not allow to move the cursor when typing RTL text and if gravity is set to LEFT

- fold LEFT/RIGHT into NORMAL/OPPOSITE cases

Change-Id: Idf14342ffed4840e7b4ea53cc42f1cde8f196a4c
/frameworks/base/core/java/android/text/Layout.java
15c9c6141a00cd91290928bce742a2ae6761aca2 14-Jun-2012 Fabrice Di Meglio <fdimeglio@google.com> Merge "Fix bug #6661824 Hebrew Text can be clipped" into jb-dev
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/Layout.java
2fba3387c31b675c419030145250e5be246c50b0 12-Jun-2012 Gilles Debunne <debunne@google.com> Prevent a crash when maxLines is set to 0

Bug 6642222

Using setMaxLines(0) and setMinHeight(30) causes a crash
because Layout#getLineRangeForDraw() returns a [0,0] interval
in that case.

Accessing the Direction in draw causes a NPE.

Change-Id: If50f9b554e3cdc598a721b623992e9196982838c
/frameworks/base/core/java/android/text/Layout.java
eca5b7385a641ae5d8c4aa2b7823a4e573737376 26-Apr-2012 Gilles Debunne <debunne@google.com> Basic renaming refactoring in Layout

Change-Id: I79f5444a097f1e2b2a81ececf1f0a14b6d7d5179
/frameworks/base/core/java/android/text/Layout.java
60e3b3fa60a672583fe6294139feb940845efc9b 13-Mar-2012 Gilles Debunne <debunne@google.com> Use SpanSet to accelerate Layout.drawBackground

The main performance improvement should come from the fact
that we entirely skip the loop (which calls getLineStart, getLineTop
and getLineDescent on each line) in the frequent case where there
are no LineBackgroundSpans.

Change-Id: Ie2d3168521e88d43f1a4236da2b3e8447606df1e
/frameworks/base/core/java/android/text/Layout.java
6c488de023a4797069673dc619c1a4096079ea9e 02-Mar-2012 Gilles Debunne <debunne@google.com> EditText caches only text in its internal display list.

Decorelate background and text in layout display. This allows
to only store the text in the editable TextView's display list.

Selection and cursor changes no longer need to invalidate the
display list, leading to faster rendering.

Change-Id: I3af3a98846e1bfe2d9ec6c42590e71bf3704595e
/frameworks/base/core/java/android/text/Layout.java
34d2eba560f83f4eb665cdc039cf02bf96c201da 01-Sep-2011 Fabrice Di Meglio <fdimeglio@google.com> Fix bug #5243493 TextView selection is not working correctly when there is some RTL run into it

Part 2

- make selection handles aware of the run direction

Change-Id: Idf41036de53d8968e7ae27eb87aea09e86bcd652
/frameworks/base/core/java/android/text/Layout.java
3716601573f5a562f98721130e25002ad88eb164 31-Aug-2011 Fabrice Di Meglio <fdimeglio@google.com> Fix bug #5243493 TextView selection is not working correctly when there is some RTL run into it

- make the selection green highlight work

Change-Id: I4e3b88e3720288f973b1b9e68afa8f800ad13779
/frameworks/base/core/java/android/text/Layout.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/Layout.java
cb379120456d8065d742021fc5c66748fc8a11a8 07-Jul-2011 Doug Felt <dougfelt@google.com> Implement textDirection heuristic selection.

Change-Id: I2fcf18de573f2d66494fa5ed61e4273c3c6078c7
/frameworks/base/core/java/android/text/Layout.java
c0ccf0c47c00942a9d0f2670600a8f2d4d7adb5b 24-Jun-2011 Doug Felt <dougfelt@google.com> Support control of text alignment.

Change-Id: Id6f3682f67ba2e6811e3014cd34a281e6dd0a469
/frameworks/base/core/java/android/text/Layout.java
27e8f1a3a6b43592e3d419d7a3cfc6192a86bf5c 29-Apr-2011 Conley Owens <cco3@android.com> am 8b22ef66: am e41d2aed: Merge "Using robust equality check."

* commit '8b22ef66ef1a67333e2f1d4250d2c134b50ef91a':
Using robust equality check.
2fb503f5102dd32a8ec391b26911528852703b90 17-Mar-2011 Jozef BABJAK <jozef.babjak@gmail.com> Using robust equality check.

Change-Id: Ie30684c472bfa38d0432f855f7075c34709958d5
/frameworks/base/core/java/android/text/Layout.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/Layout.java
f75c97e023af7d4ad9a8c129d4ea282b1c3b8f94 11-Feb-2011 Gilles Debunne <debunne@google.com> Text insertion cursor is now defined by a Drawable.

Bug 3261766

If defined, the drawable is used instead of directly drawing a 1 pixel
line. This makes the cursor more fancy and more visible.

The drawable is currently clipped by the TextView's limits, which is
currently visible on the left when the cursor is at the first position.
To solve this issue properly, we would need to propagate a do-not-clip
up in the hierarchy.

Change-Id: I99f6001048eed14104994acf6bab942dda8eb38e
/frameworks/base/core/java/android/text/Layout.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/Layout.java
162bf0f1b9fd5d78ffa801917994f6222c6efd85 17-Nov-2010 Gilles Debunne <debunne@google.com> Fix for IOOBoundsExc in SpannableStringBuilder

Bug 3182953

Change-Id: Idc7faa86b8250bf325e2547d7d4c094300a06686
/frameworks/base/core/java/android/text/Layout.java
497a92cc5ba2176b8a8484b0a7da040eac0e887b 13-Sep-2010 Jeff Brown <jeffbrown@google.com> Add keycodes and meta-key modifiers to support external keyboards.

Added new key maps for external keyboards. These maps are intended to
be shared across devices by inheriting the "keyboards.mk" product
makefile as part of the device's product definition.

One of the trickier changes here was to unwind some code in
MetaKeyKeyListener that assumed that only the low 8 bits of the meta key
state were actually used. The new code abandons bitshifts in favor
of simple conditionals that are probably easier to read anyways.
The special meta key state constants used by MetaKeyKeyListener
are now (@hide) defined in KeyEvent now so as to make it clearer that they
share the same code space even if those codes are not valid for KeyEvents.

The EventHub now takes care of detecting the appropriate key layout
map and key character map when the device is added and sets system
properties accordingly. This avoids having duplicate code in
KeyCharacterMap to probe for the appropriate key character map
although the current probing mechanism has been preserved for legacy
reasons just in case.

Added support for tracking caps lock, num lock and scroll lock and
turning their corresponding LEDs on and off as needed.

The key character map format will need to be updated to correctly support
PC style external keyboard semantics related to modifier keys.
That will come in a later change so caps lock doesn't actually do
anything right now except turn the shiny LEDs on and off...

Added a list of symbolic key names to KeyEvent and improved the toString()
output for debug diagnosis. Having this list in a central place in the
framework also allows us to remove it from Monkey so there is one less
thing to maintain when we add new keycodes.

Bug: 2912307
Change-Id: If8c25e8d50a7c29bbf5d663c94284f5f86de5da4
/frameworks/base/core/java/android/text/Layout.java
12122bf7929aab7417cda5642632b81e4e15eb4e 25-Aug-2010 Takako Ishibashi <takako.x.ishibashi@sonyericsson.com> Support surrogate pairs when layouting text

The current framework does not consider surrogate pairs
when getting the index of the character. This bug becomes
visible when creating the text including Emojis. For
example cursor breaks up when it moves around the Emojis.

Our proposed solution will consider the surrogate pairs
when calculating the index. It will fix not only the Emoji
case, but also the letters that use surrogate pairs.

Change-Id: I4983f2e4df933c8af9d5f0cc27df871e8e10fed4
/frameworks/base/core/java/android/text/Layout.java
c4d8eb6fb7c88c5c4da38b0b113c24cc4b78c0b7 19-Aug-2010 Romain Guy <romainguy@google.com> Speedup TextView fades (no more layers required.)

Also fixes a crash in the drop shadows cache and improves
drop shadows caching.

Change-Id: I9c0208a49467f9201d786ae0c129194b8d423923
/frameworks/base/core/java/android/text/Layout.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/Layout.java
0c702b88c5d0d4380930b920f5be6e66dd95a0d8 14-May-2010 Doug Felt <dougfelt@google.com> Move shaping to native.

Add internal API (getTextRunAdvances) to Paint, use when measuring.
Add internal API (getTextRunCursor) to Paint, use when determining
valid cursor positions.

Remove java-level shaping code. Remove 'prep' code in TextLine
(except for replacement text) since shaping now is done on the fly as
needed in native.

Provide explicit shaping context bounds to internal text measuring,
cursor movement, and rendering APIs.

Update for to changes in external API in ushape.h.

Change-Id: I146958b624802ce8553125e5c3c6c03031bc9608
/frameworks/base/core/java/android/text/Layout.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/Layout.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/Layout.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/Layout.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/Layout.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/Layout.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/Layout.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/Layout.java
a82e99a89b7a12bd86d99d60d23a7a37624499b6 01-Sep-2009 Eric Fischer <enf@google.com> Fix an emoji-measuring bug that caused an exception when editing a contact.

It was measuring the text to try to determine the size that it needed to
scale the emoji character to. Unfortunately it was accidentally trying
to measure the character under the cursor instead of the emoji character
itself, which is wrong, but more seriously doesn't work at all when the
cursor is at the end of the line.

This was already fixed before in change 144474, but that change never got
merged over to donut. So this merges it now.

Bug 2087915

Change-Id: Ib4804d330a029a966207b3b07271f84e6b2652c0
/frameworks/base/core/java/android/text/Layout.java
76c0226008ee16633dc94ed4dbeadef2174f6bd9 14-Apr-2009 Dave Bort <dbort@android.com> text: Remove references to android.util.Config

The semantics of Config.DEBUG will be changing soon, and all other
Config.* fields will become deprecated/hidden.

BUG=1780938
/frameworks/base/core/java/android/text/Layout.java
c2d54f46ac13e029e6d53f7471cd9c90fe6bbfe9 27-Mar-2009 Eric Fischer <> AI 143165: am: CL 142861 Make TextView Emoji scale to match the size of the text.
Original author: enf
Merged from: //branches/cupcake/...

Automated import of CL 143165
/frameworks/base/core/java/android/text/Layout.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/Layout.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/Layout.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/Layout.java
b798689749c64baba81f02e10cf2157c747d6b46 10-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@125939
/frameworks/base/core/java/android/text/Layout.java
54b6cfa9a9e5b861a9930af873580d6dc20f773c 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/frameworks/base/core/java/android/text/Layout.java