summaryrefslogtreecommitdiffstats
path: root/include/minikin/LineBreaker.h
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2015-06-08 13:41:44 -0700
committerRaph Levien <raph@google.com>2015-06-08 15:23:20 -0700
commitabae97a39c26e191e350575932611a90e6b04d06 (patch)
treeed5abfad45d1da5927af889f48fa09c2429f46eb /include/minikin/LineBreaker.h
parent73fa6dfd6366c6ac04d6a25cdcc0721f5b3e7fbb (diff)
downloadandroid_frameworks_minikin-abae97a39c26e191e350575932611a90e6b04d06.tar.gz
android_frameworks_minikin-abae97a39c26e191e350575932611a90e6b04d06.tar.bz2
android_frameworks_minikin-abae97a39c26e191e350575932611a90e6b04d06.zip
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
Diffstat (limited to 'include/minikin/LineBreaker.h')
-rw-r--r--include/minikin/LineBreaker.h9
1 files changed, 2 insertions, 7 deletions
diff --git a/include/minikin/LineBreaker.h b/include/minikin/LineBreaker.h
index 36314fb..e031fb3 100644
--- a/include/minikin/LineBreaker.h
+++ b/include/minikin/LineBreaker.h
@@ -200,9 +200,6 @@ class LineBreaker {
float currentLineWidth() const;
- // compute shrink/stretch penalty for line
- float computeScore(float delta, bool atEnd);
-
void addWordBreak(size_t offset, ParaWidth preBreak, ParaWidth postBreak, float penalty,
uint8_t hyph);
@@ -213,10 +210,7 @@ class LineBreaker {
void computeBreaksGreedy();
- void computeBreaksOptimal();
-
- // special case when LineWidth is constant (layout is rectangle)
- void computeBreaksOptimalRect();
+ void computeBreaksOptimal(bool isRectangular);
void finishBreaksOptimal();
@@ -241,6 +235,7 @@ class LineBreaker {
ParaWidth mWidth = 0;
std::vector<Candidate> mCandidates;
+ float mLinePenalty = 0.0f;
// the following are state for greedy breaker (updated while adding style runs)
size_t mLastBreak;