Skip to content

Commit 16e947c

Browse files
committed
Merge branch 'master' of github.com:splhack/macvim
2 parents c749c6a + fadf18f commit 16e947c

File tree

7 files changed

+23
-59
lines changed

7 files changed

+23
-59
lines changed

src/MacVim/MMBackend.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -998,11 +998,9 @@ - (void)setFont:(GuiFont)font wide:(BOOL)wide
998998
}
999999

10001000
int len = [fontName lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
1001-
int emojiEnabled = vim_strchr(p_go, GO_EMOJI) != NULL;
10021001
NSMutableData *data = [NSMutableData data];
10031002
[data appendBytes:&size length:sizeof(float)];
10041003
[data appendBytes:&len length:sizeof(int)];
1005-
[data appendBytes:&emojiEnabled length:sizeof(int)];
10061004

10071005
if (len > 0)
10081006
[data appendBytes:[fontName UTF8String] length:len];

src/MacVim/MMCoreTextView.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,8 @@
3737

3838
unsigned maxlen;
3939
CGGlyph *glyphs;
40-
CGSize *advances;
4140
CGPoint *positions;
4241
NSMutableArray *fontCache;
43-
BOOL emojiEnabled;
4442

4543
// These are used in MMCoreTextView+ToolTip.m
4644
id trackingRectOwner_; // (not retained)

src/MacVim/MMCoreTextView.m

Lines changed: 21 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -308,22 +308,17 @@ - (void)setWideFont:(NSFont *)newFont
308308
// regular font when drawing.
309309
[fontWide release];
310310

311-
emojiEnabled = [[self vimController] emojiEnabled];
312-
if (emojiEnabled) {
313-
// Use 'Apple Color Emoji' font for rendering emoji
314-
CGFloat size = [newFont pointSize];
315-
NSFontDescriptor *emojiDesc = [NSFontDescriptor
316-
fontDescriptorWithName:@"Apple Color Emoji" size:size];
317-
NSFontDescriptor *newFontDesc = [newFont fontDescriptor];
318-
NSDictionary *attrs = [NSDictionary
319-
dictionaryWithObject:[NSArray arrayWithObject:newFontDesc]
320-
forKey:NSFontCascadeListAttribute];
321-
NSFontDescriptor *desc =
322-
[emojiDesc fontDescriptorByAddingAttributes:attrs];
323-
fontWide = [[NSFont fontWithDescriptor:desc size:size] retain];
324-
} else {
325-
fontWide = [newFont retain];
326-
}
311+
// Use 'Apple Color Emoji' font for rendering emoji
312+
CGFloat size = [newFont pointSize];
313+
NSFontDescriptor *emojiDesc = [NSFontDescriptor
314+
fontDescriptorWithName:@"Apple Color Emoji" size:size];
315+
NSFontDescriptor *newFontDesc = [newFont fontDescriptor];
316+
NSDictionary *attrs = [NSDictionary
317+
dictionaryWithObject:[NSArray arrayWithObject:newFontDesc]
318+
forKey:NSFontCascadeListAttribute];
319+
NSFontDescriptor *desc =
320+
[emojiDesc fontDescriptorByAddingAttributes:attrs];
321+
fontWide = [[NSFont fontWithDescriptor:desc size:size] retain];
327322
}
328323
}
329324

