HÃ¥kon Pettersen
08/19/2024, 8:15 AMcompose-bom
from version 2023.10.01 to 2024.06.00 and have noticed significant differences in screenshots involving Text
components. While I'm aware that includeFontPadding
now defaults to false, the change I'm seeing seems related to actual font size. I've reviewed compose-ui lib changes but haven't found anything specific to this. Does anyone have insights into what might be causing this?Skaldebane
09/23/2024, 7:16 PMincludeFontPadding
. In the androidx.compose.foundation
layer, that's the only change, but androidx.compose.material
also had changes, touching LocalTextStyle
if I remember correctly (which is applied through the MaterialTheme
composable).
Not sure if anything relates to font size, but line height used to be Unspecificed
, but now it's hardcoded values instead (linked to each typography style). That meant that if you simply changed fontSize
(instead of using a different pre-built material typography style, or changing the lineHeight
as well), the lines would either be too far away from each other (if you decrease it) or start to overlap (if you increase it).
I forgot the code I used to fix it, I think was basically setting the default`lineHeight` to Unspecified
again, but I'll take a look right now.Skaldebane
09/23/2024, 7:17 PMMaterialTheme(
colors = colors,
typography = Typography,
shapes = Shapes
) {
val currentStyle = LocalTextStyle.current
CompositionLocalProvider(
value = LocalTextStyle provides currentStyle.copy(
lineHeight = TextUnit.Unspecified,
platformStyle = PlatformTextStyle(
spanStyle = currentStyle.platformStyle?.spanStyle,
paragraphStyle = PlatformParagraphStyle(includeFontPadding = true)
)
),
content = content
)
}
(Note that I also re-enabled includeFontPadding
, as my project is a font preview app and that results in a more accurate representation).Skaldebane
09/23/2024, 7:21 PM