.paddings()也没有帮助。kerning(5)我不想使用,因为它仅在右边缘部分解决了问题,但它增加了不需要的字母间距。
struct ItalicTest: View {
var body: some View {
Text("F")
.font(Font.system(size: 60))
.italic()
.fontWeight(.black)
.frame(width: 60, height: 60)
.background(Color.red)
}
}
Run Code Online (Sandbox Code Playgroud)
我想防止剪辑。您知道使用 pure 的解决方案SwiftUI吗?
mag*_*ahr 12
我知道这是一个老问题,但我遇到了同样的问题并找到了正确的解决方案。
您必须向文本添加填充,并要求 swiftui 在渲染之前折叠填充和文本。
struct ItalicTest: View {
var body: some View {
Text("F")
.font(Font.system(size: 60))
.italic()
.fontWeight(.black)
.padding(.horizontal) // <-- add padding
.drawingGroup() // collapse the view and render together
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
231 次 |
| 最近记录: |