I can't find a way for such a simple change:
Texts
in jetpack compose
have a default padding on top
and bottom
like this:
How can I remove that?
I want the border of the Text Composable
to be at the top
and bottom
end of the letters, just like it is the case on the right and the left of the text
If I use Modifier.height()
, letters like g
get cut off, but I want them to still be visible while other Composables like Column
ignore those extra heights
After setting deprecated includeFontPadding
to false, the padding amount gets decreased, but still exists:
How can that padding be reduced to zero?
Is it possible that you are using an old version of Compose? This issue was fixed in Version 1.2.0-alpha05: "Text: includeFontPadding is now turned off by default." Try upgrading to version 1.3.3.
EDIT: It looks like it was turned on again in 1.2.0-beta01. According to the issueTracker: "RelNote: "Turned on default includeFontPadding. It is possible to turn off the includeFontPadding using TextStyle.platformTextStyle attribute. In the near future we will change the default behavior however until that time this allows us to better integrate line height improvements (aosp/2058653) and solve TextField clipping issues."
The workaround is to use platformStyle. You could also comment on the issueTracker and star it if you wish.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With