History log of /frameworks/base/core/java/android/text/TextLine.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
893d6fe48d37f71e683f722457bea646994a10bf 16-Jan-2015 Svet Ganov <svetoslavganov@google.com> Fixing a memory leak: activities are leaked.

TextLine was not fully cleared before recycling it which leads to
activity leaks if the activity happens: to register a text watcher.

bug:19045507

Change-Id: Ife0f7ce29865bd30ca2dfe8795023f51f275d659
/frameworks/base/core/java/android/text/TextLine.java
051910b9f998030dacb8a0722588cc715813fde1 16-Jun-2014 Raph Levien <raph@google.com> Clean up dirFlags / bidiFlags confusion

The dirFlags and bidiFlags enums are distinct, and have different
meanings. The former is a determined direction for a run of text, while
the latter is a request for the bidi algorithm. They have been used
interchangeably, and this has caused some problems, notably running the
bidi algorithm needlessly when the direction for a run is already
determined.

This patch cleans up the confusion, by always naming each occurrence
explicitly "boolean isRtl" or "int bidiFlags" (the previous code often
just used "int flags", which added to the confusion), and converts
between the meanings when a function takes an isRtl argument but passes
it to another function expecting bidiFlags.

Fixes b/15089607 Clean up bidi flag mess

Change-Id: I410b6604376e853dd12c255e7f5a9d2b9a310dd9
/frameworks/base/core/java/android/text/TextLine.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/TextLine.java
da12f389eb4be0c08ca3fa9ca7663f4977858df5 15-Mar-2013 Fabrice Di Meglio <fdimeglio@google.com> Revert "Clean Paint.mBidiFlags as it is no longer used"

This reverts commit 6d9fe5bd22b531bfce69b146254a4791c76acddc.
/frameworks/base/core/java/android/text/TextLine.java
6d9fe5bd22b531bfce69b146254a4791c76acddc 12-Feb-2013 Fabrice Di Meglio <fdimeglio@google.com> Clean Paint.mBidiFlags as it is no longer used

See bug #7623824

Change-Id: Ie2f9422821f6dcc73c99e8695f448e966b587b1d
/frameworks/base/core/java/android/text/TextLine.java
42ef515d185d4fc038d602172789cc264f1d9960 23-Oct-2012 Raph Levien <raph@google.com> Fix for bug: Gmail (and other places): cursor placed on top of letter

This patch fixes bug 7346656. In this particular case, the text line in
the EditText was split into multiple spans, with the boundary between
the "r" and "," in "r,". These were being drawn as two separate runs,
but measured as a single run, leading to inconsistent measurements
because this is a kern pair in Roboto.

The fix is to eliminate the special-case code for measuring. This will
actually improve efficiency, as the value computed in one pass is now
more likely to be reused in another.

Change-Id: I04142a0ec98f280fc1027c7cbdbf903e3096f8e4
/frameworks/base/core/java/android/text/TextLine.java
4ffb879f4866f7d51070bfc9d10e7a2fdac62d4c 13-Mar-2012 Gilles Debunne <debunne@google.com> New SpanSet class extracted from TextLine.

Change-Id: I424dbd7ff0693fd465b6c83ebabba221b2eca6fe
/frameworks/base/core/java/android/text/TextLine.java
fc997b4f7867005bd0f1461822b494c79c1231ea 13-Dec-2011 Gilles Debunne <debunne@google.com> NPE in GMail / TextLine

Bug 5753061

https://android-git.corp.google.com/g/#/c/154756/1 revealed an
other bug in SpanSet. The fitered (non empty) spans were added
in their original position instead of being indexed by count.

The nullation on recycle hence left null holes in the array.

Change-Id: If5c1435cee9a2cb88a608aa8e5f4f2f23382154c
/frameworks/base/core/java/android/text/TextLine.java
c3fb7a11ad72c5e51ff93e1ad6958f843af0d5b1 12-Dec-2011 Gilles Debunne <debunne@google.com> Prevent a memory leak in TextLine.

Bug 5740435

The new SpanSet cached objects should be recycled when the TextLine is
recycled to prevent a reference to their span, which may lead to the
entire activity.

Change-Id: I4469e418a228bd71eb8be1d43ed86de49baba165
/frameworks/base/core/java/android/text/TextLine.java
c1f44830809f0a8526855f13822702ea756214fa 09-Dec-2011 Gilles Debunne <debunne@google.com> Re-use SpanSets in TextLine

TextLine objects are already stored in a pool to limit allocation.

