History log of /frameworks/base/core/jni/android_text_StaticLayout.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
2412b4d979f0dbdb6ac8265bf97b3665fde83719 20-Jul-2017 Steven Moreland <smoreland@google.com> Merge "frameworks/base: use proper nativehelper headers" am: 826eafd958 am: 5c091dc944 am: c840945a78
am: 9f430b2782

Change-Id: Ibe321dd4a8aae9342c76da0780edf94b90e8cd3a
5c091dc9449b583e18656a8850a61f557dfcc945 20-Jul-2017 Steven Moreland <smoreland@google.com> Merge "frameworks/base: use proper nativehelper headers"
am: 826eafd958

Change-Id: I36f10ff4d963284a313f1cc5b368f82549a4adb2
2279b2534272282a5b5152723235da397e49195c 19-Jul-2017 Steven Moreland <smoreland@google.com> frameworks/base: use proper nativehelper headers

libnativehelper exports headers under nativehelper. These were
available before incorrectly as global headers in order to give
access to jni.h.

Test: modules using frameworks/base find headers
Bug: 63762847
Change-Id: I0f9f231acdebe460f279135462f43d3e32eff64d
/frameworks/base/core/jni/android_text_StaticLayout.cpp
ef7cfa17e78d05b8d931d839d25261c459a0fc90 15-Jun-2017 Roozbeh Pournader <roozbeh@google.com> Pass all locale information down to Minikin

Previously, locale lists and LocaleSpans were ignored in deciding line
breaking and hyphenation in layouts.

Now, we pass both changing locale information and the whole locale
list to Minikin.

Fixes: 21571721
Bug: 25122192
Test: adb shell am instrument -w -e package android.text com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Change-Id: Ia93b0b7cbe54de65bb0ec4937e65cc7993559a6f
/frameworks/base/core/jni/android_text_StaticLayout.cpp
a59c3feb8dca564a0afe290c9c717ca63047bcee 27-Feb-2017 Roozbeh Pournader <roozbeh@google.com> Customizable minimum suffix/prefix length for hyphenation

With this change, different languages can have a different minimum
length for suffix and prefixes when hyphenating. Previously, the
defaults used for English, 2 and 3, were used for every language.

Bug: 35712376
Test: Manual: German text can now break after two characters
Change-Id: Ia12d448a42bf2fab7c0bf5e85f8e27a4fb7f77d8
/frameworks/base/core/jni/android_text_StaticLayout.cpp
c7064146f959caec058980ced144942c8044a169 10-Feb-2017 Seigo Nonaka <nona@google.com> Follow Minikin's signature changes.

Minikin now uses shared_ptr instead of MinikinRefCounted.

Bug: 28119474
Test: manually tested
Test: hwui_unit_tests passed.
Change-Id: Ie0564851a8a798af112679e15f7a07db000a977e
/frameworks/base/core/jni/android_text_StaticLayout.cpp
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/jni/android_text_StaticLayout.cpp
ae1aa85d0c7305bb621f1f8003bd674285aa3b63 09-Jun-2016 Seigo Nonaka <nona@google.com> Follow the minikin namespace changes

Bug: 29233740
Change-Id: I0ec7c5c88e64daa626751d3a03e24b9c36521c17
/frameworks/base/core/jni/android_text_StaticLayout.cpp
bad99183916ba2bac6659efc8a28273e344ba511 17-Mar-2016 sergeyv <sergeyv@google.com> Clean up and rename TypefaceImpl

bug:25865834
Change-Id: I77e8a627163e040a5c25865054a8a936052af367
/frameworks/base/core/jni/android_text_StaticLayout.cpp
dccca44ffda4836b56a21da95a046c9708ffd49c 21-Mar-2016 sergeyv <sergeyv@google.com> Reland: Move text logic from jni to hwui level

Initial CL: https://googleplex-android-review.git.corp.google.com/#/c/886854/

Change-Id: I9dfd85fe1d2a2c44f4360c8a29fd58d80e6f31c8
/frameworks/base/core/jni/android_text_StaticLayout.cpp
afbd0f1fef46ef0ddf633dfde0de724db3da1405 21-Mar-2016 Sergei Vasilinetc <sergeyv@google.com> Revert "Move text logic from jni to hwui level"

This reverts commit a7f6bba1a3565c19715e878dfe7f0e01022944ff.

Change-Id: If4f36f87a85411b6128fd92d391313803ccaf9dd
/frameworks/base/core/jni/android_text_StaticLayout.cpp
a7f6bba1a3565c19715e878dfe7f0e01022944ff 16-Mar-2016 sergeyv <sergeyv@google.com> Move text logic from jni to hwui level

bug:25865834
Change-Id: I2d8c9c9544afcb5ce1784f732aed3e54e0eda372
/frameworks/base/core/jni/android_text_StaticLayout.cpp
f8f9c10247b32c0075f0e0e30c1f38d7a61a030d 01-Oct-2015 Raph Levien <raph@google.com> Merge "Load binary hyphen data files"
091dba2de1e5fa7d4db9f8ccbf1f86e5825d0f52 01-Sep-2015 Raph Levien <raph@google.com> Load binary hyphen data files

Support for loading the pre-compiled binary format for hyphenation
patterns.

Bug: 21562869
Bug: 21826930
Change-Id: Iaeaa9c9ac9dac236af6b0d7894c2e2396bc8447d
/frameworks/base/core/jni/android_text_StaticLayout.cpp
b57dd722f1dc0663417da37d3a82f8283ad3c982 24-Sep-2015 Elliott Hughes <enh@google.com> resolved conflicts for a884d81e to stage-aosp-master

Change-Id: Ice485967fa96f13786024b6939b826638e906ff0
76f6a86de25e1bf74717e047e55fd44b089673f3 19-Sep-2015 Daniel Micay <danielmicay@gmail.com> constify JNINativeMethod function pointer tables

Change-Id: I4036c924958221cbc644724f8eb01c5de3cd7954
/frameworks/base/core/jni/android_text_StaticLayout.cpp
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/jni/android_text_StaticLayout.cpp
e319d5a3627aa3cd73c6ec0c76f8593ddefbab9d 15-Apr-2015 Raph Levien <raph@google.com> Add left and right indent arrays to TextView

In support of layout of paragraphs to non-rectangular regions, add
arrays for left and right indents to TextView, along with supporting
StaticLayout builder setters.

Bug: 20182243
Change-Id: I015bcef8f258c89001fcf8a54c179d2dfc0d7943
/frameworks/base/core/jni/android_text_StaticLayout.cpp
ee101a3c6627e7cf871f81583bb62f719485a2bd 31-Mar-2015 Raph Levien <raph@google.com> Remove unused constants in android_text_StaticLayout.cpp

The logic for computing line breaking moved to Minikin, and so the
various Unicode characters with special meaning for line breaks are no
longer used in android_text_StaticLayout.cpp (which is now a fairly
thin wrapper that just does JNI glue). This patch deletes the
constants, which makes the warnings-as-errors setting of our current
clang build happy.

Change-Id: I1bb3596ca4f0c78a8e185af9000c0c366fb9b020
/frameworks/base/core/jni/android_text_StaticLayout.cpp
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/jni/android_text_StaticLayout.cpp
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/jni/android_text_StaticLayout.cpp
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/jni/android_text_StaticLayout.cpp
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/jni/android_text_StaticLayout.cpp
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/jni/android_text_StaticLayout.cpp
c0b8f647ca3e3d698b75084b1b555b7af00aec5f 10-Mar-2015 Elliott Hughes <enh@google.com> resolved conflicts for merge of 7545accf to master

Change-Id: I7a9264e818fdd14bf59f0dec63ab83985f9e66fb
4c5806b6b495c8d3c0558374b84a879b7488a140 07-Mar-2015 Elliott Hughes <enh@google.com> Use the icu:: namespace for icu4c API.

The icu guys recommend working this way, though it's not the default.
Internally Google makes this the default, and I've switched libcore
over.

