FontsContractCompat.FontRequestCallback

Added in 1.1.0

public class FontsContractCompat.FontRequestCallback


Interface used to receive asynchronously fetched typefaces.

Summary

Constants

static final int

Constant returned by onTypefaceRequestFailed signaling that the font returned by the provider was not loaded properly.

static final int

Constant returned by onTypefaceRequestFailed signaling that the font provider did not return any results for the given query.

static final int

Constant returned by onTypefaceRequestFailed signaling that the font provider found the queried font, but it is currently unavailable.

static final int

Constant returned by onTypefaceRequestFailed signaling that the given query was not supported by the provider.

static final int

Constant returned by onTypefaceRequestFailed signaling that the given provider was not found on the device.

static final int

Constant that signals that the font was not loaded due to security issues.

static final int

Constant returned by onTypefaceRequestFailed signaling that the given provider must be authenticated and the given certificates do not match its signature.

Public constructors

Public methods

void

Called when a Typeface request done via requestFont fails.

void

Called then a Typeface request done via requestFont is complete.

Constants

FAIL_REASON_FONT_LOAD_ERROR

Added in 1.1.0
public static final int FAIL_REASON_FONT_LOAD_ERROR = -3

Constant returned by onTypefaceRequestFailed signaling that the font returned by the provider was not loaded properly.

FAIL_REASON_FONT_NOT_FOUND

Added in 1.1.0
public static final int FAIL_REASON_FONT_NOT_FOUND = 1

Constant returned by onTypefaceRequestFailed signaling that the font provider did not return any results for the given query.

FAIL_REASON_FONT_UNAVAILABLE

Added in 1.1.0
public static final int FAIL_REASON_FONT_UNAVAILABLE = 2

Constant returned by onTypefaceRequestFailed signaling that the font provider found the queried font, but it is currently unavailable.

FAIL_REASON_MALFORMED_QUERY

Added in 1.1.0
public static final int FAIL_REASON_MALFORMED_QUERY = 3

Constant returned by onTypefaceRequestFailed signaling that the given query was not supported by the provider.

FAIL_REASON_PROVIDER_NOT_FOUND

Added in 1.1.0
public static final int FAIL_REASON_PROVIDER_NOT_FOUND = -1

Constant returned by onTypefaceRequestFailed signaling that the given provider was not found on the device.

FAIL_REASON_SECURITY_VIOLATION

Added in 1.1.0
public static final int FAIL_REASON_SECURITY_VIOLATION = -4

Constant that signals that the font was not loaded due to security issues. This usually means the font was attempted to load on a restricted context.

FAIL_REASON_WRONG_CERTIFICATES

Added in 1.1.0
public static final int FAIL_REASON_WRONG_CERTIFICATES = -2

Constant returned by onTypefaceRequestFailed signaling that the given provider must be authenticated and the given certificates do not match its signature.

Public constructors

FontRequestCallback

Added in 1.1.0
public FontRequestCallback()

Public methods

onTypefaceRequestFailed

Added in 1.1.0
public void onTypefaceRequestFailed(int reason)

Called when a Typeface request done via requestFont fails.

onTypefaceRetrieved

Added in 1.1.0
public void onTypefaceRetrieved(Typeface typeface)

Called then a Typeface request done via requestFont is complete. Note that this method will not be called if onTypefaceRequestFailed is called instead.

Parameters
Typeface typeface

The Typeface object retrieved.