Associate SpanSet objects to each TextLine to further limit the
allocation of these and re-use their internal arrays (re-sized if needed).

Drastically reduces new objects allocation during rendering.

Priority code removed in init: priorities are already handled by getSpans.

This is a duplicate of the already accepted
https://android-git.corp.google.com/g/#/c/153970/
but without the dependency on an other CL.

Change-Id: Iaa7e2f7a8ea4337c8d60c3a9a620e9e3e60caf12
/frameworks/base/core/java/android/text/TextLine.java
8a439ac7a34d6b83782a672f3d6aa90fa262409c 27-Oct-2011 Gilles Debunne <debunne@google.com> Performance improvement in TextView

Using a SpanSet to minimize the number the calls to getSpans.

This is a cherry pick of 145653 in ICS-MR1

Change-Id: I0a6e1fc7bd7a89325c2925bf98d59626d5e12995
/frameworks/base/core/java/android/text/TextLine.java
52edaa9cfb612bd20b0f718dc95e576f55d9367e 26-Sep-2011 Gilles Debunne <debunne@google.com> Merge "Bug 5250788: TextView gets slower as the text length grows"
8a5137a5aeba39cbc2c57c83ef79241b446d0cb7 23-Sep-2011 Fabrice Di Meglio <fdimeglio@google.com> Fix bug #5349461 TextView: text that ends with an ImageSpan causes line height to shrink to ImageSpan height

- save current metrics values before updating them

Change-Id: I2d88dd7d30e8e01d0c5e2328973f256b689672b2
/frameworks/base/core/java/android/text/TextLine.java
945ee9b1661e60e0074d4f16f61fc147c728c6bf 20-Sep-2011 Gilles Debunne <debunne@google.com> Bug 5250788: TextView gets slower as the text length grows

getSpans was called too many times in handleRun. Pre-compute the
subset of intersected spans and iterate over a subset of it instead.

Moving the instanceof test in getSpans after the other tests also
speeds things up a lot.

On a text with ~300 words, all with a span attached, getSpans went down
from 78% to 14% of the CPU usage.

Change-Id: I59bc44f610e9a548e0dcec68b180934da9e5c559
/frameworks/base/core/java/android/text/TextLine.java
c9fd978da60f76c0576150c55629a034e1fa19fb 09-Sep-2011 Gilles Debunne <debunne@google.com> Bug 5281947: add to dictionnary option promoted in suggestions.

When several SuggestionSpans are available at a given position, their
content are merged, in creation time order.

As a result, the IME's suggestions are picked before the spell check, and
no add to dictionnary option is created.

This CL modifies the comparator to make easy correction spans appear first
(Voice IME), then misspelled words and then regular suggestions.

Also avoids the creation of a new comparator and length hash map on every display.

Change-Id: I1f9f031a6fdcbbc09f248a192b83051092765f8e
/frameworks/base/core/java/android/text/TextLine.java
e6d368218918f911b1954296dab25bf84147b4c6 30-Aug-2011 Luca Zanolin <zano@google.com> Add EditTextShortcutSpan to provide edit short cut in the text view.

At the moment, EditTextShortcutSpan allows only the deletion of the text. In the future, we may decide to add extra functionality,
like "retry" where all the text is removed and a specific IME is triggered.

Fix the underline. The underline is not defined in thickness, and not as a multiplier of the default underline thickness.

Change the behaviour of SuggestionRangeSpan to match the specification.

Change-Id: I80437d9887c7a2ff8f62c38afbb0cb7add7ee9c8
/frameworks/base/core/java/android/text/TextLine.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/TextLine.java
dd8f5ed79c7baed35b3f04e4778aff7867653255 11-Aug-2011 Gilles Debunne <debunne@google.com> Added support for colored / thick underlined text.

Change-Id: Ib0e259dd20546855899bf091f694e41e7051fecb
/frameworks/base/core/java/android/text/TextLine.java
61ccc6a203e1b0fb235a4eed2b40e0c080f57f0c 09-Aug-2011 Fabrice Di Meglio <fdimeglio@google.com> Merge changes I46744e51,I1f566cce

* changes:
Solidify and optimize Paint text related APIs
Add more optimizations for Text measuring / breaking / getting advances
15c097a1c23105cdc0dd66dd5605ff35467d7118 08-Aug-2011 Fabrice Di Meglio <fdimeglio@google.com> Add more optimizations for Text measuring / breaking / getting advances

- do not go to native if this is not needed (empty or null text)
- do expandMetricsFromPaint() in TextLine when needed instead of calling handleText()
with emty string just for doing expandMetricsFromPaint()

