Hi y’all! We have an upcoming Text breaking change! :writing_hand: and need your input :pray: Start ...
a
Hi y’all! We have an upcoming Text breaking change! ✍️ and need your input 🙏 Start testing switching
includeFontPadding
to
false
and give us your feedback! Have you… 1️⃣ Switched and it went fine? 2️⃣ Switched and it did not go fine? Why, could you please share? Did you file any bugs? 3️⃣ Haven’t tried yet but have comments! More context in 🧵
2️⃣ 3
3️⃣ 1
1️⃣ 10
As you may remember from last year, includeFontPadding in #JetpackCompose has been a topic of discussion for some time now. includeFontPadding is a legacy attribute in TextView that controls whether or not to include extra padding around the text to accommodate any characters that may extend above or below the baseline of the font. In Compose having this behavior around as a concept no longer makes sense, so our goal has been to make includeFontPadding false by default in Compose. For this, we added PlatformTextStyle API plus LineHeight APIs. We believe it’s time to change includeFontPadding default behavior to be false 🕐
This change will affect screens rendering text. Visual changes should be minimal (depending on the font/language you’re using), but it might break your screenshot testing. You can always opt out of this configuration with PlatformTextStyle, changing includeFontPadding to true and do the migration gradually. Despite some effort this change might require, moving forward, we believe the benefits of this change are significant.
By making this change, you can better align the design and implementation of your Android apps with design tooling, and with how designs look in other platforms, resulting in more accurate and consistent layouts. It also dramatically simplifies vertical alignment for single line text. We’re super excited to get to do this in upcoming compose ui releases. What are your thoughts? TY ❣️
y
Switched and it went fine. On a wear app.
v
We have been using this for a long time to prevent design mismatches
t
I remember I tried using it once but it was showing as deprecated as it wasn't needed, something like this. Was this font padding or was it something else?
a
Not sure youre referring to this but
PlatformTextStyle
method using
includefontpadding
is deprecated to indicate it is a compatibility API (we might undeprecate it soon because it is confusing). But making this change before we make the switch and testing your app is deffo recommended.
t
So the code in the screenshot is indeed shown as deprecated right? It's super confusing lol
y
I tried it and it broke some of our paparazzi tests though the diffs are probably acceptable
a
Yes screenshot testing will likely break due to this, even if visual changes are not terribly obvious
For everyone else that migrated and did not go fine, why? screenshot tests breaking is expected unfortunately, you’d need to regenerate your images
c
We have been using this for a long time to prevent design mismatches
us too! finally working with figma and android doesn't cause me to rip my hair out. thank you to you and the text team Ale. This was amazing when introduced. ❤️
@Yang i think it makes sense that it broke paparazzi tests. i would think that you should either make those the new standard, or you have to go in and update padding in a bunch of places. @Ale Stamato the one issue we had was because we just had to go in and remove all of the negative padding we added in. so although it was tedious, it wasn't actually anything bad.