@@ -1052,20 +1047,13 @@ - (void)batchDrawData:(NSData *)data
10521047
static void
10531048
recurseDraw(const unichar *chars, CGGlyph *glyphs, CGPoint *positions,
10541049
UniCharCount length, CGContextRef context, CTFontRef fontRef,
1055-
NSMutableArray *fontCache, BOOL emojiEnabled)
1050+
NSMutableArray *fontCache)
10561051
{
10571052

10581053
if (CTFontGetGlyphsForCharacters(fontRef, chars, glyphs, length)) {
10591054
// All chars were mapped to glyphs, so draw all at once and return.
1060-
if (emojiEnabled) {
1061-
length = gatherGlyphs(glyphs, length);
1062-
CTFontDrawGlyphs(fontRef, glyphs, positions, length, context);
1063-
} else {
1064-
CGFontRef cgFontRef = CTFontCopyGraphicsFont(fontRef, NULL);
1065-
CGContextSetFont(context, cgFontRef);
1066-
CGContextShowGlyphsAtPositions(context, glyphs, positions, length);
1067-
CGFontRelease(cgFontRef);
1068-
}
1055+
length = gatherGlyphs(glyphs, length);
1056+
CTFontDrawGlyphs(fontRef, glyphs, positions, length, context);
10691057
return;
10701058
}
10711059

@@ -1079,7 +1067,7 @@ - (void)batchDrawData:(NSData *)data
10791067
// font).
10801068
BOOL surrogatePair = NO;
10811069
while (*g && g < glyphsEnd) {
1082-
if (emojiEnabled && CFStringIsSurrogateHighCharacter(*c)) {
1070+
if (CFStringIsSurrogateHighCharacter(*c)) {
10831071
surrogatePair = YES;
10841072
g += 2;
10851073
c += 2;
@@ -1091,22 +1079,14 @@ - (void)batchDrawData:(NSData *)data
10911079
}
10921080

10931081
int count = g-glyphs;
1094-
if (emojiEnabled) {
1095-
if (surrogatePair)
1096-
count = gatherGlyphs(glyphs, count);
1097-
CTFontDrawGlyphs(fontRef, glyphs, positions, count, context);
1098-
} else {
1099-
CGFontRef cgFontRef = CTFontCopyGraphicsFont(fontRef, NULL);
1100-
CGContextSetFont(context, cgFontRef);
1101-
CGContextShowGlyphsAtPositions(context, glyphs, positions,
1102-
count);
1103-
CGFontRelease(cgFontRef);
1104-
}
1082+
if (surrogatePair)
1083+
count = gatherGlyphs(glyphs, count);
1084+
CTFontDrawGlyphs(fontRef, glyphs, positions, count, context);
11051085
} else {
11061086
// Skip past as many consecutive chars as possible which cannot be
11071087
// drawn in the current font.
11081088
while (0 == *g && g < glyphsEnd) {
1109-
if (emojiEnabled && CFStringIsSurrogateHighCharacter(*c)) {
1089+
if (CFStringIsSurrogateHighCharacter(*c)) {
11101090
g += 2;
11111091
c += 2;
11121092
} else {
@@ -1123,7 +1103,7 @@ - (void)batchDrawData:(NSData *)data
11231103
return;
11241104

11251105
recurseDraw(chars, glyphs, positions, count, context, newFontRef,
1126-
fontCache, emojiEnabled);
1106+
fontCache);
11271107

11281108
CFRelease(newFontRef);
11291109
}
@@ -1246,8 +1226,7 @@ - (void)drawString:(const UniChar *)chars length:(UniCharCount)length
12461226
}
12471227

12481228
CGContextSetTextPosition(context, x, y+fontDescent);
1249-
recurseDraw(chars, glyphs, positions, length, context, fontRef, fontCache,
1250-
(flags & DRAW_WIDE) && emojiEnabled);
1229+
recurseDraw(chars, glyphs, positions, length, context, fontRef, fontCache);
12511230

12521231
CFRelease(fontRef);
12531232
CGContextRestoreGState(context);

src/MacVim/MMVimController.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
BOOL isPreloading;
3939
NSDate *creationDate;
4040
BOOL hasModifiedBuffer;
41-
BOOL emojiEnabled;
4241
}
4342

4443
- (id)initWithBackend:(id)backend pid:(int)processIdentifier;
@@ -69,5 +68,4 @@
6968
- (id)evaluateVimExpressionCocoa:(NSString *)expr
7069
errorString:(NSString **)errstr;
7170
- (void)processInputQueue:(NSArray *)queue;
72-
- (BOOL)emojiEnabled;
7371
@end

src/MacVim/MMVimController.m

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,6 @@ - (void)setIsPreloading:(BOOL)yn
221221
isPreloading = yn;
222222
}
223223

224-
- (BOOL)emojiEnabled
225-
{
226-
return emojiEnabled;
227-
}
228-
229224
- (BOOL)hasModifiedBuffer
230225
{
231226
return hasModifiedBuffer;
@@ -698,7 +693,6 @@ - (void)handleMessage:(int)msgid data:(NSData *)data
698693
const void *bytes = [data bytes];
699694
float size = *((float*)bytes); bytes += sizeof(float);
700695
int len = *((int*)bytes); bytes += sizeof(int);
701-
emojiEnabled = *((int*)bytes); bytes += sizeof(int);
702696
NSString *name = [[NSString alloc]
703697
initWithBytes:(void*)bytes length:len
704698
encoding:NSUTF8StringEncoding];
@@ -716,7 +710,6 @@ - (void)handleMessage:(int)msgid data:(NSData *)data
716710
const void *bytes = [data bytes];
717711
float size = *((float*)bytes); bytes += sizeof(float);
718712
int len = *((int*)bytes); bytes += sizeof(int);
719-
emojiEnabled = *((int*)bytes); bytes += sizeof(int);
720713
if (len > 0) {
721714
NSString *name = [[NSString alloc]
722715
initWithBytes:(void*)bytes length:len
@@ -1669,4 +1662,3 @@ - (void)beginSheetModalForWindow:(NSWindow *)window
16691662

16701663
return NO;
16711664
}
1672-

src/option.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1370,7 +1370,7 @@ static struct vimoption
13701370
# if defined(UNIX) && !defined(MACOS)
13711371
{(char_u *)"aegimrLtT", (char_u *)0L}
13721372
# elif defined(FEAT_GUI_MACVIM)
1373-
{(char_u *)"eEgmrL", (char_u *)0L}
1373+
{(char_u *)"egmrL", (char_u *)0L}
13741374
# else
13751375
{(char_u *)"egmrLtT", (char_u *)0L}
13761376
# endif

src/option.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,7 @@
237237
#define GO_FOOTER 'F' /* add footer */
238238
#define GO_VERTICAL 'v' /* arrange dialog buttons vertically */
239239
#define GO_NOCAPTION 'C' /* remove caption bar */
240-
#define GO_EMOJI 'E' /* use emoji */
241-
#define GO_ALL "aAbcCeEfFghilmMprtTv" /* all possible flags for 'go' */
240+
#define GO_ALL "aAbcCefFghilmMprtTv" /* all possible flags for 'go' */
242241

243242
/* flags for 'comments' option */
244243
#define COM_NEST 'n' /* comments strings nest */

0 commit comments

Comments
 (0)