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

Commit bb53b4d9 authored by Kohsuke Yatoh's avatar Kohsuke Yatoh
Browse files

Use FontFamily/FontCollection::create() in hwui.

Minikin will hide FontFamily/FontCollection constructors.
This CL updates hwui to use create() instead.

Bug: 174672300
Test: m -j
Change-Id: Ie910b0d7608df681443f862aa67d402809c38514
parent 3e348ff7
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -127,7 +127,7 @@ Typeface* Typeface::createWithDifferentBaseWeight(Typeface* src, int weight) {
Typeface* Typeface::createFromFamilies(std::vector<std::shared_ptr<minikin::FontFamily>>&& families,
                                       int weight, int italic) {
    Typeface* result = new Typeface;
    result->fFontCollection.reset(new minikin::FontCollection(families));
    result->fFontCollection = minikin::FontCollection::create(families);

    if (weight == RESOLVE_BY_FONT_TABLE || italic == RESOLVE_BY_FONT_TABLE) {
        int weightFromFont;
@@ -191,8 +191,8 @@ void Typeface::setRobotoTypefaceForTest() {
    std::vector<std::shared_ptr<minikin::Font>> fonts;
    fonts.push_back(minikin::Font::Builder(font).build());

    std::shared_ptr<minikin::FontCollection> collection = std::make_shared<minikin::FontCollection>(
            std::make_shared<minikin::FontFamily>(std::move(fonts)));
    std::shared_ptr<minikin::FontCollection> collection =
            minikin::FontCollection::create(minikin::FontFamily::create(std::move(fonts)));

    Typeface* hwTypeface = new Typeface();
    hwTypeface->fFontCollection = collection;
+3 −3
Original line number Diff line number Diff line
@@ -85,9 +85,9 @@ static jlong FontFamily_create(CRITICAL_JNI_PARAMS_COMMA jlong builderPtr) {
    if (builder->fonts.empty()) {
        return 0;
    }
    std::shared_ptr<minikin::FontFamily> family = std::make_shared<minikin::FontFamily>(
            builder->langId, builder->variant, std::move(builder->fonts),
            true /* isCustomFallback */);
    std::shared_ptr<minikin::FontFamily> family =
            minikin::FontFamily::create(builder->langId, builder->variant,
                                        std::move(builder->fonts), true /* isCustomFallback */);
    if (family->getCoverage().length() == 0) {
        return 0;
    }
+3 −3
Original line number Diff line number Diff line
@@ -66,9 +66,9 @@ static jlong FontFamily_Builder_build(JNIEnv* env, jobject clazz, jlong builderP
        ScopedUtfChars str(env, langTags);
        localeId = minikin::registerLocaleList(str.c_str());
    }
    std::shared_ptr<minikin::FontFamily> family = std::make_shared<minikin::FontFamily>(
            localeId, static_cast<minikin::FamilyVariant>(variant), std::move(builder->fonts),
            isCustomFallback);
    std::shared_ptr<minikin::FontFamily> family =
            minikin::FontFamily::create(localeId, static_cast<minikin::FamilyVariant>(variant),
                                        std::move(builder->fonts), isCustomFallback);
    if (family->getCoverage().length() == 0) {
        // No coverage means minikin rejected given font for some reasons.
        jniThrowException(env, "java/lang/IllegalArgumentException",
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ std::shared_ptr<minikin::FontFamily> buildFamily(const char* fileName) {
                                              std::vector<minikin::FontVariation>());
    std::vector<std::shared_ptr<minikin::Font>> fonts;
    fonts.push_back(minikin::Font::Builder(font).build());
    return std::make_shared<minikin::FontFamily>(std::move(fonts));
    return minikin::FontFamily::create(std::move(fonts));
}

std::vector<std::shared_ptr<minikin::FontFamily>> makeSingleFamlyVector(const char* fileName) {