Change-Id: I1f566ccef66cbc990ebbb77ef149899119e37e84
/frameworks/base/core/java/android/text/TextLine.java
850dffa01ba9111799f24800ae8550eca457d757 08-Aug-2011 Fabrice Di Meglio <fdimeglio@google.com> Follow up to TextView's baseline is correctly computed for empty text

Was bug http://code.google.com/p/android/issues/detail?id=15598

- optimize https://android-git.corp.google.com/g/#/c/107901/1

Change-Id: I20abd82a97adc71f04a5afba54eb679f708236f8
/frameworks/base/core/java/android/text/TextLine.java
bc7cdb6783d059249133b1c0baf52c305c6b4a33 27-May-2011 Romain Guy <romainguy@google.com> Remove extraneous log.

Change-Id: I91b248410d69836c7a3b56eb0867224ccb4a5336
/frameworks/base/core/java/android/text/TextLine.java
f483e514d4ed3b93cc5ba22beb9c85efcda75535 29-Apr-2011 Gilles Debunne <debunne@google.com> TextView's baseline is correctly computed for empty text.

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

Change-Id: I3aae29b55dc92acca3883b8d14e01dc1c79c2243
/frameworks/base/core/java/android/text/TextLine.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/TextLine.java
f902d7bc49797ec277b4576c921dfffa15d741dd 25-Jan-2011 Gilles Debunne <debunne@google.com> TextLine cache is used, even for long lines of text.

Bug 3381368

The 250 characters limit is passed for long URLs. There are only 3
TextLine objects, so their total size is not an issue. Recycle long
lines as well to make sure we fill the cache and avoid object creation.

Change-Id: I843bf623594312a0fcf0edbb13b7cd64cce0ddd1
/frameworks/base/core/java/android/text/TextLine.java
0bb000931bb841e75903d655552d1626ae158707 03-Dec-2010 Gilles Debunne <debunne@google.com> Fix in vertical measurement in text lines with different text sizes

The last span of the TextLine was defining the FontMetrics, instead of
min/maxing the different values.

Bug 3220698

Change-Id: I7394b1699a15aeee4cc38462d561faf329d3e1f6
/frameworks/base/core/java/android/text/TextLine.java
673e42fafd4088970ec95e1f13c61dc83132c74e 26-Aug-2010 Chet Haase <chet@google.com> Fix for end events from Sequencer objects

Change-Id: I8947d8b016b880f9f54f2bf6ab22b4e188cdb29a
/frameworks/base/core/java/android/text/TextLine.java
cc3ec6cdb2b892eb29513e72d8b205acbe997b25 23-Jun-2010 Gilles Debunne <debunne@google.com> New cursor controller in TextViews.

Editable TextView now display a cursor controller under the insertion
point so that it can be precisely moved.

Change-Id: Ia2e6ddc57d249647ff6683e10e4226db3df27223
/frameworks/base/core/java/android/text/TextLine.java
345cb03315a0813ec57e44f97fc3fa4af6b3c309 17-Jun-2010 Gilles Debunne <debunne@google.com> Index out of range problem in TextLine.

Recent refactoring for bidi introduced an index shift in the getOffsetBeforeAfter
method. This problem appears for multi-line text input only, when the text line
mStart index is not 0.

As a result, moving the cursor using the trackball in a multi-line EditText crashes.

Change-Id: I1f121f0f9272ef7d338399f369ba6d77e1ca71c5
/frameworks/base/core/java/android/text/TextLine.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/TextLine.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/TextLine.java
f47d7405bbcb25d7cdf89ebb059f41520fe9ab87 22-Apr-2010 Doug Felt <dougfelt@google.com> Modify Canvas drawText to run bidi and shape.

Adds drawTextRun as internal API on Canvas and GraphicsOperations.
Adds implementation to implementors of GraphicsOperations.

Adds state and API on Paint to control the bidi algorithm when used
by Canvas. This API is currently hidden.

The drawText changes are incomplete since shaping is not yet available
in the native code.

Change-Id: I4368048aef9545df0953a349381771603e04b619
/frameworks/base/core/java/android/text/TextLine.java
0b9d2ca6b6fc4574898cfff6acdee821d4723a96 07-May-2010 Doug Felt <dougfelt@google.com> Fix selection off-by-one bug.

The wrong value was used to measure the width of unidirectional text.

Change-Id: I57752c111641ca1cc951e0647b60c79f5a9493ad
/frameworks/base/core/java/android/text/TextLine.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/TextLine.java