@@ -147,17 +147,13 @@ - (id)initWithFrame:(NSRect)frame
147
147
}
148
148
cgLayerLock = [NSLock new ];
149
149
150
- // NOTE! It does not matter which font is set here, Vim will set its
151
- // own font on startup anyway. Just set some bogus values.
152
- font = [[NSFont userFixedPitchFontOfSize: 0 ] retain ];
153
- cellSize.width = cellSize.height = 1 ;
154
-
155
150
// NOTE: If the default changes to 'NO' then the intialization of
156
151
// p_antialias in option.c must change as well.
157
152
antialias = YES ;
158
153
159
154
drawData = [[NSMutableArray alloc ] init ];
160
155
fontCache = [[NSMutableArray alloc ] init ];
156
+ [self setFont: [NSFont userFixedPitchFontOfSize: 0 ]];
161
157
162
158
helper = [[MMTextViewHelper alloc ] init ];
163
159
[helper setTextView: self ];
@@ -301,18 +297,13 @@ - (NSRect)rectForColumnsInRange:(NSRange)range
301
297
302
298
- (void )setFont : (NSFont *)newFont
303
299
{
304
- if (!( newFont && font != newFont) )
300
+ if (!newFont || [ font isEqual: newFont] )
305
301
return ;
306
302
307
303
double em = round (defaultAdvanceForFont (newFont));
308
- double pt = round ([newFont pointSize ]);
309
-
310
- CTFontDescriptorRef desc = CTFontDescriptorCreateWithNameAndSize ((CFStringRef)[newFont fontName ], pt);
311
- CTFontRef fontRef = CTFontCreateWithFontDescriptor (desc, pt, NULL );
312
- CFRelease (desc);
313
304
314
305
[font release ];
315
- font = ( NSFont *)fontRef ;
306
+ font = [newFont retain ] ;
316
307
317
308
float cellWidthMultiplier = [[NSUserDefaults standardUserDefaults ]
318
309
floatForKey: MMCellWidthMultiplierKey];
@@ -324,7 +315,7 @@ - (void)setFont:(NSFont *)newFont
324
315
cellSize.width = columnspace + ceil (em * cellWidthMultiplier);
325
316
cellSize.height = linespace + defaultLineHeightForFont (font);
326
317
327
- fontDescent = ceil (CTFontGetDescent (fontRef ));
318
+ fontDescent = ceil (CTFontGetDescent ((CTFontRef)newFont ));
328
319
329
320
[fontCache removeAllObjects ];
330
321
}
0 commit comments