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

Commit 39ba1b71 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add new API for returning max custom fallback families"

parents b19111e8 e5f73f1c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -14823,6 +14823,7 @@ package android.graphics {
    ctor public Typeface.CustomFallbackBuilder(android.graphics.fonts.FontFamily);
    method public android.graphics.Typeface.CustomFallbackBuilder addCustomFallback(android.graphics.fonts.FontFamily);
    method public android.graphics.Typeface build();
    method public static int getMaxCustomFallbackCount();
    method public android.graphics.Typeface.CustomFallbackBuilder setStyle(android.graphics.fonts.FontStyle);
    method public android.graphics.Typeface.CustomFallbackBuilder setSystemFallback(java.lang.String);
  }
+13 −2
Original line number Diff line number Diff line
@@ -651,6 +651,17 @@ public class Typeface {
        private String mFallbackName = null;
        private @Nullable FontStyle mStyle;

        /**
         * Returns the maximum capacity of custom fallback families.
         *
         * This includes the the first font family passed to the constructor.
         *
         * @return the maximum number of font families for the custom fallback
         */
        public static @IntRange(from = 1) int getMaxCustomFallbackCount() {
            return MAX_CUSTOM_FALLBACK;
        }

        /**
         * Constructs a builder with a font family.
         *
@@ -706,8 +717,8 @@ public class Typeface {
         */
        public CustomFallbackBuilder addCustomFallback(@NonNull FontFamily family) {
            Preconditions.checkNotNull(family);
            Preconditions.checkArgument(mFamilies.size() < MAX_CUSTOM_FALLBACK,
                    "Custom fallback limit exceeded(" + MAX_CUSTOM_FALLBACK + ")");
            Preconditions.checkArgument(mFamilies.size() < getMaxCustomFallbackCount(),
                    "Custom fallback limit exceeded(" + getMaxCustomFallbackCount() + ")");
            mFamilies.add(family);
            return this;
        }