Search code examples
xcodefontsxcode5xcode6

Disable Xcode anti-aliasing text inside the code editor?


When using Xcode, there doesn't seem to be a way to set code editor fonts to be sharp (i.e. with no 'font smoothing). Despite what you might see in the preview area of Preferences > Fonts & Colors, inside the actual code view it’s always smoothed/anti-aliased.

There are some older questions that address previous versions of Xcode. They suggest changing various settings using defaults write com.apple.dt.Xcode <etc>, but these do not seem to affect the code view for me in Xcode 5 on Mac OS X 10.8.5. I am using a dual-display setup with one Retina and one non-Retina screen.

I've tried turning off the font smoothing checkbox in System Preferences > General > "Use LCD font smoothing where available", but that only affects sub pixel rendering...

Update (2014-11-25): The problem still occurs with Mac OS X 10.10.1 and Xcode 6.1.1. Here is a screenshot showing the editor view (smoothed) and preferences window (unsmoothed) after using these Terminal commands:

defaults write com.apple.dt.Xcode NSFontDefaultScreenFontSubstitutionEnabled -bool YES
defaults write com.apple.dt.Xcode AppleAntiAliasingThreshold 16

Xcode


Solution

  • From Xcode9.3, text anti-aliasing can be disabled in the source editor by running the following command and restart Xcode:

    defaults write com.apple.dt.Xcode SourceEditorDisableAntialiasing -bool YES
    

    To turn anti-aliasing on again -

    defaults write com.apple.dt.Xcode SourceEditorDisableAntialiasing -bool NO