I know it has been asked before, but I haven’t see...
# compose
j
I know it has been asked before, but I haven’t seen any answers yet. Is there any way to strip the vertical padding off of the fonts? Something like a replacement for:
Copy code
android:includeFontPadding="false"
android:lineSpacingExtra="0dp"
1
d
search "TextDelegate", there was a good answer a week ago
ah, sorry. It's actually a slightly different problem. I also didn't find an easy solution. But I use TextDelegate to render 2 lines, then render only the second line on a Canvas
lineHeight doesn't work as expected for some reason for the first line, that's why you need 2 lines
I used • TextDelegate to layout 2 lines of text: first - empty, second - actual text • ParagraphStyle to set lineHeight=1.sp in annotated string. •
translate
function within Canvas to "hide" the first line. LayoutResult gives you baselines, lines' top/bottom coordinates
j
Thanks! (This doesn’t sound like an out-of-the-box solution 😄)
r
@József Szilvási Did u find any solution for this? I am trying to remove the vertical padding on text
j
Unfortunately no, I ended up using a different font with less padding. This is the ticket for the long awaited solution: https://issuetracker.google.com/issues/171394808
🙏 1