Category Archives: cocoa

Reading a font from file and making it available to Cocoa

This is another programming related post.
Say you have a true type font that’s not part of the OS font set in a file. You’ve read the contents of the file into memory and now want to make it available to Cocoa. How?

Cocoa Text System Sample

Cocoa is pretty amazing. Here’s a quick sample that does a simple text layout (with styles!) inside a NSTextView. This is an AwakeFromNib method that was instantiated inside Interface Builder and connected to Main Window’s Content area.