Here's a simple demo. I run it on macOS 12.1, compiled with Xcode 13.2.
struct ContentView: View {
var body: some View {
VStack {
Text("ee")
Text("eé")
Text("e\u{E9}") // "e with acute"
Text("ee\u{301}") // "combining acute"
}.font(.custom("Avenir", fixedSize: 18))
.padding(20)
}
}
In the 4rd one, the "e" is rendered in the wrong size/font. Screenshot:
Other fonts do not have the problem. For example, "Avenir Next" and "Helvetica".
Is there a way (in code) to tell which fonts can handle combining chars?
Is this a bug?
I notice the same thing happens when I use Core Text to draw the strings at a low level. So it's not just SwiftUI.
In TextEdit, if have Avenir font, type "option-e" + "e" I get a nice letter. Maybe TextEdit is doing what Xcode did in the second line, and using the "e with acute" unicode character.