Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 146c6a93 authored by Kohsuke Yatoh's avatar Kohsuke Yatoh
Browse files

Replace getFamilies() with getFamilyAt().

Following minikin signature change.

Bug: 174672300
Test: m libhwui
Test: m libandroid
Change-Id: I25c5d27c406f49b5ee91a7f4390484296d4a6c7f
parent ff3ab034
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -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)));
}

+4 −3
Original line number Diff line number Diff line
@@ -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();