Join Slack
Powered by
Is this the only way to have fixed size text? Have...
# compose
a
Alex Styl
06/17/2024, 10:31 AM
Is this the only way to have fixed size text? Haven't found any sort of text unit type which allows this, so double checking here
Copy code
val fontSize = with(LocalDensity.current) { 14.dp.toSp() }
y
yschimke
06/17/2024, 11:57 AM
Or override the density to font scale of 1.
yschimke
06/17/2024, 11:57 AM
https://github.com/google/horologist/blob/main/compose-layout%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fandroid%2Fhorologist%2Fcompose%2Flayout%2FFontScaleIndependent.kt
yschimke
06/17/2024, 11:58 AM
I think your code is safe, but given non linear font scaling, it makes me worry about those conversions.
a
Alex Styl
06/17/2024, 12:14 PM
thanks for sharing. i think you are right 👍
4
Views
Open in Slack
Previous
Next