Round line height (#2824)

* Round line height

* Add to existing
zio/stable
Eric Bailey 2024-02-09 12:04:04 -06:00 committed by GitHub
parent d6235453c9
commit 071efaf2df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -15,7 +15,7 @@ export function leading<
>(textSize: Size, leading: Leading) {
const size = textSize?.fontSize || atoms.text_md.fontSize
const lineHeight = leading?.lineHeight || atoms.leading_normal.lineHeight
return size * lineHeight
return Math.round(size * lineHeight)
}
/**
@ -32,7 +32,7 @@ function normalizeTextStyles(styles: TextStyle[]) {
if (s?.lineHeight) {
if (s.lineHeight <= 2) {
s.lineHeight = fontSize * s.lineHeight
s.lineHeight = Math.round(fontSize * s.lineHeight)
}
} else {
s.lineHeight = fontSize

View File

@ -236,7 +236,7 @@ export function lh(
height: number,
): TextStyle {
return {
lineHeight: (theme.typography[type].fontSize || 16) * height,
lineHeight: Math.round((theme.typography[type].fontSize || 16) * height),
}
}