From 8c8db3cd4cb094535ecb0254a7fb2e15be31d4fd Mon Sep 17 00:00:00 2001 From: Jjgod Jiang Date: Wed, 16 Jul 2008 16:27:59 +0800 Subject: [PATCH] Turn off ligatures by default Turn off all common ligatures (fi, ffi) and rare ligatures (ct, ss). --- src/MacVim/MMAtsuiTextView.m | 13 +++++++++++++ src/MacVim/MMTextStorage.m | 1 + 2 files changed, 14 insertions(+) diff --git a/src/MacVim/MMAtsuiTextView.m b/src/MacVim/MMAtsuiTextView.m index 2b2a697672..db5520976e 100644 --- a/src/MacVim/MMAtsuiTextView.m +++ b/src/MacVim/MMAtsuiTextView.m @@ -851,6 +851,14 @@ enum { &fontID, &fontSize, &fontWidth, &transform, &options, &font }; + ATSUFontFeatureType featureTypes[] = { + kLigaturesType, kLigaturesType + }; + + ATSUFontFeatureSelector featureSelectors[] = { + kCommonLigaturesOffSelector, kRareLigaturesOffSelector + }; + for (i = 0; i < MMMaxCellsPerChar; i++) { fontWidth = Long2Fix(cellSize.width * (i + 1)); @@ -862,6 +870,11 @@ enum { ATSUDisposeStyle(atsuStyles[i]); atsuStyles[i] = NULL; } + + // Turn off ligatures by default + ATSUSetFontFeatures(atsuStyles[i], + sizeof(featureTypes) / sizeof(featureTypes[0]), + featureTypes, featureSelectors); } } diff --git a/src/MacVim/MMTextStorage.m b/src/MacVim/MMTextStorage.m index b0b61d5f1f..9a6e9b29e5 100644 --- a/src/MacVim/MMTextStorage.m +++ b/src/MacVim/MMTextStorage.m @@ -302,6 +302,7 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; bg, NSBackgroundColorAttributeName, fg, NSForegroundColorAttributeName, sp, NSUnderlineColorAttributeName, + [NSNumber numberWithInt:0], NSLigatureAttributeName, nil]; if (flags & DRAW_UNDERL) {