MKOutlinedLabelNode icon indicating copy to clipboard operation
MKOutlinedLabelNode copied to clipboard

Chokes on space character

Open JohnCrafton opened this issue 8 years ago • 2 comments

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.

JohnCrafton avatar Aug 05 '17 16:08 JohnCrafton

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!

tfworld avatar Nov 03 '17 21:11 tfworld

Thanks. I am quite busy lately. I will try to merge your code this week

marioklaver avatar Nov 14 '17 10:11 marioklaver