mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Fix getfontname()
getfontname() would incorrectly return strings of the form "FONTNAME:SIZE", when it should be returning strings of the form "FONTNAME:hSIZE"--notice the "h" in the last form. To fix this, we change the internal representation of the font name and size to include the "h", and peel it off when actually setting the font.
This commit is contained in:
committed by
Bjorn Winckler
parent
b91903e9bf
commit
bc25430228
@@ -991,7 +991,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
|
||||
{
|
||||
NSString *fontName = (NSString *)font;
|
||||
float size = 0;
|
||||
NSArray *components = [fontName componentsSeparatedByString:@":"];
|
||||
NSArray *components = [fontName componentsSeparatedByString:@":h"];
|
||||
if ([components count] == 2) {
|
||||
size = [[components lastObject] floatValue];
|
||||
fontName = [components objectAtIndex:0];
|
||||
|
||||
@@ -1017,7 +1017,7 @@ gui_mch_set_font(GuiFont font)
|
||||
gui_macvim_font_with_name(char_u *name)
|
||||
{
|
||||
if (!name)
|
||||
return (GuiFont)[[NSString alloc] initWithFormat:@"%@:%d",
|
||||
return (GuiFont)[[NSString alloc] initWithFormat:@"%@:h%d",
|
||||
MMDefaultFontName, MMDefaultFontSize];
|
||||
|
||||
NSString *fontName = [NSString stringWithVimString:name];
|
||||
@@ -1055,7 +1055,7 @@ gui_macvim_font_with_name(char_u *name)
|
||||
// can load it. Otherwise we ask NSFont if it can load it.
|
||||
if ([fontName isEqualToString:MMDefaultFontName]
|
||||
|| [NSFont fontWithName:fontName size:size])
|
||||
return [[NSString alloc] initWithFormat:@"%@:%d", fontName, size];
|
||||
return [[NSString alloc] initWithFormat:@"%@:h%d", fontName, size];
|
||||
}
|
||||
|
||||
return NOFONT;
|
||||
|
||||
Reference in New Issue
Block a user