Skip to content

Commit 837dff4

Browse files
committed
Merge pull request #129 from macvim-dev/feature/macligatures_option
Add macligatures option
2 parents 2696990 + a2c32aa commit 837dff4

File tree

17 files changed

+1778
-358
lines changed

17 files changed

+1778
-358
lines changed

src/MacVim/English.lproj/Preferences.nib/designable.nib

Lines changed: 1719 additions & 321 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
11.8 KB
Binary file not shown.

src/MacVim/MMAppController.m

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ + (void)initialize
208208
[NSNumber numberWithBool:NO], MMNoFontSubstitutionKey,
209209
[NSNumber numberWithBool:YES], MMLoginShellKey,
210210
[NSNumber numberWithInt:2], MMRendererKey,
211-
[NSNumber numberWithBool:NO], MMRendererLigaturesSupportKey,
212211
[NSNumber numberWithInt:MMUntitledWindowAlways],
213212
MMUntitledWindowKey,
214213
[NSNumber numberWithBool:NO], MMTexturedWindowKey,
@@ -1227,27 +1226,6 @@ - (IBAction)atsuiButtonClicked:(id)sender
12271226
[self rebuildPreloadCache];
12281227
}
12291228

1230-
- (IBAction)ligaturesButtonClicked:(id)sender
1231-
{
1232-
ASLogDebug(@"Toggle CoreText ligatures");
1233-
BOOL enable = ([sender state] == NSOnState);
1234-
1235-
// Update the user default MMRendererLigaturesSupport and synchronize the
1236-
// change so that any new Vim process will pick up on the changed setting.
1237-
CFPreferencesSetAppValue(
1238-
(CFStringRef)MMRendererLigaturesSupportKey,
1239-
(CFPropertyListRef)[NSNumber numberWithBool:enable],
1240-
kCFPreferencesCurrentApplication);
1241-
CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
1242-
1243-
ASLogInfo(@"Use ligatures=%hhd", enable);
1244-
1245-
// This action is called when the user clicks the "enable support for ligatures"
1246-
// button in the advanced preferences pane.
1247-
[self rebuildPreloadCache];
1248-
}
1249-
1250-
12511229
- (IBAction)loginShellButtonClicked:(id)sender
12521230
{
12531231
ASLogDebug(@"Toggle login shell option");

src/MacVim/MMAtsuiTextView.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ enum { MMMaxCellsPerChar = 2 };
7373
- (void)setPreEditRow:(int)row column:(int)col;
7474
- (void)setMouseShape:(int)shape;
7575
- (void)setAntialias:(BOOL)state;
76+
- (void)setLigatures:(BOOL)state;
7677
- (void)setImControl:(BOOL)enable;
7778
- (void)activateIm:(BOOL)enable;
7879
- (void)checkImState;

src/MacVim/MMAtsuiTextView.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,11 @@ - (void)setAntialias:(BOOL)state
361361
antialias = state;
362362
}
363363

364+
- (void)setLigatures:(BOOL)state
365+
{
366+
// ONLY in Core Text!
367+
}
368+
364369
- (void)setImControl:(BOOL)enable
365370
{
366371
[helper setImControl:enable];

src/MacVim/MMBackend.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ extern NSTimeInterval MMBalloonEvalInternalDelay;
136136
- (void)setFullScreenBackgroundColor:(int)color;
137137

138138
- (void)setAntialias:(BOOL)antialias;
139+
- (void)setLigatures:(BOOL)ligatures;
139140

140141
#ifdef BLUR_TRANSPARENCY
141142
- (void)setBlurRadius:(int)radius;

src/MacVim/MMBackend.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,13 @@ - (void)setAntialias:(BOOL)antialias
11801180
[self queueMessage:msgid data:nil];
11811181
}
11821182

1183+
- (void)setLigatures:(BOOL)ligatures
1184+
{
1185+
int msgid = ligatures ? EnableLigaturesMsgID : DisableLigaturesMsgID;
1186+
1187+
[self queueMessage:msgid data:nil];
1188+
}
1189+
11831190
#ifdef BLUR_TRANSPARENCY
11841191

11851192
- (void)setBlurRadius:(int)radius

src/MacVim/MMCoreTextView.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
float fontDescent;
3333
BOOL antialias;
34-
BOOL useLigatures;
34+
BOOL ligatures;
3535
NSMutableArray *drawData;
3636

3737
MMTextViewHelper *helper;
@@ -79,6 +79,7 @@
7979
- (void)setPreEditRow:(int)row column:(int)col;
8080
- (void)setMouseShape:(int)shape;
8181
- (void)setAntialias:(BOOL)state;
82+
- (void)setLigatures:(BOOL)state;
8283
- (void)setImControl:(BOOL)enable;
8384
- (void)activateIm:(BOOL)enable;
8485
- (void)checkImState;

src/MacVim/MMCoreTextView.m

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,17 +132,7 @@ - (id)initWithFrame:(NSRect)frame
132132
[self registerForDraggedTypes:[NSArray arrayWithObjects:
133133
NSFilenamesPboardType, NSStringPboardType, nil]];
134134

135-
// Check if ligatures should be used or not
136-
{
137-
Boolean val;
138-
Boolean keyValid;
139-
val = CFPreferencesGetAppBooleanValue((CFStringRef)MMRendererLigaturesSupportKey,
140-
kCFPreferencesCurrentApplication,
141-
&keyValid);
142-
143-
useLigatures = NO;
144-
if(keyValid) { useLigatures = val; }
145-
}
135+
ligatures = NO;
146136
return self;
147137
}
148138

@@ -387,6 +377,11 @@ - (void)setAntialias:(BOOL)state
387377
antialias = state;
388378
}
389379

380+
- (void)setLigatures:(BOOL)state
381+
{
382+
ligatures = state;
383+
}
384+
390385
- (void)setImControl:(BOOL)enable
391386
{
392387
[helper setImControl:enable];
@@ -1371,7 +1366,7 @@ - (void)drawString:(const UniChar *)chars length:(UniCharCount)length
13711366
}
13721367

13731368
CGContextSetTextPosition(context, x, y+fontDescent);
1374-
recurseDraw(chars, glyphs, positions, length, context, fontRef, fontCache, useLigatures);
1369+
recurseDraw(chars, glyphs, positions, length, context, fontRef, fontCache, ligatures);
13751370

13761371
CFRelease(fontRef);
13771372
CGContextRestoreGState(context);

src/MacVim/MMTextView.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
int insertionPointShape;
2121
int insertionPointFraction;
2222
BOOL antialias;
23+
BOOL ligatures;
2324
NSRect *invertRects;
2425
int numInvertRects;
2526

@@ -32,6 +33,7 @@
3233
- (void)performBatchDrawWithData:(NSData *)data;
3334
- (void)setMouseShape:(int)shape;
3435
- (void)setAntialias:(BOOL)antialias;
36+
- (void)setLigatures:(BOOL)ligatures;
3537
- (void)setImControl:(BOOL)enable;
3638
- (void)activateIm:(BOOL)enable;
3739
- (void)checkImState;

0 commit comments

Comments
 (0)