SwiftUI negative kerning cuts off font

Hey there!

Got a question about font kerning:

When adding a negative kerning to a text (changes via user input) the last character sometimes gets cut off:

dropbox.com/s/49ucdzk8m4k61sj/fontproblem1.png?dl=0
dropbox.com/s/vmklvxp510wjeak/fontproblem2.png?dl=0

What i do is the following:

Code Block language
Text("\(pos, specifier: "%.1f")")
.font(.system(size: 100,design: .serif))
.fontWeight(.bold)
.kerning(-5)

When i remove the kerning it works, but as i understood the kerning keeps the letters as they are? Is there an alternative way of doing it?

Hi there, I know this is an old post, but did you ever solve this? I'm encountering the same issue.

There is still no good way to fix this. Simply add two spaces at the start and end of the string Text(" F ").

SwiftUI negative kerning cuts off font
 
 
Q