Skip to content

Commit e91587b

Browse files
committed
android: use shared watermark font sizing
1 parent 7da3f8a commit e91587b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • app/src/main/java/me/rosuh/easywatermark/utils/ktx

app/src/main/java/me/rosuh/easywatermark/utils/ktx/PainKtx.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import android.graphics.Typeface
66
import android.text.TextPaint
77
import me.rosuh.easywatermark.data.model.ImageInfo
88
import me.rosuh.easywatermark.data.model.WaterMark
9-
import me.rosuh.easywatermark.render.WatermarkRenderer
9+
import me.rosuh.easywatermark.render.WatermarkGeometry
1010

1111
/**
1212
* S3a image-space sizing: the text paint size is `textSize * imageInfo.width / REF_WIDTH`, i.e.
@@ -28,7 +28,7 @@ fun Paint.applyConfig(
2828
@Suppress("UNUSED_PARAMETER") isScale: Boolean = true
2929
): Paint {
3030
val size = config?.textSize ?: 14f
31-
textSize = size * imageInfo.width / WatermarkRenderer.REF_WIDTH
31+
textSize = WatermarkGeometry.fontPx(size, imageInfo.width)
3232
color = config?.textColor ?: Color.RED
3333
alpha = config?.alpha ?: 128
3434
style = config?.textStyle?.obtainSysStyle() ?: Paint.Style.FILL

0 commit comments

Comments
 (0)