summaryrefslogtreecommitdiffstats
path: root/src/gui_kde_x11.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui_kde_x11.cc')
-rw-r--r--src/gui_kde_x11.cc57
1 files changed, 35 insertions, 22 deletions
diff --git a/src/gui_kde_x11.cc b/src/gui_kde_x11.cc
index 4fe2eee139..77a7f807cb 100644
--- 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 *oldval)//{{{
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, int fontset)//{{{
font = new QFont();
font->fromString( fontname );
*/
- gui_mch_free_font(gui.norm_font);
#ifdef FEAT_XFONTSET
- gui_mch_free_fontset(gui.fontset);
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
- }
-#ifdef FEAT_XFONTSET
- else {
- gui.fontset=font;
- gui.norm_font=NOFONT;
- }
+ 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;
-
+ return FAIL;
if (fontname.contains('*') && fontname.contains('-'))
- return FAIL;
+ return FAIL;
+
+ gui_mch_free_font(gui.norm_font);
+#ifdef FEAT_XFONTSET
+ gui_mch_free_fontset(gui.fontset);
+ gui.fontset = NOFONTSET;
+ if (fontset)
+ {
+ gui.fontset = font;
+ gui.norm_font = NOFONT;
+ }
+ else
+#endif
+ 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 report_error)//{{{
}//}}}
/*
+ * 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.