I have a SCNText with long text content.
I would like to make the text wrapped to new line by using isWrapped
property and containerFrame
property as specified in the document. However, the issue is the multi-line text collapsed into one line if font-size is 0.5 or smaller:
If I set font-size to 0.6, the text show with multiple lines as expected.
Below is my code:
let content = "This is an example of a very super extra long text."
let scnText = SCNText(string: content, extrusionDepth: 0.2)
scnText.font = UIFont (name: "Helvetica", size: 0.4)
scnText.alignmentMode = CATextLayerAlignmentMode.center.rawValue
scnText.isWrapped = true
let size = CGSize(width: 4, height: 6)
scnText.containerFrame = CGRect(origin: scnText.containerFrame.origin, size: size)
let scnTextNode = SCNNode(geometry: scnText)
Here is the source code: https://github.com/rudyhuynh/SceneKitExample/tree/SCNText
I end up move the camera to zoom out and increase size of every object so that I will be able to show the text with font-size 0.6 or greater.