diff options
author | Raph Levien <raph@google.com> | 2015-01-29 16:28:37 -0800 |
---|---|---|
committer | Raph Levien <raph@google.com> | 2015-03-12 14:37:55 -0700 |
commit | d692d6a9791145d41d7778cdf6b40b20c2be8cb4 (patch) | |
tree | 4a14446b1b09255c3e9dc8453c93c9eb7ed72e4d /include | |
parent | 0bbff3a96d3836079371cdd4398c21afad3c5234 (diff) | |
download | android_frameworks_minikin-d692d6a9791145d41d7778cdf6b40b20c2be8cb4.tar.gz android_frameworks_minikin-d692d6a9791145d41d7778cdf6b40b20c2be8cb4.tar.bz2 android_frameworks_minikin-d692d6a9791145d41d7778cdf6b40b20c2be8cb4.zip |
HyphenEdit in support of hyphenation
Adds a "HyphenEdit" field to the Minikin Paint object, which represents
an edit to the text to add a hyphen (and, in the future, other edits to
support nonstandard hyphenation).
Change-Id: Ib4ee690b0fe2137e1d1e2c9251e5526b274ec3a7
Diffstat (limited to 'include')
-rw-r--r-- | include/minikin/MinikinFont.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/include/minikin/MinikinFont.h b/include/minikin/MinikinFont.h index 3f07589..ee885f4 100644 --- a/include/minikin/MinikinFont.h +++ b/include/minikin/MinikinFont.h @@ -27,6 +27,18 @@ namespace android { +// The hyphen edit represents an edit to the string when a word is +// hyphenated. The most common hyphen edit is adding a "-" at the end +// of a syllable, but nonstandard hyphenation allows for more choices. +class HyphenEdit { +public: + HyphenEdit() : hyphen(0) { } + HyphenEdit(uint32_t hyphenInt) : hyphen(hyphenInt) { } + bool hasHyphen() const { return hyphen != 0; } +private: + uint32_t hyphen; +}; + class MinikinFont; // Possibly move into own .h file? @@ -36,7 +48,8 @@ struct MinikinPaint { fakery(), fontFeatureSettings() { } bool skipCache() const { - return !fontFeatureSettings.empty(); + // TODO: add hyphen to cache + return !fontFeatureSettings.empty() || hyphenEdit.hasHyphen(); } MinikinFont *font; @@ -46,6 +59,7 @@ struct MinikinPaint { float letterSpacing; uint32_t paintFlags; FontFakery fakery; + HyphenEdit hyphenEdit; std::string fontFeatureSettings; }; |