mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 15:50:16 +02:00
Revert back to mpv-android's font
This commit is contained in:
parent
bbeb1c0488
commit
a6d5a0ba4c
4 changed files with 17 additions and 26 deletions
BIN
app/src/main/assets/subfont.ttf
Normal file
BIN
app/src/main/assets/subfont.ttf
Normal file
Binary file not shown.
|
|
@ -281,11 +281,11 @@ object SubtitleSettings {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fontBold) {
|
// if (fontBold) {
|
||||||
MPVLib.setPropertyString("sub-font", "Roboto Bold")
|
// MPVLib.setPropertyString("sub-font", "Roboto Bold")
|
||||||
} else {
|
// } else {
|
||||||
MPVLib.setPropertyString("sub-font", "Roboto Regular")
|
// MPVLib.setPropertyString("sub-font", "Roboto Regular")
|
||||||
}
|
// }
|
||||||
MPVLib.setPropertyBoolean("sub-bold", fontBold)
|
MPVLib.setPropertyBoolean("sub-bold", fontBold)
|
||||||
MPVLib.setPropertyBoolean("sub-italic", fontItalic)
|
MPVLib.setPropertyBoolean("sub-italic", fontItalic)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,28 +63,20 @@ class AppUpgradeHandler
|
||||||
|
|
||||||
fun copySubfont(overwrite: Boolean) {
|
fun copySubfont(overwrite: Boolean) {
|
||||||
try {
|
try {
|
||||||
listOf("Roboto-Regular", "Roboto-Bold")
|
val fontFileName = "subfont.ttf"
|
||||||
.forEach { font ->
|
val outputFile = File(context.filesDir, fontFileName)
|
||||||
val fontFileName = "font-roboto/$font.ttf"
|
if (!outputFile.exists() || overwrite) {
|
||||||
val outputDir = File(context.filesDir, "fonts")
|
context.assets.open(fontFileName).use { input ->
|
||||||
if (!outputDir.exists()) {
|
outputFile.outputStream().use { output ->
|
||||||
outputDir.mkdir()
|
input.copyTo(output)
|
||||||
}
|
|
||||||
val outputFile = File(outputDir, "$font.ttf")
|
|
||||||
if (!outputFile.exists() || overwrite) {
|
|
||||||
context.assets.open(fontFileName).use { input ->
|
|
||||||
outputFile.outputStream().use { output ->
|
|
||||||
input.copyTo(output)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Timber.i("Wrote font %s to local", fontFileName)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val oldFont = File(context.filesDir, "subfont.ttf")
|
Timber.i("Wrote font %s to local", fontFileName)
|
||||||
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) {
|
} catch (ex: Exception) {
|
||||||
Timber.e(ex, "Exception copying subfont.tff")
|
Timber.e(ex, "Exception copying subfont.tff")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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_PLAYBACK_RESTART
|
||||||
import com.github.damontecres.wholphin.util.mpv.MPVLib.MpvEvent.MPV_EVENT_VIDEO_RECONFIG
|
import com.github.damontecres.wholphin.util.mpv.MPVLib.MpvEvent.MPV_EVENT_VIDEO_RECONFIG
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.io.File
|
|
||||||
import kotlin.concurrent.atomics.ExperimentalAtomicApi
|
import kotlin.concurrent.atomics.ExperimentalAtomicApi
|
||||||
import kotlin.time.Duration.Companion.seconds
|
import kotlin.time.Duration.Companion.seconds
|
||||||
|
|
||||||
|
|
@ -114,7 +113,7 @@ class MpvPlayer(
|
||||||
|
|
||||||
MPVLib.setOptionString("force-window", "no")
|
MPVLib.setOptionString("force-window", "no")
|
||||||
MPVLib.setOptionString("idle", "yes")
|
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)
|
MPVLib.addObserver(this)
|
||||||
MPVProperty.observedProperties.forEach(MPVLib::observeProperty)
|
MPVProperty.observedProperties.forEach(MPVLib::observeProperty)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue