Reputation: 81
Can't find any issue about this, so:
SceneKit, Xcode 10.1
Applying font to SCNText:
Result:
Even when I'm:
textNode.geometry?.font = UIFont(name: "SF Mono Heavy", size: 170)
it is still in default font look.
I'm also tried a lot of other different fonts, but no luck.
What do I do wrong?
Upvotes: 0
Views: 337
Reputation: 12296
It's very likely the SIZE IS INCREDIBLY TOO LARGE.
The typical size you use for text in SCNText is 0.1.
SCNText is not measured in points, it is measured in meters.
put a 1 meter cube in your scene
run the scene and be sure you can see all of the cube
now add some text with size "1". sit it in front of the cube towards the camera.
Now you should see it.
for family in UIFont.familyNames.sorted() {
print("family: \(family) names: (UIFont.fontNames(forFamilyName: family))")
}
Put that code anywhere in the app in a viewDidLoad. You will get the exact names you must use.
Upvotes: 0
Reputation: 13462
The first level of debugging would be to verify that the UIFont
object isn't nil. What happens if you print the object? The editor is used on macOS. Are you sure the font exists on iOS?
Upvotes: 0