diff options
author | 2022-07-16 00:15:41 +0000 | |
---|---|---|
committer | 2022-07-20 21:48:22 +0000 | |
commit | 146c6a93d722ba9e8e259650646394f159f5e352 (patch) | |
tree | 0a377fd1a8583938b6aeacddaf1125fce3d3ea1b | |
parent | ff3ab034fecf84e1082f247ecc6b0185caa7987b (diff) |
Replace getFamilies() with getFamilyAt().
Following minikin signature change.
Bug: 174672300
Test: m libhwui
Test: m libandroid
Change-Id: I25c5d27c406f49b5ee91a7f4390484296d4a6c7f
-rw-r--r-- | libs/hwui/jni/Typeface.cpp | 14 | ||||
-rw-r--r-- | native/android/system_fonts.cpp | 7 |
2 files changed, 11 insertions, 10 deletions
diff --git a/libs/hwui/jni/Typeface.cpp b/libs/hwui/jni/Typeface.cpp index e79b395412b0..30d6d0009d3b 100644 --- a/libs/hwui/jni/Typeface.cpp +++ b/libs/hwui/jni/Typeface.cpp @@ -111,15 +111,15 @@ static jlong Typeface_createFromArray(JNIEnv *env, jobject, jlongArray familyArr std::vector<std::shared_ptr<minikin::FontFamily>> familyVec; Typeface* typeface = (fallbackPtr == 0) ? nullptr : toTypeface(fallbackPtr); if (typeface != nullptr) { - const std::vector<std::shared_ptr<minikin::FontFamily>>& fallbackFamilies = - toTypeface(fallbackPtr)->fFontCollection->getFamilies(); - familyVec.reserve(families.size() + fallbackFamilies.size()); + const std::shared_ptr<minikin::FontCollection>& fallbackCollection = + toTypeface(fallbackPtr)->fFontCollection; + familyVec.reserve(families.size() + fallbackCollection->getFamilyCount()); for (size_t i = 0; i < families.size(); i++) { FontFamilyWrapper* family = reinterpret_cast<FontFamilyWrapper*>(families[i]); familyVec.emplace_back(family->family); } - for (size_t i = 0; i < fallbackFamilies.size(); i++) { - familyVec.emplace_back(fallbackFamilies[i]); + for (size_t i = 0; i < fallbackCollection->getFamilyCount(); i++) { + familyVec.emplace_back(fallbackCollection->getFamilyAt(i)); } } else { familyVec.reserve(families.size()); @@ -360,13 +360,13 @@ static void Typeface_forceSetStaticFinalField(JNIEnv *env, jclass cls, jstring f // Critical Native static jint Typeface_getFamilySize(CRITICAL_JNI_PARAMS_COMMA jlong faceHandle) { - return toTypeface(faceHandle)->fFontCollection->getFamilies().size(); + return toTypeface(faceHandle)->fFontCollection->getFamilyCount(); } // Critical Native static jlong Typeface_getFamily(CRITICAL_JNI_PARAMS_COMMA jlong faceHandle, jint index) { std::shared_ptr<minikin::FontFamily> family = - toTypeface(faceHandle)->fFontCollection->getFamilies()[index]; + toTypeface(faceHandle)->fFontCollection->getFamilyAt(index); return reinterpret_cast<jlong>(new FontFamilyWrapper(std::move(family))); } diff --git a/native/android/system_fonts.cpp b/native/android/system_fonts.cpp index 9fe792958cef..4df745ff6a20 100644 --- a/native/android/system_fonts.cpp +++ b/native/android/system_fonts.cpp @@ -248,9 +248,10 @@ ASystemFontIterator* ASystemFontIterator_open() { minikin::SystemFonts::getFontMap( [&fonts](const std::vector<std::shared_ptr<minikin::FontCollection>>& collections) { for (const auto& fc : collections) { - for (const auto& family : fc->getFamilies()) { - for (uint32_t i = 0; i < family->getNumFonts(); ++i) { - const minikin::Font* font = family->getFont(i); + for (uint32_t i = 0; i < fc->getFamilyCount(); ++i) { + const auto& family = fc->getFamilyAt(i); + for (uint32_t j = 0; j < family->getNumFonts(); ++j) { + const minikin::Font* font = family->getFont(j); std::optional<std::string> locale; uint32_t localeId = font->getLocaleListId(); |