From b4314f5f0bfa869d6482ff44b0f0c1837ba67596 Mon Sep 17 00:00:00 2001 From: Chopper <156493704+choppeh@users.noreply.github.com> Date: Fri, 3 Jan 2025 04:55:55 -0300 Subject: [PATCH] Snowmtl: Use pt as fontsize (#6954) * Use pt as fontsize * Add comment --- src/all/snowmtl/build.gradle | 2 +- .../all/snowmtl/interceptors/ComposedImageInterceptor.kt | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/all/snowmtl/build.gradle b/src/all/snowmtl/build.gradle index cda296731..edb782da6 100644 --- a/src/all/snowmtl/build.gradle +++ b/src/all/snowmtl/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'Snow Machine Translations' extClass = '.SnowmtlFactory' - extVersionCode = 5 + extVersionCode = 6 isNsfw = true } diff --git a/src/all/snowmtl/src/eu/kanade/tachiyomi/extension/all/snowmtl/interceptors/ComposedImageInterceptor.kt b/src/all/snowmtl/src/eu/kanade/tachiyomi/extension/all/snowmtl/interceptors/ComposedImageInterceptor.kt index db6fd06bd..cf581282d 100644 --- a/src/all/snowmtl/src/eu/kanade/tachiyomi/extension/all/snowmtl/interceptors/ComposedImageInterceptor.kt +++ b/src/all/snowmtl/src/eu/kanade/tachiyomi/extension/all/snowmtl/interceptors/ComposedImageInterceptor.kt @@ -102,7 +102,7 @@ class ComposedImageInterceptor( } private fun createTextPaint(font: Typeface?): TextPaint { - val defaultTextSize = 50.sp // arbitrary + val defaultTextSize = 24.pt // arbitrary return TextPaint().apply { color = Color.BLACK textSize = defaultTextSize @@ -258,7 +258,8 @@ class ComposedImageInterceptor( restore() } - private val Int.sp: Float get() = this * SCALED_DENSITY + // https://pixelsconverter.com/pt-to-px + private val Int.pt: Float get() = this / SCALED_DENSITY // ============================= Utils ====================================== @@ -283,7 +284,8 @@ class ComposedImageInterceptor( } companion object { - const val SCALED_DENSITY = 1.5f // arbitrary + // w3: Absolute Lengths [...](https://www.w3.org/TR/css3-values/#absolute-lengths) + const val SCALED_DENSITY = 0.75f // 1px = 0.75pt val mediaType = "image/png".toMediaType() } }