879e8a3a479b2cedd05e652f082683a02aa57dcf |
|
13-Apr-2016 |
Raph Levien <raph@google.com> |
Clear mLineWidths in LineBreaker::finish() There was the possibility of stale indents from previous invocations persisting in the mLineWidths across multiple invocations. This patch clears them. Bug: 28090810 Change-Id: I3621dfbe983512046289373711709aeade52eab4
/frameworks/minikin/libs/minikin/LineBreaker.cpp
|
ea408fc18e8e78d984ebdf63703da668a15720de |
|
18-Feb-2016 |
Keisuke Kuroyanagi <ksk@google.com> |
Optimize: Use measureText instead of doLayout. With this CL, measureText is used for getRunAdvance, getOffsetForAdvance and line breaking. Bug: 24505153 Change-Id: Ib699f6b1391b46537736fc274cdb41686586b550
/frameworks/minikin/libs/minikin/LineBreaker.cpp
|
aa736d00548da691e75a09a70deb886e1f68b060 |
|
18-Feb-2016 |
Raph Levien <raph@google.com> |
Disable hyphenation when word overlaps style boundary In cases when a word (as defined by the ICU break iterator) overlaps a style boundary, the returned wordStart can be extend before the range currently being measured for layout. When we try to hyphenate the resulting substrings, we get a negative range, which crashes. This patch disables hyphenation in this case. Bug: 27237112 Change-Id: I76d04b39dd3b4d6d267aaaf4bebc9ab361891646
/frameworks/minikin/libs/minikin/LineBreaker.cpp
|
c88ef135fcc2661ec7addc171ebc60787df38aff |
|
09-Sep-2015 |
Raph Levien <raph@google.com> |
Add penalty for breaks in URLs and email addresses Recent changes have added special cases for line breaks within URLs and email addresses. Such breaks are undesirable when they can be avoided, but at other times are needed to avoid huge gaps, or indeed to make the line fit at all. This patch assigns a penalty for such breaks, equal to the hyphenation penalty. The mechanism is currently very simple, but would be easy to fine-tune based on more detailed information about break quality. Bug: 20126487 Bug: 20566159 Change-Id: I0d3323897737a2850f1e734fa17b96b065eabd9c
/frameworks/minikin/libs/minikin/LineBreaker.cpp
|
57b6dae9894b9362ef04517ff477fd491f9d433b |
|
05-Sep-2015 |
Raph Levien <raph@google.com> |
Refine hyphenation around punctuation Implement a WordBreaker that defines our concept of valid word boundaries, customizing the ICU behavior. Currently, we suppress line breaks at soft hyphens (these are handled specially). Also, the new WordBreaker class has methods that determine the start and end of the word (punctuation stripped) for the purpose of hyphenation. This patch, in its current form, doesn't handle email addresses and URLs specially, but the WordBreaker class is the correct place to do so. Also, special case handling of hyphens and dashes is still done in LineBreaker, but all of that should be moved to WordBreaker. Bug: 20126487 Bug: 20566159 Change-Id: I492cbad963f9b74a2915f010dad46bb91f97b2fe
/frameworks/minikin/libs/minikin/LineBreaker.cpp
|
bae347682989d2627081310129a5b60541ed6ad0 |
|
27-Oct-2015 |
Seigo Nonaka <nona@google.com> |
Add -Werror -Wall -Wextra to compiler option. This is 2nd trial of I30a0914a4633bd93eb60957cdf378770f04d8428 - To suppress noisy unused parameter warnings, comment out unused arguments. - Add -Werror for suppressing further warning. - Add -Wall -Wextra for safety. - Use "z" prefix for format string of size_t. Verified that compile succeeded on all arm,arm64,mips,x86,x86_64. Change-Id: I7ad208464486b8a35da53929cb1cfe541ed0052f
/frameworks/minikin/libs/minikin/LineBreaker.cpp
|
e9ec9a1d1b9e177659b7cc2cd3a102760fcfec14 |
|
21-Jul-2015 |
Raph Levien <raph@google.com> |
Consistently apply break opportunities in text spans It's essential not to apply a break opportunity within a replacement span, otherwise things can happen such as displaying the span twice. The old code tested this case based on zero-width characters. However, this test was both imprecise, and also in some cases read uninitialized values from the mCharWidths array, which in turn led to inconsistent line breaking of the same text. This patch applies all line break opportunities (as identified by ICU) within text (as opposed to replacement spans), and also applies break opportunities at the beginning and end of replacement spans, but avoids breaks within a replacement span. Bug: 20138621 Change-Id: I36baeb44d6808356649e1bb69ca57f093fc8c723
/frameworks/minikin/libs/minikin/LineBreaker.cpp
|
daf62d0eef9e339c9d3269e5eaa2007d25c18194 |
|
15-Jul-2015 |
Roozbeh Pournader <roozbeh@google.com> |
Add missing hyphen-like characters. This adds various hyphen-like characters missed in the previous patch, that should disallow automatic hyphenation of words containing them. Bug: 22484266 Change-Id: Ie972cb50384dbe0aa1ab5ec50286b75f9877953a
/frameworks/minikin/libs/minikin/LineBreaker.cpp
|
baf6d0a41fdabb0f859bd065f3724921a3e91089 |
|
14-Jul-2015 |
Roozbeh Pournader <roozbeh@google.com> |
Avoid re-hyphenating already-hyphenated phrases. Previously, automatic hyphenation blindly took almost every line breaking opportunity as a word break, so words like "low-budget" were treated as two separate words, "low-", and "budget", each automatically hyphenated. This patch makes sure the subwords in already-hyphenated phrases are not passed to the automatic hyphenator, while keeping the possibility of a potential line break where a hyphen already exists. Bug: 22484266 Bug: 22287425 Change-Id: Ie46dbdd70e993d64a9b9cf44b4ae93b21459dbc2
/frameworks/minikin/libs/minikin/LineBreaker.cpp
|
91425f0564581e258d3f9b2f44d13f3b6d7a60ea |
|
29-Jun-2015 |
Raph Levien <raph@google.com> |
Fix logspam and incorrect cluster offset An incorrect cluster offset calculation was causing a lot of log messages to appear. Separately, a confusion between #if and #ifdef was causing unintended logging of line breaks. This patch fixes both. Bug: 22178333 Change-Id: I2b3673ed66c784f5082fd127a8dc10bd3df6ed79
/frameworks/minikin/libs/minikin/LineBreaker.cpp
|
a6f8bf6f530f80b00a7cc64605667dd1d75a971c |
|
24-Jun-2015 |
Raph Levien <raph@google.com> |
Separate additional penalty for last line with hyphen A recent change added a penalty for a hyphen at the last line break, which is visually undesirable. However, the penalty was assessed to "widthScore", which broke the assumption (used for another optimization) that widthScore increases monotonically. This patch separates the penalty into a different parameter, restoring the validity of the monotonicity assumption. Bug: 22066119 Change-Id: I6a47a350ef3ceee2f00ee430d6954d0c307227f0
/frameworks/minikin/libs/minikin/LineBreaker.cpp
|
abae97a39c26e191e350575932611a90e6b04d06 |
|
08-Jun-2015 |
Raph Levien <raph@google.com> |
Increase hyphenation penalty for short last line Tuning for hyphenation parameters. We discourage hyphenation on the last line, but offset this penalty by also applying a penalty for each line, which optimizes for minimizing the number of lines. Thus, when hyphenation can reduce the number of lines, it increases the chance they're used. There's probably more tuning and refinement that can be done, but testing suggests that the tunable parameters are appropriate. Bug: 20883322 Change-Id: Ida7eaf8aced109e426694f5a386924a842d29c4b
/frameworks/minikin/libs/minikin/LineBreaker.cpp
|
a019665898d830283a99f505f72d3899ba137b62 |
|
01-Jun-2015 |
Raph Levien <raph@google.com> |
Disable hyphenation for unreasonably long words Very long words cause O(n^2) behavior. These are unlikely to happen in real text, but do happen with synthetic strings, so in those cases we just disable hyphenation. Bug: 20790394 Change-Id: Idf957dd40b24efe1476f619f17093a48b5bc56f7
/frameworks/minikin/libs/minikin/LineBreaker.cpp
|
0dc07c0be325b7c12c50729e04c4b2785a673fd7 |
|
12-May-2015 |
Roozbeh Pournader <roozbeh@google.com> |
Support hyphenation frequency in Minikin. Three hyphenation frequencies are now supported: kHyphenationFrequency_None, which turns off both automatic hyphenation and soft hyphens. kHyphenationFrequency_Normal, which has aconservative amount of hyphenation useful as a conservative default. kHyphenationFrequency_Full, which has a typographic-quality amount of hyphenation useful for running text and tight screens. Bug: 21038249 Change-Id: I2800f718c887c9389a1a059d7ec07d7fa2ca1dee
/frameworks/minikin/libs/minikin/LineBreaker.cpp
|
68ae337aa05f598af18b09fe4125146d4d67db83 |
|
23-Apr-2015 |
Raph Levien <raph@google.com> |
Don't include trailing newline in width for line breaking In a paragraph with a trailing newline, the width of the newline character was included in the line width for breaking purposes, basically as if it were a non-breaking space. This caused a discrepancy, where Layout.getDesiredWidth() suggested that the text would fit in a single line, but StaticLayout would break it because of the added width of the newline character. The proposed fix is simply to consider newline to be a space that disappears at the end of a line. Bug: 20152308 Change-Id: I539574c5b8ea892c8ed6aca6c59e90ccdf74a680
/frameworks/minikin/libs/minikin/LineBreaker.cpp
|
bb86b433f97a301c11800806b1ce5331fa227d4a |
|
16-Apr-2015 |
Raph Levien <raph@google.com> |
Rename "margins" to "indents" The name "margin" conflicts with another meaning, so we're making the name in the public api "idents" and the code consistent in naming. Change-Id: I9170116b4d972e4b25f0f319e78376310288eb41
/frameworks/minikin/libs/minikin/LineBreaker.cpp
|
dc7bc6e39e1ef6b713b927baf24db8b4f02f1a3f |
|
15-Apr-2015 |
Raph Levien <raph@google.com> |
Add margins array to line widths object In order to support layout in non-rectangular regions, the LineWidths object needs to accept an arbitrary array of margins. This is implemented in addition to the existing firstWidthLineCount/restWidth mechanism for convenience, though using only arrays would have the same expressive power. Bug: 20182243 Change-Id: Iea96bca1a92012314ac27e617c67f306c1f1b2f2
/frameworks/minikin/libs/minikin/LineBreaker.cpp
|
5cdad92c300a65cab89b172e952186f0c5870657 |
|
30-Mar-2015 |
Raph Levien <raph@google.com> |
Revert "Fix build: Revert "Add hyphenation to line breaking"" This reverts commit 0b25d5ac85533f64764a0d53d5e5d33b46b715fa.
/frameworks/minikin/libs/minikin/LineBreaker.cpp
|
0b25d5ac85533f64764a0d53d5e5d33b46b715fa |
|
30-Mar-2015 |
Ed Heyl <edheyl@google.com> |
Fix build: Revert "Add hyphenation to line breaking" This reverts commit daf6a6bdbf2ff1f66496d6200cb253e2f50759d5. Change-Id: I3fed65046274d3aeb748f0730585ab89927f5741
/frameworks/minikin/libs/minikin/LineBreaker.cpp
|
daf6a6bdbf2ff1f66496d6200cb253e2f50759d5 |
|
19-Mar-2015 |
Raph Levien <raph@google.com> |
Add hyphenation to line breaking This patch adds hyphenation using the Liang hyphenation algorithm, similar to TeX. It also improves the optimized line breaker so that it works correctly and efficiently even when the line width is not constant (there is a specialization for constant width, which is probably worthwhile, but performance TODOs remain). Still to be done: * hyphenator has many shortcuts, only tested with English * interaction between punctuation and hyphenation is problematic Change-Id: I2d94a1668ebc536398b7c43fcf486333eeb7c6aa
/frameworks/minikin/libs/minikin/LineBreaker.cpp
|
01f526614431e3a0a6e1a48039e00b8a9b7d6fbf |
|
14-Mar-2015 |
Raph Levien <raph@google.com> |
Add LineBreaker to Minikin This patch adds a LineBreaker class to Minikin, which will be used for computing line breaks in StaticLayout. The version in this patch contains basically the same functionality that existed before, but hopefully better performance and an interface that's suitable for more sophisticated paragraph layout. Note that this version contains a high quality strategy, which mostly works but doesn't respect varying line width. Change-Id: I02485d58b1e52856296a72cdd4efd963bc572933
/frameworks/minikin/libs/minikin/LineBreaker.cpp
|