Skip to content
This repository was archived by the owner on Jul 10, 2025. It is now read-only.
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@ object FontRequester {

fun registerFont(context: Context, @FontRes fontRes: Int, fallback: Typeface) {
// Set the font to the fallback right away in case it's requested before getFont completes.
fontMap[fontRes] = fallback
try {
ResourcesCompat.getFont(context, fontRes, fontCallbackFor(context, fontRes), null)
} catch (e: NotFoundException) {
Log.e(TAG, "Font ${context.resources.getResourceEntryName(fontRes)} not found")
if (fontMap[fontRes] == null) {
fontMap[fontRes] = fallback
}
if (fontMap[fontRes] == fallback) {
try {
ResourcesCompat.getFont(context, fontRes, fontCallbackFor(context, fontRes), null)
} catch (e: NotFoundException) {
Log.e(TAG, "Font ${context.resources.getResourceEntryName(fontRes)} not found")
}
}
}

Expand Down