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 Original line Diff line number Diff line
@@ -163,9 +163,6 @@ public class Typeface {
    private int[] mSupportedAxes;
    private int[] mSupportedAxes;
    private static final int[] EMPTY_AXES = {};
    private static final int[] EMPTY_AXES = {};


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

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

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


@@ -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);
            styles.put(style, typeface);
        }
        }
        return typeface;
        return typeface;
@@ -878,8 +871,7 @@ public class Typeface {
            }
            }


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


    /**
    /**
@@ -996,7 +987,7 @@ public class Typeface {
            ptrArray[i] = families[i].getNativePtr();
            ptrArray[i] = families[i].getNativePtr();
        }
        }
        return new Typeface(nativeCreateFromArray(ptrArray,
        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;
        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);
        sRegistry.registerNativeAllocation(this, native_instance);
        mStyle = nativeGetStyle(ni);
        mStyle = nativeGetStyle(ni);
        mWeight = nativeGetWeight(ni);
        mWeight = nativeGetWeight(ni);
@@ -1083,8 +1061,7 @@ public class Typeface {
            final Typeface base = systemFontMap.get(alias.getToName());
            final Typeface base = systemFontMap.get(alias.getToName());
            final int weight = alias.getWeight();
            final int weight = alias.getWeight();
            final Typeface newFace = weight == 400 ? base :
            final Typeface newFace = weight == 400 ? base :
                    new Typeface(nativeCreateWeightAlias(base.native_instance, weight),
                    new Typeface(nativeCreateWeightAlias(base.native_instance, weight));
                            base.mFamilies);
            systemFontMap.put(alias.getName(), newFace);
            systemFontMap.put(alias.getName(), newFace);
        }
        }
    }
    }