FixlinespacingincustomfontinSwiftUI

I am using custom font (Catamaran) and it seems like it has big space between lines in it. For example I have this code:

                Text("Example text that has big space between lines")
                    .lineSpacing(0)
                    .padding(.horizontal)
                    .font(Font.custom(FontNameManager.Catamaran.bold, size: 24.0))
                    .foregroundColor(.white)
                    .multilineTextAlignment(.center)

and it looks like this:

As you can see it doesn't have zero space between lines but it still gets too much space. I even tried to set negative numbers to lineSpacing method but it doesn't help. What can I do with this? How I can fix it? In UIKit I would probably use attributed string and I think I can use UILabel as UIViewRepresentable and then I can use attributed string in SwiftUI iOS 14. Is there some easier solution which can "fix" font for any usage? Do I have to edit original .ttf file? Why there is this space between lines in this font?

Thanks for any help

以上是FixlinespacingincustomfontinSwiftUI的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>