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

Commit 6df71c76 authored by Raph Levien's avatar Raph Levien Committed by Android (Google) Code Review
Browse files

Merge "Fix native crash when typeface is missing"

parents c813dbbf 27bb05f2
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -146,10 +146,14 @@ TypefaceImpl* TypefaceImpl_createFromFamilies(const jlong* families, size_t size
        const FontStyle defaultStyle;
        FontFamily* firstFamily = reinterpret_cast<FontFamily*>(families[0]);
        MinikinFont* mf = firstFamily->getClosestMatch(defaultStyle).font;
        if (mf != NULL) {
            SkTypeface* skTypeface = reinterpret_cast<MinikinFontSkia*>(mf)->GetSkTypeface();
            // TODO: probably better to query more precise style from family, will be important
            // when we open up API to access 100..900 weights
            result->fStyle = styleFromSkiaStyle(skTypeface->style());
        } else {
            result->fStyle = defaultStyle;
        }
    }
    return result;
}