Merge "Remove FontsContract.buildTypeface with weight/italic argument." into oc-dev
am: 2b6bf2f221
Change-Id: I8da2c3c357be33e07733072a5e638a103014190b
This commit is contained in:
@@ -34423,7 +34423,6 @@ package android.provider {
|
||||
}
|
||||
|
||||
public class FontsContract {
|
||||
method public static android.graphics.Typeface buildTypeface(android.content.Context, android.os.CancellationSignal, android.provider.FontsContract.FontInfo[], int, boolean, java.lang.String);
|
||||
method public static android.graphics.Typeface buildTypeface(android.content.Context, android.os.CancellationSignal, android.provider.FontsContract.FontInfo[]);
|
||||
method public static android.provider.FontsContract.FontFamilyResult fetchFonts(android.content.Context, android.os.CancellationSignal, android.provider.FontRequest) throws android.content.pm.PackageManager.NameNotFoundException;
|
||||
method public static void requestFonts(android.content.Context, android.provider.FontRequest, android.os.Handler, android.os.CancellationSignal, android.provider.FontsContract.FontRequestCallback);
|
||||
|
||||
@@ -37414,7 +37414,6 @@ package android.provider {
|
||||
}
|
||||
|
||||
public class FontsContract {
|
||||
method public static android.graphics.Typeface buildTypeface(android.content.Context, android.os.CancellationSignal, android.provider.FontsContract.FontInfo[], int, boolean, java.lang.String);
|
||||
method public static android.graphics.Typeface buildTypeface(android.content.Context, android.os.CancellationSignal, android.provider.FontsContract.FontInfo[]);
|
||||
method public static android.provider.FontsContract.FontFamilyResult fetchFonts(android.content.Context, android.os.CancellationSignal, android.provider.FontRequest) throws android.content.pm.PackageManager.NameNotFoundException;
|
||||
method public static void requestFonts(android.content.Context, android.provider.FontRequest, android.os.Handler, android.os.CancellationSignal, android.provider.FontsContract.FontRequestCallback);
|
||||
|
||||
@@ -34559,7 +34559,6 @@ package android.provider {
|
||||
}
|
||||
|
||||
public class FontsContract {
|
||||
method public static android.graphics.Typeface buildTypeface(android.content.Context, android.os.CancellationSignal, android.provider.FontsContract.FontInfo[], int, boolean, java.lang.String);
|
||||
method public static android.graphics.Typeface buildTypeface(android.content.Context, android.os.CancellationSignal, android.provider.FontsContract.FontInfo[]);
|
||||
method public static android.provider.FontsContract.FontFamilyResult fetchFonts(android.content.Context, android.os.CancellationSignal, android.provider.FontRequest) throws android.content.pm.PackageManager.NameNotFoundException;
|
||||
method public static void requestFonts(android.content.Context, android.provider.FontRequest, android.os.Handler, android.os.CancellationSignal, android.provider.FontsContract.FontRequestCallback);
|
||||
|
||||
@@ -606,43 +606,6 @@ public class FontsContract {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a Typeface from an array of {@link FontInfo}. Results that are marked as not ready
|
||||
* will be skipped.
|
||||
*
|
||||
* @param context A {@link Context} that will be used to fetch the font contents.
|
||||
* @param cancellationSignal A signal to cancel the operation in progress, or null if none. If
|
||||
* the operation is canceled, then {@link
|
||||
* android.os.OperationCanceledException} will be thrown.
|
||||
* @param fonts An array of {@link FontInfo} to be used to create a Typeface.
|
||||
* @param weight A weight value to be used for selecting a font from a font family.
|
||||
* @param italic {@code true} if this font is of italic style. This will be used for font
|
||||
* selection from a font family.
|
||||
* @param fallbackFontName A fallback font name used if this method fails to create the
|
||||
* Typeface. By passing {@code null}, this method returns {@code null}
|
||||
* if typeface creation fails.
|
||||
* @return A Typeface object. May return {@code null} if that is the value passed to {@code
|
||||
* fallBackFontName}.
|
||||
*/
|
||||
public static Typeface buildTypeface(@NonNull Context context,
|
||||
@Nullable CancellationSignal cancellationSignal, @NonNull FontInfo[] fonts,
|
||||
int weight, boolean italic, @Nullable String fallbackFontName) {
|
||||
if (context.isRestricted()) {
|
||||
// TODO: Should we allow if the peer process is system or myself?
|
||||
return null;
|
||||
}
|
||||
final Map<Uri, ByteBuffer> uriBuffer =
|
||||
prepareFontData(context, fonts, cancellationSignal);
|
||||
if (uriBuffer.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return new Typeface.Builder(fonts, uriBuffer)
|
||||
.setFallback(fallbackFontName)
|
||||
.setWeight(weight)
|
||||
.setItalic(italic)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a Typeface from an array of {@link FontInfo}
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user