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:
John Szakmeister
2013-10-11 10:59:33 -04:00
committed by Bjorn Winckler
parent b91903e9bf
commit bc25430228
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -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];
+2 -2
View File
@@ -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;