FontRequestCallback

open class FontRequestCallback
kotlin.Any
   ↳ android.provider.FontsContract.FontRequestCallback

Interface used to receive asynchronously fetched typefaces.
Requires API level 26 (Android 8.0, Oreo)

Summary

Constants
static Int

Constant returned by #onTypefaceRequestFailed(int) signaling that the font returned by the provider was not loaded properly.

static Int

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

static Int

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

static Int

Constant returned by #onTypefaceRequestFailed(int) signaling that the given query was not supported by the provider.

static Int

Constant returned by #onTypefaceRequestFailed(int) signaling that the given provider was not found on the device.

static Int

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

Public constructors

Public methods
open Unit

Called then a Typeface request done via #requestFonts is complete.

open Unit

Called when a Typeface request done via #requestFonts} fails.

Constants

FAIL_REASON_FONT_LOAD_ERROR

added in API level 26
static val FAIL_REASON_FONT_LOAD_ERROR: Int

Constant returned by #onTypefaceRequestFailed(int) signaling that the font returned by the provider was not loaded properly.
Requires API level 26 (Android 8.0, Oreo)

Value: -3

FAIL_REASON_FONT_NOT_FOUND

added in API level 26
static val FAIL_REASON_FONT_NOT_FOUND: Int

Constant returned by #onTypefaceRequestFailed(int) signaling that the font provider did not return any results for the given query.
Requires API level 26 (Android 8.0, Oreo)

Value: 1

FAIL_REASON_FONT_UNAVAILABLE

added in API level 26
static val FAIL_REASON_FONT_UNAVAILABLE: Int

Constant returned by #onTypefaceRequestFailed(int) signaling that the font provider found the queried font, but it is currently unavailable.
Requires API level 26 (Android 8.0, Oreo)

Value: 2

FAIL_REASON_MALFORMED_QUERY

added in API level 26
static val FAIL_REASON_MALFORMED_QUERY: Int

Constant returned by #onTypefaceRequestFailed(int) signaling that the given query was not supported by the provider.
Requires API level 26 (Android 8.0, Oreo)

Value: 3

FAIL_REASON_PROVIDER_NOT_FOUND

added in API level 26
static val FAIL_REASON_PROVIDER_NOT_FOUND: Int

Constant returned by #onTypefaceRequestFailed(int) signaling that the given provider was not found on the device.
Requires API level 26 (Android 8.0, Oreo)

Value: -1

FAIL_REASON_WRONG_CERTIFICATES

added in API level 26
static val FAIL_REASON_WRONG_CERTIFICATES: Int

Constant returned by #onTypefaceRequestFailed(int) signaling that the given provider must be authenticated and the given certificates do not match its signature.
Requires API level 26 (Android 8.0, Oreo)

Value: -2

Public constructors

<init>

FontRequestCallback()

Public methods

onTypefaceRetrieved

added in API level 26
open fun onTypefaceRetrieved(typeface: Typeface!): Unit

Called then a Typeface request done via #requestFonts is complete. Note that this method will not be called if #onTypefaceRequestFailed(int) is called instead.
Requires API level 26 (Android 8.0, Oreo)

Parameters
typeface Typeface!: The Typeface object retrieved.

onTypefaceRequestFailed

added in API level 26
open fun onTypefaceRequestFailed(reason: Int): Unit

Called when a Typeface request done via #requestFonts} fails.
Requires API level 26 (Android 8.0, Oreo)

Parameters
reason Int: One of #FAIL_REASON_PROVIDER_NOT_FOUND, #FAIL_REASON_FONT_NOT_FOUND, #FAIL_REASON_FONT_LOAD_ERROR, #FAIL_REASON_FONT_UNAVAILABLE or #FAIL_REASON_MALFORMED_QUERY if returned by the system. May also be a positive value greater than 0 defined by the font provider as an additional error code. Refer to the provider's documentation for more information on possible returned error codes. Value is android.provider.FontsContract.FontRequestCallback#FAIL_REASON_PROVIDER_NOT_FOUND, android.provider.FontsContract.FontRequestCallback#FAIL_REASON_FONT_LOAD_ERROR, android.provider.FontsContract.FontRequestCallback#FAIL_REASON_FONT_NOT_FOUND, android.provider.FontsContract.FontRequestCallback#FAIL_REASON_FONT_UNAVAILABLE, or android.provider.FontsContract.FontRequestCallback#FAIL_REASON_MALFORMED_QUERY