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

Commit 9d04f3ee authored by Seigo Nonaka's avatar Seigo Nonaka
Browse files

Remove mFamilies from Typeface

mFamilies was added for itemize API but it won't happen in this
release, so removing unused member from Typeface.

Bug: 120177351
Test: TreeHugger
Change-Id: Iee0e381b28aa42daba1621084ce5a9d1a8753cd5
parent ce871128
Loading
Loading
Loading
Loading
+6 −29
Original line number Diff line number Diff line
@@ -163,9 +163,6 @@ public class Typeface {
    private int[] mSupportedAxes;
    private static final int[] EMPTY_AXES = {};

    // The underlying font families.
    private final FontFamily[] mFamilies;

    @UnsupportedAppUsage
    private static void setDefault(Typeface t) {
        sDefaultTypeface = t;
@@ -731,21 +728,17 @@ public class Typeface {
        public Typeface build() {
            final int userFallbackSize = mFamilies.size();
            final FontFamily[] fallback = SystemFonts.getSystemFallback(mFallbackName);
            final FontFamily[] fullFamilies = new FontFamily[fallback.length + userFallbackSize];
            final long[] ptrArray = new long[fallback.length + userFallbackSize];
            for (int i = 0; i < userFallbackSize; ++i) {
                ptrArray[i] = mFamilies.get(i).getNativePtr();
                fullFamilies[i] = mFamilies.get(i);
            }
            for (int i = 0; i < fallback.length; ++i) {
                ptrArray[i + userFallbackSize] = fallback[i].getNativePtr();
                fullFamilies[i + userFallbackSize] = fallback[i];
            }
            final int weight = mStyle == null ? 400 : mStyle.getWeight();
            final int italic =
                    (mStyle == null || mStyle.getSlant() == FontStyle.FONT_SLANT_UPRIGHT) ?  0 : 1;

            return new Typeface(nativeCreateFromArray(ptrArray, weight, italic), fullFamilies);
            return new Typeface(nativeCreateFromArray(ptrArray, weight, italic));
        }
    }

@@ -810,7 +803,7 @@ public class Typeface {
                }
            }

            typeface = new Typeface(nativeCreateFromTypeface(ni, style), family.mFamilies);
            typeface = new Typeface(nativeCreateFromTypeface(ni, style));
            styles.put(style, typeface);
        }
        return typeface;
@@ -878,8 +871,7 @@ public class Typeface {
            }

            typeface = new Typeface(
                    nativeCreateFromTypefaceWithExactStyle(
                            base.native_instance, weight, italic), base.mFamilies);
                    nativeCreateFromTypefaceWithExactStyle(base.native_instance, weight, italic));
            innerCache.put(key, typeface);
        }
        return typeface;
@@ -889,8 +881,7 @@ public class Typeface {
    public static Typeface createFromTypefaceWithVariation(@Nullable Typeface family,
            @NonNull List<FontVariationAxis> axes) {
        final Typeface base = family == null ? Typeface.DEFAULT : family;
        return new Typeface(nativeCreateFromTypefaceWithVariation(base.native_instance, axes),
                base.mFamilies);
        return new Typeface(nativeCreateFromTypefaceWithVariation(base.native_instance, axes));
    }

    /**
@@ -996,7 +987,7 @@ public class Typeface {
            ptrArray[i] = families[i].getNativePtr();
        }
        return new Typeface(nativeCreateFromArray(ptrArray,
                  RESOLVE_BY_FONT_TABLE, RESOLVE_BY_FONT_TABLE), families);
                  RESOLVE_BY_FONT_TABLE, RESOLVE_BY_FONT_TABLE));
    }

    /**
@@ -1044,19 +1035,6 @@ public class Typeface {
        }

        native_instance = ni;
        mFamilies = new FontFamily[0];
        sRegistry.registerNativeAllocation(this, native_instance);
        mStyle = nativeGetStyle(ni);
        mWeight = nativeGetWeight(ni);
    }

    private Typeface(long ni, @NonNull FontFamily[] families) {
        if (ni == 0) {
            throw new IllegalStateException("native typeface cannot be made");
        }

        native_instance = ni;
        mFamilies = families;
        sRegistry.registerNativeAllocation(this, native_instance);
        mStyle = nativeGetStyle(ni);
        mWeight = nativeGetWeight(ni);
@@ -1083,8 +1061,7 @@ public class Typeface {
            final Typeface base = systemFontMap.get(alias.getToName());
            final int weight = alias.getWeight();
            final Typeface newFace = weight == 400 ? base :
                    new Typeface(nativeCreateWeightAlias(base.native_instance, weight),
                            base.mFamilies);
                    new Typeface(nativeCreateWeightAlias(base.native_instance, weight));
            systemFontMap.put(alias.getName(), newFace);
        }
    }