mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-09 15:29:32 +07:00
4.5.0-patch2
Lazy loading of system fonts so startup is fast
This commit is contained in:
@ -20,13 +20,14 @@ import kotlin.math.abs
|
||||
|
||||
class FontAndroid : FontImplementation {
|
||||
|
||||
private val fontList: HashSet<Font> = hashSetOf()
|
||||
private val fontList by lazy {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) emptySet()
|
||||
else SystemFonts.getAvailableFonts()
|
||||
}
|
||||
private val paint: Paint = Paint()
|
||||
private var currentFontFamily: String? = null
|
||||
|
||||
init {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||
fontList.addAll(SystemFonts.getAvailableFonts())
|
||||
paint.isAntiAlias = true
|
||||
paint.strokeWidth = 0f
|
||||
paint.setARGB(255, 255, 255, 255)
|
||||
@ -49,7 +50,6 @@ class FontAndroid : FontImplementation {
|
||||
else
|
||||
{
|
||||
paint.typeface = createTypefaceSystem(fontFamilyData.invariantName)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user