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

This commit is contained in:
Benoit Marty 2023-07-27 15:44:49 +02:00
parent 3c1f764bee
commit 3c07fea2dd
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)
}