mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Fix font initialization pulling in extra metadata
Recent fix to font initialization (#927) seems to have caused issues with other fonts. Keep the fix but revert to the old way of font initialization by manually creating a new one with point size to not use the other aspects of the font to keep the behavior consistent with previous behavior Fix #928
This commit is contained in:
@@ -301,9 +301,14 @@ defaultAdvanceForFont(NSFont *font)
|
||||
return;
|
||||
|
||||
double em = round(defaultAdvanceForFont(newFont));
|
||||
double pt = round([newFont pointSize]);
|
||||
|
||||
CTFontDescriptorRef desc = CTFontDescriptorCreateWithNameAndSize((CFStringRef)[newFont fontName], pt);
|
||||
CTFontRef fontRef = CTFontCreateWithFontDescriptor(desc, pt, NULL);
|
||||
CFRelease(desc);
|
||||
|
||||
[font release];
|
||||
font = [newFont retain];
|
||||
font = (NSFont*)fontRef;
|
||||
|
||||
float cellWidthMultiplier = [[NSUserDefaults standardUserDefaults]
|
||||
floatForKey:MMCellWidthMultiplierKey];
|
||||
@@ -315,7 +320,7 @@ defaultAdvanceForFont(NSFont *font)
|
||||
cellSize.width = columnspace + ceil(em * cellWidthMultiplier);
|
||||
cellSize.height = linespace + defaultLineHeightForFont(font);
|
||||
|
||||
fontDescent = ceil(CTFontGetDescent((CTFontRef)newFont));
|
||||
fontDescent = ceil(CTFontGetDescent(fontRef));
|
||||
|
||||
[fontCache removeAllObjects];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user