You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that the ScaledFont modifier isn't functioning as intended because the line spacing is set to 0 (source).
private struct ScaledFont: ViewModifier {
var style: BPKFontStyle
func body(content: Content) -> some View {
return content.font(style.font)
.lineSpacing(style.lineHeight - style.lineHeight) // currently 0! Will not work
}
}
As you can see, the height of the textarea is set to threeLineHeight, but there's extra margin left even when you write three lines.
The corrected code should look like this. Both lineSpacing(1) and padding(2) should be modified to achieve the same visual result as the lineHeight from UIKit. (+you'll need to transform the metrics (fontSize, padding) relative to the current context's sizeCategory if you want to fully support dynamic type size)
However, since SwiftUI's Font doesn't provide a lineHeight property like UIFont did, you might need to revert the type of BPKFontStyle.font from Font to UIFont as it was before (source). If you're okay with this change, I can contribute, so please let me know!
The text was updated successfully, but these errors were encountered:
It seems that the ScaledFont modifier isn't functioning as intended because the line spacing is set to 0 (source).
As you can see, the height of the textarea is set to threeLineHeight, but there's extra margin left even when you write three lines.
The corrected code should look like this. Both lineSpacing(1) and padding(2) should be modified to achieve the same visual result as the lineHeight from UIKit. (+you'll need to transform the metrics (fontSize, padding) relative to the current context's sizeCategory if you want to fully support dynamic type size)
However, since SwiftUI's Font doesn't provide a lineHeight property like UIFont did, you might need to revert the type of BPKFontStyle.font from Font to UIFont as it was before (source). If you're okay with this change, I can contribute, so please let me know!
The text was updated successfully, but these errors were encountered: