MKOutlinedLabelNode
MKOutlinedLabelNode copied to clipboard
Chokes on space character
Using "AvenirNext-Bold" as the font, createBorderPathForText() fails in the glyph loop at letters.addPath(letter!, transform: t). It fails when attempting to process the space character (in this case, in the phrase "GAME OVER") with letter = nil.
I will try to solve it, but wanted to at least call it out in case it was something simple.
I am going to put the solution here since the original author has not updated this in a long time.
File: MKOutlinedLabelNode.swift
Line: 95
Edit: if letter != nil { letters.addPath(letter!, transform: t) }
Reason: CTFontCreatePathForGlyph returns nil if the glyph does not exist or if it has no outlines. In the case of the space, no glyph and no outline. I hope this helps someone out there!
Thanks. I am quite busy lately. I will try to merge your code this week