History log of /frameworks/base/core/java/android/text/MeasuredText.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
82d1c443330785ae9561393880b92cbc44de7db2 14-Sep-2016 Keisuke Kuroyanagi <ksk@google.com> Make ellipsis START and MIDDLE grapheme cluster aware.

When text contains 2 emojis and each emoji has 2-code units,
the width array will be like [10, 0, 10, 0]. In this case,
without this CL, just the first code unit can be replaced
with the ellipsis marker. This CL makes ellipsis START and
MIDDLE grapheme cluster aware.
Note that ellipsis END is working properly even without
this CL.

Bug: 30613917

Change-Id: I38ff9793f2ea381460c50465c5470e0ad9a405b9
/frameworks/base/core/java/android/text/MeasuredText.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/MeasuredText.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/MeasuredText.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/MeasuredText.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/MeasuredText.java
d4f4526cb4bfa343714dbb63b82c82798db5a4e0 28-Aug-2013 Brian Carlstrom <bdc@google.com> Make MeasuredText.sCached field final

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