I've encountered a semi-reproducible problem using certain fonts with
lists in NSTextView. Newlining to produce another item in the list or
tabbing to change the indentation can reset the current font to
Lucida Grande. This doesn't seem to happen with all fonts, but it can
happen with the common ones, ie Georgia Italic. TextEdit also suffers
from the bug.
To reproduce: type something in a text view. Change the font to, for
example, Georgia Italic. Make a list out of the text. Hit return to
create a new item in the list. Tab to indent. Type. Create a new
item. Type. By now the font should have been reset to Lucida Grande.
If not, fool around a bit by creating new items in the list, deleting
them and changing the indent. At some point the font will reset.
Apple Bug Report #5065130
The Workaround: Subclass NSTextView and override setTypingAttributes:
to check for the presence of lists and the tab character. Use the
current font when necessary. If someone has a cleaner workaround, I'm
interested, as this is a bit of a hack.
- (void)setTypingAttributes:(NSDictionary *)attributes
{
// a fix for the re-set typing attributes problem when new-lining or
tabbing during lists