Search code examples
objective-cmacoscocoansoutlineview

View-based "Source List" NSOutlineView font smoothing issue


I'm migrating a cell-based NSOutlineView to a view-based one, and I'm noticing that text is being rendered differently in the view-based outline view. See this image:

https://i.sstatic.net/VQs3d.png

Why the difference? Some background information that may help?

  • This is on Mac OS X 10.7.4
  • The NSOutlineView's highlight style is Source List
  • The NSOutlineView's background color is transparent, and the background is being drawn by an underlying view
  • In the view-based outline view, the cell text is being drawn by an NSTextField in an NSTableCellView
  • Nothing in the view hierarchy is, to my knowledge, layer-backed

I think this describes a similar issue: Weird font anti-aliasing in view-based NSOutlineView, but the solution did not work for me, as (I don't think) any of the cell views or text fields are layer-backed.


Solution

  • Update: I've figured it out. In Interface Builder, if I select the text field in the table cell view, check "Draws Background," and set the background color to clear (RGBA 0,0,0,0), the text appears smoothed the same way as it would in a cell-based outline view.

    So I don't think it's an NSOutlineView issue in particular. I don't know the internals of Cocoa text rendering, but I'm assuming it's because font smoothing will vary based on what kind of background the text is being drawn on.