Support for loading the pre-compiled binary format for hyphenation
patterns.
Bug: 21562869
Bug: 21826930
Change-Id: Iaeaa9c9ac9dac236af6b0d7894c2e2396bc8447d
"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
This updates the tests to match the older commit
f723017481 and also adds support for
negative values.
Bug: 23191381
Bug: 11237727
Change-Id: Ib9a1f10031b730ee460658949b388c779cefa041
- Clarify that getTrimmedLength() only considers ASCII control
characters as control characters.
- Deprecate getReverse() instead of trying to fix it, as it's really
not meaningful for internationalized text.
- Support non-BMP characters in isDigitsOnly().
Change-Id: I947c449b48c252ecc7f7299145f6f8fbad86004f
Previously, when getSpans() was called with a null parameter, an
unintentional NullPointerException would be thrown.
Now, we explicitly return an empty array of Objects.
Bug: 19805521
Change-Id: I52f3ae08c2bcf62f6a4d0c01f0fe08ad1134abb8
All the three tags, <del>, <s>, and <strike> are now converted to
strikethrough text.
Bug: 21025743
Change-Id: I62dc9793223e266f6e2181169766fde8be0e2aa7
Also deprecate TextUtils.isGraphic(char), since one-code-unit APIS
should not be used for anything in the modern Unicode era.
Bug: 7381642
Change-Id: If4dc573fe5ac870152374ded64fc83594e8dd37e
Previously, BidiFormatter.getInstance() created an unnecessary
pass-through builder object, which was used to return a static
already existing BidiFormatter.
Now, we just return the same static BidiFormatter, without going
through a builder, so we can save some extra allocations.
Bug: 10022222
Change-Id: Ibcb6aac1c1e16d9ec00e93824fa063f8dccdf8cb
The method was deprecated and had only one caller, which is being
replaced with an inline copy of this at the same time.
Bug: 6823087
Change-Id: I7c5b9840ba50c1a9f167102966de63ef1040ab88
There seems to be only one caller of this signature, and even that is
in a deprecated method, so it should be safe to deprecate this.
The new implementation uses ICU for the format string and so removes
the need for a localized string, although it's still a hack and is
probably slower. It's added here since we may actually want to clean
it up later and use it for an improved simple list formatter.
Bug: 6823087
Change-Id: I2aa1af9b170e41da840d9d7bc663df06fb96d136
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
Previously, only the languages written in Arabic and Hebrew were
considered right-to-left. Now, ICU is used to return the direction
of the language, which not only support other right-to-left scripts
(such as Thaana), but also has better logic to determine the
direction of the locale and uses caching to improve the speed.
Bug: 22559274
Change-Id: I760be7984a9b35ea77d59ca84a220798e205af36
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
This patch sets up an "empty" hyphenator, which it uses by default
for locales in which there is no hyphenation pattern data. This has
the effect of enabling soft hyphens (U+00AD), which were otherwise
disabled, because the "no-hyphen" code path didn't consider them.
Bug: 19605972
Change-Id: I4dcb95cee8edc48495f7c38736f5abf26fa04935
The existing implementation of handleText() in TextLine laid out
text to the end of the context. However, in cases where the text is
broken into multiple style spans, it's only valid to lay out up to
the end of the style span. This can lead to inconsistent
measurements, especially in the presence of legitimate zero-width
characters such as bidi control characters and zero width space.
This patch changes the invocation of getRunAdvance to measure only
within the style span.
Bug: 22589743
Change-Id: I027f5e77db27ddf9596ef20adcad7e62a82b41de
The default has been 'true' for eternity in the code. But the
documentation was mistakenly saying it was 'false'. Going with the
code, since there are people out there relying on the code continuing
to work the same way.
Bug: 22557371
Change-Id: I6f4e7b2052d0cc30d41e8ccf2b9a5c6111fa0ab7
Previously, users of the results of formatFileSize() and
formatShortFileSize() needed to unicodeWrap the results themselves
using BidiFormatter, which resulted in several bugs and
inconsistencies across the platform when they didn't, especially in
Hebrew and Urdu locales:
Hebrew and Urdu use Latin abbreviations like 'MB' for file sizes
which cause undesired reorderings (or incorrect detection of the
string direction when the formatted file size starts the string).
With this patch, the results are now bidi-wrapped before being
returned if the locale of the context passed in to the formatter is a
right-to-left locale.
Bug: 22237132
Bug: 22273176
Change-Id: If076636d15828fc810feef6f0fa8806ef52aed5d
The existing documentation is very terse and users were getting
confused whether the method escapes HTML metacharacters or not. Expand
the description a bit and explicitly state that metacharacters are
escaped.
Bug: 17456925
Change-Id: Icaae7fe1344629de5c0860674f3913781de18013
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
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
This patch refines the crude check for potential RTL characters, based
on ranges containing RTL scripts and format characters that affect
bidi. This will make it much less likely that a StaticLayout will be
chosen instead of a BoringLayout.
Bug: 22328919
Change-Id: I9a0ed9b3f3373069052de21c836b3372f175430f
The old code made invalid assumptions about read() behavior and
failed to clean up properly in case of error. This patch changes the
file reading to use IoUtils.readFileAsString, which handles that.
Bug: 21020457
Change-Id: If9b54955c20a20a4ed5e8381d0c7e9c920d0639a
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
WordIterator's getEnd/getBeginning methods does not support the needs
for word boundary detection in text selection. Consider the words
AABB (where AA and BB are each words). If getEnd is given the offset
on the boundary between AA and BB, it would return that offset since
it is the end of AA. For text selection we always want the "next end"
if available.
This CL adds two methods to word iterator that return the next end
and previous beginning.
This CL also alters the code in Start/EndHandle to use the x value
and current / prev line positions to determine if the user is
expanding or contracting the selection.
Bug: 21305292
Change-Id: I6e7a83e53e245d71e43d78f1957f844f2ed1cdfb
When we forget a private partition, ask vold to also forget the key
for that partition GUID. This means we need to track both the
filesystem UUID and the partition GUID for a private volume.
Bug: 21782268
Change-Id: Icda1cbb65539d61dacc663428daf3d1a2e4c313e
Per UX, default strings should have space between value and units
resulting in "12.3 GB". Add a formatting variant that returns the
various components for callers who want to build their own strings.
For now there is only one mounted emulated volume at a time, and
it's always the primary storage, so give it the default rootId to
keep old Uris working.
Change-Id: Ifcc72a91a6b397ee65dc92642153286186eb64ac