diff --git a/app-wear-shared/shared/src/main/java/info/nightscout/rx/weardata/CustomWatchfaceFormat.kt b/app-wear-shared/shared/src/main/java/info/nightscout/rx/weardata/CustomWatchfaceFormat.kt index 4be5b5e5a5..010c9ca095 100644 --- a/app-wear-shared/shared/src/main/java/info/nightscout/rx/weardata/CustomWatchfaceFormat.kt +++ b/app-wear-shared/shared/src/main/java/info/nightscout/rx/weardata/CustomWatchfaceFormat.kt @@ -63,7 +63,8 @@ enum class ResFormat(val extension: String) { SVG("svg"), JPG("jpg"), PNG("png"), - TTF("ttf"); + TTF("ttf"), + OTF("otf"); companion object { @@ -102,7 +103,7 @@ data class ResData(val value: ByteArray, val format: ResFormat) { fun toTypeface(): Typeface? { try { return when (format) { - ResFormat.TTF -> { + ResFormat.TTF, ResFormat.OTF -> { // Workaround with temporary File, Typeface.createFromFileDescriptor(null, value, 0, value.size) more simple not available File.createTempFile("temp", format.extension).let { tempFile -> FileOutputStream(tempFile).let { fileOutputStream -> diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/CustomWatchface.kt b/wear/src/main/java/info/nightscout/androidaps/watchfaces/CustomWatchface.kt index ca92b2c254..e82642e0a1 100644 --- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/CustomWatchface.kt +++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/CustomWatchface.kt @@ -554,7 +554,7 @@ private enum class FontMap(val key: String, var font: Typeface, @FontRes val fon } ?: fontMap.font } resDataMap.filter { (_, resData) -> - resData.format == ResFormat.TTF + resData.format == ResFormat.TTF || resData.format == ResFormat.OTF }.forEach { (key, resData) -> customFonts[key.lowercase()] = resData.toTypeface() ?:Typeface.DEFAULT }