diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 1180be98d5..01aee9bc00 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -671,18 +671,16 @@ A jump table for the options with a short description can be found at |Q_op|. {not in Vi} {only available when compiled with GUI enabled on Mac OS X} - This option only has an effect in the Carbon GUI version of Vim on Mac - OS X v10.2 or later, and in MacVim when the ATSUI renderer is used. - When on, Vim will use smooth ("antialiased") fonts, which can be - easier to read at certain sizes on certain displays. + This option only has an effect in the GUI version of Vim on Mac OS X + v10.2 or later. When on, Vim will use smooth ("antialiased") fonts, + which can be easier to read at certain sizes on certain displays. Setting this option in the Carbon version can sometimes cause problems if 'guifont' is set to its default (empty string). - The default renderer in MacVim uses the System Preferences to control - antialiasing of text; this option is ignored. The ATSUI renderer on - the other hand does use this option (and ignores the System - Preferences setting). + Support for this option is not flawless in MacVim. In particular, + Monaco always seems to render not antialiased for point sizes up + to 10. The ATSUI renderer has better antialias support. *'autochdir'* *'acd'* *'noautochdir'* *'noacd'* 'autochdir' 'acd' boolean (default off) diff --git a/src/MacVim/MMTextView.h b/src/MacVim/MMTextView.h index 928cbeb77f..0cd686d791 100644 --- a/src/MacVim/MMTextView.h +++ b/src/MacVim/MMTextView.h @@ -29,6 +29,7 @@ int preEditRow; int preEditColumn; int mouseShape; + BOOL antialias; } - (id)initWithFrame:(NSRect)frame; diff --git a/src/MacVim/MMTextView.m b/src/MacVim/MMTextView.m index c42b266673..bd2609fd9b 100644 --- a/src/MacVim/MMTextView.m +++ b/src/MacVim/MMTextView.m @@ -111,6 +111,9 @@ enum { return nil; } + // NOTE: If the default changes to 'NO' then the intialization of + // p_antialias in option.c must change as well. + antialias = YES; return self; } @@ -334,10 +337,9 @@ enum { [self setCursor]; } -- (void)setAntialias:(BOOL)antialias +- (void)setAntialias:(BOOL)state { - // Antialiasing is handled by the System Preferences and there seems to be - // no way to control antialiasing with NSTextView. + antialias = state; } - (NSFont *)font @@ -448,6 +450,9 @@ enum { - (void)drawRect:(NSRect)rect { + NSGraphicsContext *context = [NSGraphicsContext currentContext]; + [context setShouldAntialias:antialias]; + [super drawRect:rect]; if (shouldDrawInsertionPoint) {