Improve rendering of Text composer regarding fontScale. (#984)

This commit is contained in:
Benoit Marty
2023-07-27 15:44:49 +02:00
parent 96b7923979
commit 1d89584daf
2 changed files with 25 additions and 13 deletions

View File

@@ -60,3 +60,11 @@ fun Dp.roundToPx(): Int = with(LocalDensity.current) { roundToPx() }
fun Dp.scaleMax(): Dp = with(LocalDensity.current) {
return this@scaleMax * fontScale.coerceAtMost(1f)
}
/**
* Return the minimum value between the receiver value and the value with fonScale applied.
*/
@Composable
fun Dp.scaleMin(): Dp = with(LocalDensity.current) {
return this@scaleMin * fontScale.coerceAtLeast(1f)
}