How do I set the font size in a text cell so that the string fills the cell's rect?
I have a view that contains two NSTextFieldCell s. The size at which these cells are drawn is derived from the size of the view, and I want the text in each cell to be the largest that will fit in the derived size of the cell. Here's what I have, which doesn't set the font size: - (void)drawRect:(NSRect)dirtyRect { /* * Observant readers will notice that I update the whole view here. If * there is a perceived performance problem, then I'll switch to just * updating the dirty rect. */ NSRect boundsRect = self.bounds; const CGFloat monthHeight = 0.25 * boundsRect.size.height; NSRect monthRect =