summaryrefslogtreecommitdiffstats
path: root/include/minikin
diff options
context:
space:
mode:
authorRoozbeh Pournader <roozbeh@google.com>2015-05-12 14:35:24 -0700
committerRoozbeh Pournader <roozbeh@google.com>2015-05-12 14:51:36 -0700
commit0dc07c0be325b7c12c50729e04c4b2785a673fd7 (patch)
treeff001ac27969fe02a6474fd53ba7b3332c7776ce /include/minikin
parent8920e81717c6e51b92ff8f4479a1f959af260556 (diff)
downloadandroid_frameworks_minikin-0dc07c0be325b7c12c50729e04c4b2785a673fd7.tar.gz
android_frameworks_minikin-0dc07c0be325b7c12c50729e04c4b2785a673fd7.tar.bz2
android_frameworks_minikin-0dc07c0be325b7c12c50729e04c4b2785a673fd7.zip
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
Diffstat (limited to 'include/minikin')
-rw-r--r--include/minikin/LineBreaker.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/minikin/LineBreaker.h b/include/minikin/LineBreaker.h
index ebe5dc4..36314fb 100644
--- a/include/minikin/LineBreaker.h
+++ b/include/minikin/LineBreaker.h
@@ -36,6 +36,12 @@ enum BreakStrategy {
kBreakStrategy_Balanced = 2
};
+enum HyphenationFrequency {
+ kHyphenationFrequency_None = 0,
+ kHyphenationFrequency_Normal = 1,
+ kHyphenationFrequency_Full = 2
+};
+
// TODO: want to generalize to be able to handle array of line widths
class LineWidths {
public:
@@ -142,6 +148,12 @@ class LineBreaker {
void setStrategy(BreakStrategy strategy) { mStrategy = strategy; }
+ HyphenationFrequency getHyphenationFrequency() const { return mHyphenationFrequency; }
+
+ void setHyphenationFrequency(HyphenationFrequency frequency) {
+ mHyphenationFrequency = frequency;
+ }
+
// TODO: this class is actually fairly close to being general and not tied to using
// Minikin to do the shaping of the strings. The main thing that would need to be changed
// is having some kind of callback (or virtual class, or maybe even template), which could
@@ -218,6 +230,7 @@ class LineBreaker {
// layout parameters
BreakStrategy mStrategy = kBreakStrategy_Greedy;
+ HyphenationFrequency mHyphenationFrequency = kHyphenationFrequency_Normal;
LineWidths mLineWidths;
TabStops mTabStops;