Mercurial > vim
diff src/gui_kde_x11.cc @ 37:fdf55076c53f
updated for version 7.0022
author | vimboss |
---|---|
date | Sun, 12 Dec 2004 11:33:30 +0000 |
parents | 3f44e9abe4ec |
children | c75153d791d0 |
line wrap: on
line diff
--- a/src/gui_kde_x11.cc +++ b/src/gui_kde_x11.cc @@ -384,7 +384,7 @@ gui_mch_open()//{{{ vmw->menuBar()->insertItem("&KVim", vmw->w->menu); #endif if (startfont!=NULL) - gui_mch_init_font((char_u*)startfont->latin1(),0); + gui_mch_init_font((char_u*)startfont->latin1(), FALSE); if (startsize!=NULL) vmw->resize(startsize->width(), startsize->height()); @@ -558,9 +558,9 @@ char_u *gui_mch_font_dialog (char_u *old gui_mch_init_font(char_u * font_name, int fontset)//{{{ { QString fontname; - GuiFont font=NULL; + GuiFont font = NULL; - if (font_name==NULL) + if (font_name == NULL) { #if 0 #if QT_VERSION>=300 @@ -589,31 +589,30 @@ gui_mch_init_font(char_u * font_name, in font = new QFont(); font->fromString( fontname ); */ +#ifdef FEAT_XFONTSET + if (fontset) + font = gui_mch_get_fontset(font_name, TRUE, TRUE); + if (font == NULL) +#endif + font = gui_mch_get_font(font_name, FALSE); + + if (font == NULL) + return FAIL; + if (fontname.contains('*') && fontname.contains('-')) + return FAIL; + gui_mch_free_font(gui.norm_font); #ifdef FEAT_XFONTSET gui_mch_free_fontset(gui.fontset); + gui.fontset = NOFONTSET; if (fontset) - font = gui_mch_get_fontset(font_name,TRUE,TRUE); -#endif - if (font == NULL) { - font = gui_mch_get_font(font_name,FALSE); - gui.norm_font = font; -#ifdef FEAT_XFONTSET - gui.fontset=NOFONTSET; -#endif + { + gui.fontset = font; + gui.norm_font = NOFONT; } -#ifdef FEAT_XFONTSET - else { - gui.fontset=font; - gui.norm_font=NOFONT; - } + else #endif - - if (font == NULL) - return FAIL; - - if (fontname.contains('*') && fontname.contains('-')) - return FAIL; + gui.norm_font = font; /* Compute the width of the character cell. Some fonts include * double-width characters. Use the width of ASCII characters to find @@ -661,6 +660,20 @@ gui_mch_get_font(char_u * name, int repo }//}}} /* + * Return the name of font "font" in allocated memory. + * Don't know how to get the actual name, thus use the provided name. + */ + char_u * +gui_mch_get_fontname(font, name) + GuiFont font; + char_u *name; +{ + if (name == NULL) + return NULL; + return vim_strsave(name); +} + +/* * Set the current text font. * Since we create all GC on demand, we use just gui.current_font to * indicate the desired current font.