@@ -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
10531048recurseDraw (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);
0 commit comments