diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2021-11-12 23:57:13 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-11-12 23:57:13 +0000 |
commit | d6f9a28731fa1419492a477b9de1d3270754fd24 (patch) | |
tree | fa13123b7a5828c681ed8b1d69f4f810c67798c4 | |
parent | c210de76b462c0687363e15ea997c24dabce2a1a (diff) | |
parent | 08bfada9fc54d63353f3157a7491231e4301b62f (diff) | |
download | minikin-d6f9a28731fa1419492a477b9de1d3270754fd24.tar.gz |
Merge "Stop using hb_script_t in the minikin methods" am: b60affcc7c am: 60b538655d am: 19397b6519 am: 08bfada9fc
Original change: https://android-review.googlesource.com/c/platform/frameworks/minikin/+/1878116
Change-Id: I962ec45683a0add00a5f7034d74114a02c634e97
-rw-r--r-- | libs/minikin/LayoutCore.cpp | 2 | ||||
-rw-r--r-- | libs/minikin/Locale.cpp | 2 | ||||
-rw-r--r-- | libs/minikin/Locale.h | 2 | ||||
-rw-r--r-- | tests/unittest/FontFamilyTest.cpp | 9 |
4 files changed, 7 insertions, 8 deletions
diff --git a/libs/minikin/LayoutCore.cpp b/libs/minikin/LayoutCore.cpp index 7bbafac..ebc5626 100644 --- a/libs/minikin/LayoutCore.cpp +++ b/libs/minikin/LayoutCore.cpp @@ -429,7 +429,7 @@ LayoutPiece::LayoutPiece(const U16StringPiece& textBuf, const Range& range, bool if (localeList.size() != 0) { hb_language_t hbLanguage = localeList.getHbLanguage(0); for (size_t i = 0; i < localeList.size(); ++i) { - if (localeList[i].supportsHbScript(script)) { + if (localeList[i].supportsScript(hb_script_to_iso15924_tag(script))) { hbLanguage = localeList.getHbLanguage(i); break; } diff --git a/libs/minikin/Locale.cpp b/libs/minikin/Locale.cpp index 553f61a..3d1cfda 100644 --- a/libs/minikin/Locale.cpp +++ b/libs/minikin/Locale.cpp @@ -449,7 +449,7 @@ bool Locale::supportsScript(uint8_t providedBits, uint8_t requestedBits) { return requestedBits != 0 && (providedBits & requestedBits) == requestedBits; } -bool Locale::supportsHbScript(hb_script_t script) const { +bool Locale::supportsScript(uint32_t script) const { static_assert(unpackScript(packScript('J', 'p', 'a', 'n')) == HB_TAG('J', 'p', 'a', 'n'), "The Minikin script and HarfBuzz hb_script_t have different encodings."); uint32_t packedScript = packScript(script); diff --git a/libs/minikin/Locale.h b/libs/minikin/Locale.h index 7557301..01e0a52 100644 --- a/libs/minikin/Locale.h +++ b/libs/minikin/Locale.h @@ -133,7 +133,7 @@ public: // Returns true if this script supports the given script. For example, ja-Jpan supports Hira, // ja-Hira doesn't support Jpan. - bool supportsHbScript(hb_script_t script) const; + bool supportsScript(uint32_t script) const; std::string getString() const; diff --git a/tests/unittest/FontFamilyTest.cpp b/tests/unittest/FontFamilyTest.cpp index fd2fc9a..ad3a6b7 100644 --- a/tests/unittest/FontFamilyTest.cpp +++ b/tests/unittest/FontFamilyTest.cpp @@ -287,14 +287,13 @@ TEST(LocaleTest, ScriptMatchTest) { }; for (const auto& testCase : testCases) { - hb_script_t script = hb_script_from_iso15924_tag( - HB_TAG(testCase.requestedScript[0], testCase.requestedScript[1], - testCase.requestedScript[2], testCase.requestedScript[3])); + uint32_t script = HB_TAG(testCase.requestedScript[0], testCase.requestedScript[1], + testCase.requestedScript[2], testCase.requestedScript[3]); if (testCase.isSupported) { - EXPECT_TRUE(createLocale(testCase.baseScript).supportsHbScript(script)) + EXPECT_TRUE(createLocale(testCase.baseScript).supportsScript(script)) << testCase.baseScript << " should support " << testCase.requestedScript; } else { - EXPECT_FALSE(createLocale(testCase.baseScript).supportsHbScript(script)) + EXPECT_FALSE(createLocale(testCase.baseScript).supportsScript(script)) << testCase.baseScript << " shouldn't support " << testCase.requestedScript; } } |