Bug: 15350832
Change-Id: I038e12bea58dd089a46d0e681b5ab76cfc19d7b9
/frameworks/base/core/jni/android_text_StaticLayout.cpp
4c1f12efcf24e404df40f19075eb95a148a9d6a1 03-Mar-2015 Raph Levien <raph@google.com> Add JNI StaticLayout.Builder

This patch adds a native C++ Builder object for StaticLayout to
complement the Java one introduced in a previous patch.

The Builder object contains state used in constructing a layout, as well
as temporary buffers, to avoid having to allocate such. In particular,
it holds a break iterator, so avoids the cost of constructing that in
the common case of a single locale.

Change-Id: I1125103b7ccf00b8674c1586c3ea8d5d915fdd5b
/frameworks/base/core/jni/android_text_StaticLayout.cpp
158b6c98508f111de041853cab1d7a87b771b651 21-Nov-2014 Andreas Gampe <agampe@google.com> resolve merge conflicts of 7d13d9d to master.

Change-Id: I4d8a7ec4a25471565859050939ec05b0c1261627
ed6b9dff563c5e22f040ff37e12c0d771e0478ae 21-Nov-2014 Andreas Gampe <agampe@google.com> Frameworks/base: Consistency in core/jni

Make consistent use of core_jni_helpers for registration.

Translate some #ifdefs into const bools.

Change-Id: I37639aa053dd50f003a552cbd8550dddecc811c5
/frameworks/base/core/jni/android_text_StaticLayout.cpp
660538f82af9b5f6b7efc2de175a0540e9bb98c5 14-Nov-2014 Nick Kralevich <nnk@google.com> Fix build

frameworks/base/core/jni/android_text_StaticLayout.cpp:358:43: error: overflow in implicit constant conversion [-Werror=overflow]
firstTabIndex = SIZE_MAX;
^
frameworks/base/core/jni/android_text_StaticLayout.cpp:367:43: error: overflow in implicit constant conversion [-Werror=overflow]
firstTabIndex = SIZE_MAX;
^
frameworks/base/core/jni/android_text_StaticLayout.cpp:391:39: error: overflow in implicit constant conversion [-Werror=overflow]
firstTabIndex = SIZE_MAX;
^
cc1plus: all warnings being treated as errors
make: *** [out/target/product/generic_arm64/obj/SHARED_LIBRARIES/libandroid_runtime_intermediates/android_text_StaticLayout.o] Error 1

Change-Id: I2364f697588c8657ba5f2d15cf1d60a174655613
/frameworks/base/core/jni/android_text_StaticLayout.cpp
cf670bc71423f3690a3776e012e03f04d1cad198 14-Nov-2014 Nick Kralevich <nnk@google.com> fix build

frameworks/base/core/jni/android_text_StaticLayout.cpp: In member function 'int android::OptimizingLineBreaker::desperateBreak(int, int, float, float*, float*, bool*) const':
frameworks/base/core/jni/android_text_StaticLayout.cpp:263:19: error: variable 'breakWidth' set but not used [-Werror=unused-but-set-variable]
float breakWidth, breakPrintedWidth;
^
frameworks/base/core/jni/android_text_StaticLayout.cpp:263:31: error: variable 'breakPrintedWidth' set but not used [-Werror=unused-but-set-variable]
float breakWidth, breakPrintedWidth;
^
frameworks/base/core/jni/android_text_StaticLayout.cpp: In function 'jint android::nComputeLineBreaks(JNIEnv*, jclass, jstring, jcharArray, jfloatArray, jint, jfloat, jint, jfloat, jintArray, jint, jboolean, jobject, jintArray, jfloatArray, jbooleanArray, jint)':
frameworks/base/core/jni/android_text_StaticLayout.cpp:539:15: error: unused variable 'ret' [-Werror=unused-variable]
jintArray ret;
^
cc1plus: all warnings being treated as errors
make: *** [out/target/product/hammerhead/obj/SHARED_LIBRARIES/libandroid_runtime_intermediates/android_text_StaticLayout.o] Error 1
make: *** Waiting for unfinished jobs....

