From efd42131e7aac98947a6269c0fe573c785f9f41e Mon Sep 17 00:00:00 2001 From: jmir1 Date: Thu, 2 Nov 2023 22:24:24 +0100 Subject: [PATCH] fix(font settings): Prevent showing multiple fonts of the same family name --- .../player/settings/sheets/subtitle/SubtitleFontPage.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/sheets/subtitle/SubtitleFontPage.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/sheets/subtitle/SubtitleFontPage.kt index a2e75965fa..66e99199a3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/sheets/subtitle/SubtitleFontPage.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/sheets/subtitle/SubtitleFontPage.kt @@ -94,10 +94,10 @@ private fun SubtitleFont( ).listFiles { file -> file.extension.equals("ttf", true) || file.extension.equals("otf", true) - }?.map { + }?.associate { TTFFile.open(it).families.values.toTypedArray()[0] to it.absolutePath - } ?: emptyList() - listOf("Sans Serif" to "") + customFonts + } ?: emptyMap() + mapOf("Sans Serif" to ("" to null)) + customFonts } } var selectingFont by remember { mutableStateOf(false) } @@ -152,7 +152,7 @@ private fun SubtitleFont( DropdownMenu(expanded = selectingFont, onDismissRequest = { selectingFont = false }) { fontList.map { - val fontName = it.first + val fontName = it.key DropdownMenuItem( text = { Text(fontName) }, onClick = { updateFont(fontName) },