History log of /frameworks/base/core/java/android/text/MeasuredText.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
1341ab6f3808d8c11b147f82bc7735116c7d709f 10-Jul-2012 Raph Levien <raph@google.com> Fix for bug 6716343. Use correct offset for mPos reset.

The mPos field in the MeasuredText object is relative to the start of
the text (mTextStart), but the pos passed in by the caller of the
setPos() method is relative to the character sequence. When spans
overlap break boundaries and the paragraph doesn't start at 0, the
result is an out of bounds error. This fix uses the correct offset.

Change-Id: I12c7a2311a9bdbbea7ab21554a922b7f665a17bf
/frameworks/base/core/java/android/text/MeasuredText.java
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/MeasuredText.java
c70e7a0b8add16d2e6cec4d58c3cc74d08cc20b4 24-Feb-2012 Gilles Debunne <debunne@google.com> Ellipsize avoids spaces and starts right after text

Bug 5509226

Change ellipsize bounds to take spaces into account

The hardcoded ' ' character may be problematic with other langages.

Note that a different ellipsize logic also exists in StaticLayout.
Created 6062415 to track this.

Change-Id: I3406ec23a592f952bf3e0ca68f0838ee807baba0
/frameworks/base/core/java/android/text/MeasuredText.java
ba3634f35523224d9b4238dbd0b9b5e0cf3b0b9b 24-Jan-2012 Gilles Debunne <debunne@google.com> Fix for AOOB in MeasuredText

Bug 5707593

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

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

Change-Id: I2fcf18de573f2d66494fa5ed61e4273c3c6078c7
/frameworks/base/core/java/android/text/MeasuredText.java
9a3a8848643faf477335675136efba9a6e58db75 27-May-2011 Gilles Debunne <debunne@google.com> Replacement spans correctly measured in TextView

Bug 4444591

Change-Id: I74c94445806d6c00b0971146cac57363c7d3f205
/frameworks/base/core/java/android/text/MeasuredText.java
fbc8630736d12676edc16f3932231713e23dd1df 31-Jan-2011 Kenny Root <kroot@google.com> Remove MeasuredText debug messages

MeasuredText debug messages were left in the tree. Remove them before
shipping.

Bug: 3408963
Change-Id: Ia220eae5835d1325bb6053de0025d8016a1edcad
/frameworks/base/core/java/android/text/MeasuredText.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/MeasuredText.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/MeasuredText.java