Change-Id: Id2b4c35bd1bc6747cc3d5cf94e3857d9118f5c21
/frameworks/base/core/jni/android_text_StaticLayout.cpp
b8082603b60b50b42cf44e3d14f25ccb596fc069 27-Aug-2014 Raph Levien <raph@google.com> Remove duplicate line breaking

Fix for bug 17297223 "minikin crashing after boot on hammerhead in
master"

Due to improperly merged code, the line breaker was being run twice,
causing two copies of the layout. That in turn caused text crashes
because the line ends are not monotonic.

Change-Id: Ieaa702c530d6e9b2a90fb52a4ad716a9ddb567e7
/frameworks/base/core/jni/android_text_StaticLayout.cpp
969e7b949633baebd3f6090a60d622ee475a5b22 22-Jul-2014 Anish Athalye <aathalye@google.com> Add optimizing line breaker

Change-Id: I1eabc863e7f027c4c19a9ab23e561c774c721993
/frameworks/base/core/jni/android_text_StaticLayout.cpp
c8f9e6218681640d5f384c12edf06619be56a583 22-Jul-2014 Anish Athalye <aathalye@google.com> Implement line breaking in native code

The main purpose for this change is to prepare for adding support for
alternative line breaking algorithms (such as optimal line breaking).

The existing implementation of line breaking was intertwined with
measurement, so it wasn't structured in a way such that other line
breaking algorithms could be easily added. In addition to this,
algorithms (such as optimal line breaking) are usually fairly complex
and computation-intensive, so it is advantageous to implement them in
native code.

This has several other advantages:

* Unlike the Java code in the previous version of generate(), this
implementation separates line breaking from measurement. This
makes it easier to understand and modify the line breaking process
without affecting measurement (and vice versa).

* This native implementation of greedy line breaking is identical to
the Java version in terms of functionality, and it is similar in
terms of performance, depending on the use case. The performance
gains from this change are not significant due to increased JNI
overhead. However, this change is a step in the right direction in
terms of increasing performance. Once more code moves to C++,
there will be fewer JNI crossings per layout call and less data
will be passed from Java to C++, resulting in better performance.

This change moves line breaking from Java to native C++ code. Inspired
by the "Breaking Paragraphs into Lines" paper by Knuth and Plass (1981),
we express the line breaking problem in terms of 'box', 'glue', and
'penalty' primitives, along with a few others. Our implementation
differs in a couple ways:

* We do not want to clip text when words are wider than the view, so
we add a new primitive type to represent break opportunities
between letters. These breaks are avoided whenever possible, but
when single words do not fit on lines by themselves, they can be
broken so the entire word is visible.

* We have to support tab characters, along with user*specified tab
stops, so we add a new primitive type for that purpose.

* We are left*aligning text, and so we are not using shrinking /
stretching glue.

* We do not support hypenation, so we do not use penalties that have
widths.

Change-Id: Ia22d1d1275ef26ff3d7b41ee2658e4db525a0305
/frameworks/base/core/jni/android_text_StaticLayout.cpp
9b727000360c3cc103a36d4eb1f3b15e0ed8eae8 08-Jul-2014 Anish Athalye <aathalye@google.com> Fix extraneous allocation and copying

With breaks being allocated the way it was, there were 16 ints with
value 0 being stored in the beginning of the vector. Because of the way
the rest of the code is structured, this did not result in incorrect
operation, but it still wasted time and memory.

Change-Id: Ic0df3e5484417da51f2465ec2d72222fefffc18a
/frameworks/base/core/jni/android_text_StaticLayout.cpp
88b5b0be887fc5dc3b0b879b4179dde200d2e4d6 24-Jun-2014 Anish Athalye <aathalye@google.com> Implement line breaking using ICU break iterator

Change-Id: I4ad98757aa2eab5dbc2ae44c0391e900ef20c4d0
/frameworks/base/core/jni/android_text_StaticLayout.cpp