2

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.

lechec
  • 839
  • 1
  • 8
  • 17
  • I am also having the same issue. Tried monospacedSystemFonts and that worked fine. But I would want to use system font. – Kushal Jogi Oct 22 '20 at 10:03
  • @KushalJogi Using e.g. UIFont(name: ".SFUIText", ...) seems to work fine but I would also like to use system font :) Btw UIFont(name: "HelveticaNeue", ...) also works fine, but UIFont(name: "HelveticaNeue-Bold", ...) does not work. Really strange. – lechec Oct 23 '20 at 11:33

0 Answers0