Revert back to mpv-android's font

This commit is contained in:
Damontecres 2025-11-13 13:10:52 -05:00
parent bbeb1c0488
commit a6d5a0ba4c
No known key found for this signature in database
4 changed files with 17 additions and 26 deletions

Binary file not shown.

View file

@ -281,11 +281,11 @@ object SubtitleSettings {
}
}
if (fontBold) {
MPVLib.setPropertyString("sub-font", "Roboto Bold")
} else {
MPVLib.setPropertyString("sub-font", "Roboto Regular")
}
// if (fontBold) {
// MPVLib.setPropertyString("sub-font", "Roboto Bold")
// } else {
// MPVLib.setPropertyString("sub-font", "Roboto Regular")
// }
MPVLib.setPropertyBoolean("sub-bold", fontBold)
MPVLib.setPropertyBoolean("sub-italic", fontItalic)

View file

@ -63,14 +63,8 @@ class AppUpgradeHandler
fun copySubfont(overwrite: Boolean) {
try {
listOf("Roboto-Regular", "Roboto-Bold")
.forEach { font ->
val fontFileName = "font-roboto/$font.ttf"
val outputDir = File(context.filesDir, "fonts")
if (!outputDir.exists()) {
outputDir.mkdir()
}
val outputFile = File(outputDir, "$font.ttf")
val fontFileName = "subfont.ttf"
val outputFile = File(context.filesDir, fontFileName)
if (!outputFile.exists() || overwrite) {
context.assets.open(fontFileName).use { input ->
outputFile.outputStream().use { output ->
@ -79,12 +73,10 @@ class AppUpgradeHandler
}
Timber.i("Wrote font %s to local", fontFileName)
}
}
val oldFont = File(context.filesDir, "subfont.ttf")
if (oldFont.exists()) {
Timber.w("Old subfont.tff exists, will delete it")
oldFont.delete()
}
// val oldFontDir = File(context.filesDir, "fonts")
// if (oldFontDir.exists()) {
// oldFontDir.deleteRecursively()
// }
} catch (ex: Exception) {
Timber.e(ex, "Exception copying subfont.tff")
}

View file

@ -44,7 +44,6 @@ import com.github.damontecres.wholphin.util.mpv.MPVLib.MpvEvent.MPV_EVENT_FILE_L
import com.github.damontecres.wholphin.util.mpv.MPVLib.MpvEvent.MPV_EVENT_PLAYBACK_RESTART
import com.github.damontecres.wholphin.util.mpv.MPVLib.MpvEvent.MPV_EVENT_VIDEO_RECONFIG
import timber.log.Timber
import java.io.File
import kotlin.concurrent.atomics.ExperimentalAtomicApi
import kotlin.time.Duration.Companion.seconds
@ -114,7 +113,7 @@ class MpvPlayer(
MPVLib.setOptionString("force-window", "no")
MPVLib.setOptionString("idle", "yes")
MPVLib.setOptionString("sub-fonts-dir", File(context.filesDir, "fonts").absolutePath)
// MPVLib.setOptionString("sub-fonts-dir", File(context.filesDir, "fonts").absolutePath)
MPVLib.addObserver(this)
MPVProperty.observedProperties.forEach(MPVLib::observeProperty)