Technique on how to format/color NSTextView's string
问题 I'm looking for a reliable technique to do simple string formatting(bold, italic,...) in a NSTextView. The text parsing is almost done with regex, but now I need to apply font trait and also change the size. Some code snippets on how I make a text bold [[textView textStorage] beginEditing]; [[textView textStorage] applyFontTraits:NSFontBoldTrait range:range]; [[textView textStorage] endEditing]; This and also the size changes with [[textView textStorage] beginEditing]; NSFont* font = [