https://kotlinlang.org logo
#compose
Title
# compose
t

Tolriq

06/23/2022, 3:01 PM
Anyone got clue about what parameters allows to fix text overlapping when using very large fontSize?
f

Filip Wiesner

06/23/2022, 3:05 PM
lineHeight
? 🤔
💯 1
👍 1
t

Tolriq

06/23/2022, 3:08 PM
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

Halil Ozercan

06/23/2022, 3:44 PM
I'm curious what have caused the text layout in the image?
t

Tolriq

06/23/2022, 3:46 PM
My fault I have buttons to increase font size on a lyrics view. But only changed the fontSize param of the Text()
h

Halil Ozercan

06/23/2022, 3:47 PM
was lineHeight specified but not changed?
t

Tolriq

06/23/2022, 3:51 PM
Not specified on the Text but it's an M3 theme so it's set there.
h

Halil Ozercan

06/23/2022, 3:54 PM
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

Tolriq

06/23/2022, 4:28 PM
In the same vein any reason why we can't add TextUnit ?
h

Halil Ozercan

06/23/2022, 4:36 PM
what do you mean by adding TextUnit?
t

Tolriq

06/23/2022, 4:43 PM
Like 12.sp + 4.sp to add 4 sp to the calculated fontsize
s

Sean McQuillan [G]

06/23/2022, 4:44 PM
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

Tolriq

06/23/2022, 4:45 PM
Yep but then what it the proper way to do it ?
s

Sean McQuillan [G]

06/23/2022, 4:46 PM
Do you just want to scale? Multiplication should be well defined
taking a step back whats use case
t

Tolriq

06/23/2022, 4:47 PM
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

Sean McQuillan [G]

06/23/2022, 4:51 PM
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

Tolriq

06/23/2022, 4:53 PM
Thanks that makes sense. Text is hard for non designers :)
c

Colton Idle

06/23/2022, 5:44 PM
2 Views