Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -13829,6 +13829,7 @@ package android.graphics { public class Typeface { method public static android.graphics.Typeface create(java.lang.String, int); method public static android.graphics.Typeface create(android.graphics.Typeface, int); method public static android.graphics.Typeface create(android.graphics.Typeface, int, boolean); method public static android.graphics.Typeface createFromAsset(android.content.res.AssetManager, java.lang.String); method public static android.graphics.Typeface createFromFile(java.io.File); method public static android.graphics.Typeface createFromFile(java.lang.String); api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -14627,6 +14627,7 @@ package android.graphics { public class Typeface { method public static android.graphics.Typeface create(java.lang.String, int); method public static android.graphics.Typeface create(android.graphics.Typeface, int); method public static android.graphics.Typeface create(android.graphics.Typeface, int, boolean); method public static android.graphics.Typeface createFromAsset(android.content.res.AssetManager, java.lang.String); method public static android.graphics.Typeface createFromFile(java.io.File); method public static android.graphics.Typeface createFromFile(java.lang.String); api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -13898,6 +13898,7 @@ package android.graphics { public class Typeface { method public static android.graphics.Typeface create(java.lang.String, int); method public static android.graphics.Typeface create(android.graphics.Typeface, int); method public static android.graphics.Typeface create(android.graphics.Typeface, int, boolean); method public static android.graphics.Typeface createFromAsset(android.content.res.AssetManager, java.lang.String); method public static android.graphics.Typeface createFromFile(java.io.File); method public static android.graphics.Typeface createFromFile(java.lang.String); graphics/java/android/graphics/Typeface.java +50 −24 Original line number Diff line number Diff line Loading @@ -548,29 +548,7 @@ public class Typeface { final int weight = (mWeight == RESOLVE_BY_FONT_TABLE) ? base.mWeight : mWeight; final boolean italic = (mItalic == RESOLVE_BY_FONT_TABLE) ? (base.mStyle & ITALIC) != 0 : mItalic == 1; final int key = weight << 1 | (italic ? 1 : 0); Typeface typeface; synchronized(sLock) { SparseArray<Typeface> innerCache = sTypefaceCache.get(base.native_instance); if (innerCache != null) { typeface = innerCache.get(key); if (typeface != null) { return typeface; } } typeface = new Typeface( nativeCreateFromTypefaceWithExactStyle( base.native_instance, weight, italic)); if (innerCache == null) { innerCache = new SparseArray<>(4); // [regular, bold] x [upright, italic] sTypefaceCache.put(base.native_instance, innerCache); } innerCache.put(key, typeface); } return typeface; return createWeightStyle(base, weight, italic); } /** Loading Loading @@ -688,7 +666,8 @@ public class Typeface { * style from the same family of an existing typeface object. If family is * null, this selects from the default font's family. * * @param family May be null. The name of the existing type face. * @param family An existing {@link Typeface} object. In case of {@code null}, the default * typeface is used instead. * @param style The style (normal, bold, italic) of the typeface. * e.g. NORMAL, BOLD, ITALIC, BOLD_ITALIC * @return The best matching typeface. Loading Loading @@ -727,6 +706,53 @@ public class Typeface { return typeface; } /** * Creates a typeface object that best matches the specified existing typeface and the specified * weight and italic style * * @param family An existing {@link Typeface} object. In case of {@code null}, the default * typeface is used instead. * @param weight The desired weight to be drawn. * @param italic {@code true} if italic style is desired to be drawn. Otherwise, {@code false} * @return A {@link Typeface} object for drawing specified weight and italic style. Never * returns {@code null} */ public static @NonNull Typeface create(@Nullable Typeface family, @IntRange(from = 1, to = 1000) int weight, boolean italic) { Preconditions.checkArgumentInRange(weight, 0, 1000, "weight"); if (family == null) { family = sDefaultTypeface; } return createWeightStyle(family, weight, italic); } private static @NonNull Typeface createWeightStyle(@NonNull Typeface base, @IntRange(from = 1, to = 1000) int weight, boolean italic) { final int key = weight << 1 | (italic ? 1 : 0); Typeface typeface; synchronized(sLock) { SparseArray<Typeface> innerCache = sTypefaceCache.get(base.native_instance); if (innerCache != null) { typeface = innerCache.get(key); if (typeface != null) { return typeface; } } typeface = new Typeface( nativeCreateFromTypefaceWithExactStyle( base.native_instance, weight, italic)); if (innerCache == null) { innerCache = new SparseArray<>(4); // [regular, bold] x [upright, italic] sTypefaceCache.put(base.native_instance, innerCache); } innerCache.put(key, typeface); } return typeface; } /** @hide */ public static Typeface createFromTypefaceWithVariation(@Nullable Typeface family, @NonNull List<FontVariationAxis> axes) { Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -13829,6 +13829,7 @@ package android.graphics { public class Typeface { method public static android.graphics.Typeface create(java.lang.String, int); method public static android.graphics.Typeface create(android.graphics.Typeface, int); method public static android.graphics.Typeface create(android.graphics.Typeface, int, boolean); method public static android.graphics.Typeface createFromAsset(android.content.res.AssetManager, java.lang.String); method public static android.graphics.Typeface createFromFile(java.io.File); method public static android.graphics.Typeface createFromFile(java.lang.String);
api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -14627,6 +14627,7 @@ package android.graphics { public class Typeface { method public static android.graphics.Typeface create(java.lang.String, int); method public static android.graphics.Typeface create(android.graphics.Typeface, int); method public static android.graphics.Typeface create(android.graphics.Typeface, int, boolean); method public static android.graphics.Typeface createFromAsset(android.content.res.AssetManager, java.lang.String); method public static android.graphics.Typeface createFromFile(java.io.File); method public static android.graphics.Typeface createFromFile(java.lang.String);
api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -13898,6 +13898,7 @@ package android.graphics { public class Typeface { method public static android.graphics.Typeface create(java.lang.String, int); method public static android.graphics.Typeface create(android.graphics.Typeface, int); method public static android.graphics.Typeface create(android.graphics.Typeface, int, boolean); method public static android.graphics.Typeface createFromAsset(android.content.res.AssetManager, java.lang.String); method public static android.graphics.Typeface createFromFile(java.io.File); method public static android.graphics.Typeface createFromFile(java.lang.String);
graphics/java/android/graphics/Typeface.java +50 −24 Original line number Diff line number Diff line Loading @@ -548,29 +548,7 @@ public class Typeface { final int weight = (mWeight == RESOLVE_BY_FONT_TABLE) ? base.mWeight : mWeight; final boolean italic = (mItalic == RESOLVE_BY_FONT_TABLE) ? (base.mStyle & ITALIC) != 0 : mItalic == 1; final int key = weight << 1 | (italic ? 1 : 0); Typeface typeface; synchronized(sLock) { SparseArray<Typeface> innerCache = sTypefaceCache.get(base.native_instance); if (innerCache != null) { typeface = innerCache.get(key); if (typeface != null) { return typeface; } } typeface = new Typeface( nativeCreateFromTypefaceWithExactStyle( base.native_instance, weight, italic)); if (innerCache == null) { innerCache = new SparseArray<>(4); // [regular, bold] x [upright, italic] sTypefaceCache.put(base.native_instance, innerCache); } innerCache.put(key, typeface); } return typeface; return createWeightStyle(base, weight, italic); } /** Loading Loading @@ -688,7 +666,8 @@ public class Typeface { * style from the same family of an existing typeface object. If family is * null, this selects from the default font's family. * * @param family May be null. The name of the existing type face. * @param family An existing {@link Typeface} object. In case of {@code null}, the default * typeface is used instead. * @param style The style (normal, bold, italic) of the typeface. * e.g. NORMAL, BOLD, ITALIC, BOLD_ITALIC * @return The best matching typeface. Loading Loading @@ -727,6 +706,53 @@ public class Typeface { return typeface; } /** * Creates a typeface object that best matches the specified existing typeface and the specified * weight and italic style * * @param family An existing {@link Typeface} object. In case of {@code null}, the default * typeface is used instead. * @param weight The desired weight to be drawn. * @param italic {@code true} if italic style is desired to be drawn. Otherwise, {@code false} * @return A {@link Typeface} object for drawing specified weight and italic style. Never * returns {@code null} */ public static @NonNull Typeface create(@Nullable Typeface family, @IntRange(from = 1, to = 1000) int weight, boolean italic) { Preconditions.checkArgumentInRange(weight, 0, 1000, "weight"); if (family == null) { family = sDefaultTypeface; } return createWeightStyle(family, weight, italic); } private static @NonNull Typeface createWeightStyle(@NonNull Typeface base, @IntRange(from = 1, to = 1000) int weight, boolean italic) { final int key = weight << 1 | (italic ? 1 : 0); Typeface typeface; synchronized(sLock) { SparseArray<Typeface> innerCache = sTypefaceCache.get(base.native_instance); if (innerCache != null) { typeface = innerCache.get(key); if (typeface != null) { return typeface; } } typeface = new Typeface( nativeCreateFromTypefaceWithExactStyle( base.native_instance, weight, italic)); if (innerCache == null) { innerCache = new SparseArray<>(4); // [regular, bold] x [upright, italic] sTypefaceCache.put(base.native_instance, innerCache); } innerCache.put(key, typeface); } return typeface; } /** @hide */ public static Typeface createFromTypefaceWithVariation(@Nullable Typeface family, @NonNull List<FontVariationAxis> axes) { Loading