summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2021-11-12 23:14:18 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-11-12 23:14:18 +0000
commit60b538655de410747fa708caf1e3f962c218a794 (patch)
tree562db8d5d7554549d24b10e9813ee37bb7099600
parentce536966d915fb806373983dcef435b45c4324c5 (diff)
parentb60affcc7c81fd9bf1553483267ce75133633cf8 (diff)
downloadminikin-android-t-preview-1.tar.gz
Original change: https://android-review.googlesource.com/c/platform/frameworks/minikin/+/1878116 Change-Id: Ia5aee8a96249d992e98a9420bcc2c4768e676c9f
-rw-r--r--libs/minikin/LayoutCore.cpp2
-rw-r--r--libs/minikin/Locale.cpp2
-rw-r--r--libs/minikin/Locale.h2
-rw-r--r--tests/unittest/FontFamilyTest.cpp9
4 files changed, 7 insertions, 8 deletions
diff --git a/libs/minikin/LayoutCore.cpp b/libs/minikin/LayoutCore.cpp
index f1d0de8..f5e9937 100644
--- a/libs/minikin/LayoutCore.cpp
+++ b/libs/minikin/LayoutCore.cpp
@@ -455,7 +455,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;
}
}