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
If you are currently on macOS Catalina (10.15) or below, you can remove the text smoothing by: Open System preferences and Appearances. Uncheck the checkbox next to “Use LCD font smoothing when available.”
Open the Control Panel. Double-click the Display icon. In the Display menu, click the Effects tab and check the box on smooth edges on-screen fonts.
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
If you use a non-retina display, try
defaults write com.apple.dt.Xcode NSFontDefaultScreenFontSubstitutionEnabled -bool YESand restart XCode.
UPDATE:
Also invoke this:
defaults write com.apple.dt.Xcode AppleAntiAliasingThreshold 24
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With