diff options
author | Roozbeh Pournader <roozbeh@google.com> | 2015-08-07 21:37:37 -0700 |
---|---|---|
committer | Roozbeh Pournader <roozbeh@google.com> | 2015-08-07 22:16:25 -0700 |
commit | 71ec97055357b6ccb13a2697a56254bb19f43ae9 (patch) | |
tree | 5f63f17acef65b43b3d7ddc2aa8521cbff664bb2 /include/minikin | |
parent | c02138bf556739fa9c9212da13aee89aa520c8ef (diff) | |
download | android_frameworks_minikin-71ec97055357b6ccb13a2697a56254bb19f43ae9.tar.gz android_frameworks_minikin-71ec97055357b6ccb13a2697a56254bb19f43ae9.tar.bz2 android_frameworks_minikin-71ec97055357b6ccb13a2697a56254bb19f43ae9.zip |
Support three-letter language codes in FontLanguage.
Also handle the case of weird language code that we don't understand
properly better, by treating them not equal to each other.
Change-Id: Iaccb251fa38d700932f6eadac254d3d1fa09b3ea
Diffstat (limited to 'include/minikin')
-rw-r--r-- | include/minikin/FontFamily.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/include/minikin/FontFamily.h b/include/minikin/FontFamily.h index 7bdff6e..d21a20a 100644 --- a/include/minikin/FontFamily.h +++ b/include/minikin/FontFamily.h @@ -40,7 +40,9 @@ public: // Parse from string FontLanguage(const char* buf, size_t size); - bool operator==(const FontLanguage other) const { return mBits == other.mBits; } + bool operator==(const FontLanguage other) const { + return mBits != kUnsupportedLanguage && mBits == other.mBits; + } operator bool() const { return mBits != 0; } std::string getString() const; @@ -53,10 +55,11 @@ private: uint32_t bits() const { return mBits; } - static const uint32_t kBaseLangMask = 0xffff; - static const uint32_t kScriptMask = (1 << 18) - (1 << 16); - static const uint32_t kHansFlag = 1 << 16; - static const uint32_t kHantFlag = 1 << 17; + static const uint32_t kUnsupportedLanguage = 0xFFFFFFFFu; + static const uint32_t kBaseLangMask = 0xFFFFFFu; + static const uint32_t kScriptMask = (1u << 26) - (1u << 24); + static const uint32_t kHansFlag = 1u << 24; + static const uint32_t kHantFlag = 1u << 25; uint32_t mBits; }; |