Zoff
02/17/2024, 3:13 PMZoff
02/17/2024, 3:16 PMZoff
02/17/2024, 3:16 PMZoff
02/17/2024, 3:18 PMText(
text = message.text,
style = MaterialTheme.typography.body1.copy(
fontSize = ((msg_fontsize * ui_scale).toDouble()).sp,
letterSpacing = 0.sp
)
)
Dima Avdeev
02/17/2024, 3:59 PM1.6.0-rc02
?Dima Avdeev
02/17/2024, 4:00 PMZoff
02/17/2024, 4:18 PMIvan Matkov
02/17/2024, 4:43 PMIvan Matkov
02/17/2024, 4:43 PMStatus: Won't Fix (Intended Behavior)
The release notes documentation has been edited to clarify this change in behavior for line height.
To support non-standard text sizes, we encourage users to follow the Material design system and use a different type scale rather than changing the font size directly. Alternatively, users can overwrite the line height like so:, or create a customstyle = LocalTextStyle.current.copy(lineHeight = TextUnit.Unspecified)
entirely.Typography
Alexander Maryanovsky
02/17/2024, 4:44 PMIvan Matkov
02/17/2024, 4:46 PMIvan Matkov
02/17/2024, 4:50 PMfontSize
control lineHeight
you need to provide (override) LocalTextStyle
with lineHeight = TextUnit.Unspecified
Ivan Matkov
02/17/2024, 4:52 PMMaterialTheme
specifies lineHeight
explicitly by default, so changing only fontSize
doesn't work inside itZoff
02/17/2024, 6:05 PMMark
02/20/2024, 2:38 PMText
?
@Composable
fun AppTheme(content: @Composable () -> Unit) {
MaterialTheme(colors = ...) {
CompositionLocalProvider(
LocalTextStyle provides LocalTextStyle.current.copy(lineHeight = TextUnit.Unspecified),
content = content,
)
}
}
Ivan Matkov
02/20/2024, 2:42 PMTo makecontrolfontSize
you need to provide (override)lineHeight
withLocalTextStyle
lineHeight = TextUnit.Unspecified
Mark
02/20/2024, 2:51 PMlineHeight
into the style passed to `Text`’s style arg, you would be overriding `LocalTextStyle`’s lineHeight
value. So I thought you meant that rather than providing/overriding through CompositionLocalProvider
. Thanks for the clarification.Ivan Matkov
02/20/2024, 2:53 PM