Hi,

When 'guifontwide' is set, bold or italic fonts are not used for
wide characters even they are selected by syntax highlighting.
I and Taro MURAOKA wrote a patch for that. Please apply Taro's
correct-ifdef-indent.diff(*) before this patch.
(*) https://groups.google.com/d/msg/vim_dev/D4mMcMFP7ak/N-Yy8y3lpLwJ

Note that this patch only fixes the problem on Windows.
We wrote a comment for other OSes in the patch.

Best regards,
Ken Takata

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


# HG changeset patch
# Parent 00adca52aedd80488712f27b825910ea338bc6fb

diff --git a/src/gui.c b/src/gui.c
--- a/src/gui.c
+++ b/src/gui.c
@@ -410,6 +410,14 @@
     gui.fontset = NOFONTSET;
 # endif
 #endif
+#ifdef FEAT_MBYTE
+    gui.wide_font = NOFONT;
+# ifndef FEAT_GUI_GTK
+    gui.wide_bold_font = NOFONT;
+    gui.wide_ital_font = NOFONT;
+    gui.wide_boldital_font = NOFONT;
+# endif
+#endif
 
 #ifdef FEAT_MENU
 # ifndef FEAT_GUI_GTK
@@ -1004,6 +1012,11 @@
 	gui.wide_font = font;
 # ifdef FEAT_GUI_MSWIN
     gui_mch_wide_font_changed();
+# else
+    /*
+     * TODO: setup wide_bold_font, wide_ital_font and wide_boldital_font to
+     * support those fonts for 'guifontwide'.
+     */
 # endif
     return OK;
 }
@@ -2172,6 +2185,9 @@
     guicolor_T	sp_color;
 #if !defined(MSWIN16_FASTTEXT) && !defined(FEAT_GUI_GTK)
     GuiFont	font = NOFONT;
+# ifdef FEAT_MBYTE
+    GuiFont	wide_font = NOFONT;
+# endif
 # ifdef FEAT_XFONTSET
     GuiFontset	fontset = NOFONTSET;
 # endif
@@ -2261,6 +2277,23 @@
 	}
 	else
 	    font = gui.norm_font;
+
+# ifdef FEAT_MBYTE
+	/*
+	 * Choose correct wide_font by font.  wide_font should be set with font
+	 * at same time in above block.  But it will make many "ifdef" nasty
+	 * blocks.  So we do it here.
+	 */
+	if (font == gui.boldital_font && gui.wide_boldital_font)
+	    wide_font = gui.wide_boldital_font;
+	else if (font == gui.bold_font && gui.wide_bold_font)
+	    wide_font = gui.wide_bold_font;
+	else if (font == gui.ital_font && gui.wide_ital_font)
+	    wide_font = gui.wide_ital_font;
+	else if (font == gui.norm_font && gui.wide_font)
+	    wide_font = gui.wide_font;
+# endif
+
     }
 # ifdef FEAT_XFONTSET
     if (fontset != NOFONTSET)
@@ -2399,7 +2432,7 @@
 #  ifdef FEAT_XFONTSET
 		    && fontset == NOFONTSET
 #  endif
-		    && gui.wide_font != NOFONT)
+		    && wide_font != NOFONT)
 		curr_wide = TRUE;
 	    else
 		curr_wide = FALSE;
@@ -2433,7 +2466,7 @@
 		if (thislen > 0)
 		{
 		    if (prev_wide)
-			gui_mch_set_font(gui.wide_font);
+			gui_mch_set_font(wide_font);
 		    gui_mch_draw_string(gui.row, scol, s + start, thislen,
 								  draw_flags);
 		    if (prev_wide)
diff --git a/src/gui.h b/src/gui.h
--- a/src/gui.h
+++ b/src/gui.h
@@ -311,7 +311,12 @@
 # endif
 #endif
 #ifdef FEAT_MBYTE
-    GuiFont	wide_font;	    /* 'guifontwide' font */
+    GuiFont	wide_font;	    /* Normal 'guifontwide' font */
+# ifndef FEAT_GUI_GTK
+    GuiFont	wide_bold_font;	    /* Bold 'guifontwide' font */
+    GuiFont	wide_ital_font;	    /* Italic 'guifontwide' font */
+    GuiFont	wide_boldital_font; /* Bold-Italic 'guifontwide' font */
+# endif
 #endif
 #ifdef FEAT_XFONTSET
     GuiFontset	fontset;	    /* set of fonts for multi-byte chars */
diff --git a/src/gui_w48.c b/src/gui_w48.c
--- a/src/gui_w48.c
+++ b/src/gui_w48.c
@@ -3144,9 +3144,43 @@
     void
 gui_mch_wide_font_changed()
 {
+# ifndef MSWIN16_FASTTEXT
+    LOGFONT lf;
+# endif
+
 # ifdef FEAT_MBYTE_IME
     update_im_font();
 # endif
+
+# ifndef MSWIN16_FASTTEXT
+    gui_mch_free_font(gui.wide_ital_font);
+    gui.wide_ital_font = NOFONT;
+    gui_mch_free_font(gui.wide_bold_font);
+    gui.wide_bold_font = NOFONT;
+    gui_mch_free_font(gui.wide_boldital_font);
+    gui.wide_boldital_font = NOFONT;
+
+    if (gui.wide_font
+	&& GetObject((HFONT)gui.wide_font, sizeof(lf), &lf))
+    {
+	if (!lf.lfItalic)
+	{
+	    lf.lfItalic = TRUE;
+	    gui.wide_ital_font = get_font_handle(&lf);
+	    lf.lfItalic = FALSE;
+	}
+	if (lf.lfWeight < FW_BOLD)
+	{
+	    lf.lfWeight = FW_BOLD;
+	    gui.wide_bold_font = get_font_handle(&lf);
+	    if (!lf.lfItalic)
+	    {
+		lf.lfItalic = TRUE;
+		gui.wide_boldital_font = get_font_handle(&lf);
+	    }
+	}
+    }
+# endif
 }
 #endif
 

Raspunde prin e-mail lui