Our font file has a default line height which is 1.2 times the font size. For example, if the font size is 24px, the default line height would be 28.8px. According to the Figma design, the designer requires a line height of 24px matching the font size of 24px.
In Android Compose, it's feasible to increase the line height from the default font specification but not reduce it.
works
- Setting Line Height larger than the default
val Typography.Heading2: TextStyle
get() = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Bold,
fontSize = 24.sp,
lineHeight = 30.sp, // Default line height - 24*1.2 = 28.8
letterSpacing = 0.48.sp
)
this doesn't work
- Setting Line Height smaller than the default
val Typography.Heading2: TextStyle
get() = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Bold,
fontSize = 24.sp,
lineHeight = 24.sp, // Default line height - 24*1.2 = 28.8
letterSpacing = 0.48.sp
)
Any idea how to set a smaller line height than the default line height?