Missing characters in SCNText (iOS 14)

111 Views Asked by At

The following code (iOS, ARKit project) creates a SCNText node and attaches it to the root node of the ARKit scene:

let font: UIFont = UIFont.systemFont(ofSize: fontSize, weight: UIFont.Weight.regular)
let attributes: [NSAttributedString.Key : Any]? = [NSAttributedString.Key.font: font]
let text = NSAttributedString(string: "abcdefghijklmnopqrstuvwxyz:123456789", attributes: attributes)

let textGeometry = SCNText(string: test, extrusionDepth: 0.1)
let textNode = SCNNode(geometry: textGeometry)
rootNode.addChildNode(textNode)

When I run it in either simulator or device with iOS 14, I get a text with missing some characters (e.g. "a", "e", "y"):

Sample output from SCNText

It works fine when I use regular String as an input param of SCNText but does not work with NSAttributedString + system font (the font matters). It works fine in the previous iOS (iOS 13).

Have you met a similar issue with missing characters? Have you found any workaround?

The sample Xcode project showing this issue can be found here.

0

There are 0 best solutions below