Anyone got clue about what parameters allows to fi...
# compose
t
Anyone got clue about what parameters allows to fix text overlapping when using very large fontSize?
f
lineHeight
? 🤔
💯 1
👍 1
t
Arf of course thanks, don't know why I thought than when modifying the fontsize of the Text it implicitly changed that one too ...
h
I'm curious what have caused the text layout in the image?
t
My fault I have buttons to increase font size on a lyrics view. But only changed the fontSize param of the Text()
h
was lineHeight specified but not changed?
t
Not specified on the Text but it's an M3 theme so it's set there.
h
Ouch! It's not a bug but not a great experience either. I'll redirect this to the team and see what we can do to reduce the friction.
👍 1
t
In the same vein any reason why we can't add TextUnit ?
h
what do you mean by adding TextUnit?
t
Like 12.sp + 4.sp to add 4 sp to the calculated fontsize
s
This would likely fall into the same issue that
compareTo
does in
TextUnit
in that
em
and
sp
are dijoint
1
so
1.2.em + 30.sp
would have to throw
t
Yep but then what it the proper way to do it ?
s
Do you just want to scale? Multiplication should be well defined
taking a step back whats use case
t
Honestly I don't really know the best practice for that case. But since the fontSize is calculated I want to derivate the line height from it to fix the OP
So like fontSize+ 4.sp
s
Ah, I think you'll run into "optical sizing" like issues if 4.sp is a constant and fontSize is variable. When fontSize is very large or small 4.sp will look off. It looks like @Seigo Nonaka already thought about this in 2019 and you can do
val lineHeight = fontSize * 1.1
👍 1
t
Thanks that makes sense. Text is hard for non designers :)
c