Created
January 12, 2016 16:19
-
-
Save keighl/b7c4ea235486c1dd4c3f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func textViewDidChangeTypingAttributes(notification: NSNotification) { | |
if let font = textView?.typingAttributes[NSFontAttributeName] as? NSFont { | |
if let faces = NSFontManager.sharedFontManager().availableMembersOfFontFamily(font.familyName) { | |
// faces is an array of arrays like this: | |
// [[Helvetica, Regular, 5, 0], [Helvetica-Light, Light, 3, 0], [Helvetica-Oblique, Oblique, 5, 1], [Helvetica-LightOblique, Light Oblique, 3, 1], [Helvetica-Bold, Bold, 9, 2], [Helvetica-BoldOblique, Bold Oblique, 9, 3]] | |
fontFacesLabels = faces.map({face in (face[1] as! String)}) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment