]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.782 v7.3.782
authorBram Moolenaar <Bram@vim.org>
Wed, 23 Jan 2013 17:37:40 +0000 (18:37 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 23 Jan 2013 17:37:40 +0000 (18:37 +0100)
Problem:    Windows: IME composition may use a wrong font.
Solution:   Use 'guifontwide' for IME when it is set. (Taro Muraoka)

runtime/doc/options.txt
src/gui.c
src/gui_w48.c
src/proto/gui_w16.pro
src/proto/gui_w32.pro
src/version.c

index a4392349876385350284789179ebe43f45db585c..c3cc0871c42ec3888df532553b7800fcb99ceba9 100644 (file)
@@ -3560,6 +3560,10 @@ A jump table for the options with a short description can be found at |Q_op|.
        to set 'guifontwide' at all unless you want to override the choice
        made by Pango/Xft.
 
+       Windows +multibyte only:                *guifontwide_win_mbyte*
+
+       If set and vaild, 'guifontwide' is used for IME instead of 'guifont'.
+
                                                *'guiheadroom'* *'ghr'*
 'guiheadroom' 'ghr'    number  (default 50)
                        global
index 14706553a05da00b7404ede2fade8bd9cc15b221..6e5d58b5c6c480ade9ac5e14c6c21192d7e1a0db 100644 (file)
--- a/src/gui.c
+++ b/src/gui.c
@@ -1002,6 +1002,9 @@ gui_get_wide_font()
     else
 #endif
        gui.wide_font = font;
+#ifdef FEAT_GUI_MSWIN
+    gui_mch_wide_font_changed();
+#endif
     return OK;
 }
 #endif
index 1d380fbf930e08b03511fd0e4acb82bba0a2d902..0a7f367e87e01cb6272f53689eb1c5d07bcef59f 100644 (file)
@@ -323,10 +323,15 @@ static void TrackUserActivity __ARGS((UINT uMsg));
 
 /*
  * For control IME.
+ *
+ * These LOGFONT used for IME.
  */
 #ifdef FEAT_MBYTE
 # ifdef USE_IM_CONTROL
+/* holds LOGFONT for 'guifontwide' if available, otherwise 'guifont' */
 static LOGFONT norm_logfont;
+/* holds LOGFONT for 'guifont' always. */
+static LOGFONT sub_logfont;
 # endif
 #endif
 
@@ -3090,6 +3095,39 @@ logfont2name(LOGFONT lf)
     return res;
 }
 
+
+#ifdef FEAT_MBYTE_IME
+/*
+ * Set correct LOGFONT to IME.  Use 'guifontwide' if available, otherwise use
+ * 'guifont'
+ */
+    static void
+update_im_font()
+{
+    LOGFONT    lf_wide;
+
+    if (p_guifontwide != NULL && *p_guifontwide != NUL
+           && get_logfont(&lf_wide, p_guifontwide, NULL, TRUE) == OK)
+       norm_logfont = lf_wide;
+    else
+       norm_logfont = sub_logfont;
+    im_set_font(&norm_logfont);
+}
+#endif
+
+#ifdef FEAT_MBYTE
+/*
+ * Handler of gui.wide_font (p_guifontwide) changed notification.
+ */
+    void
+gui_mch_wide_font_changed()
+{
+# ifdef FEAT_MBYTE_IME
+    update_im_font();
+# endif
+}
+#endif
+
 /*
  * Initialise vim to use the font with the given name.
  * Return FAIL if the font could not be loaded, OK otherwise.
@@ -3112,9 +3150,10 @@ gui_mch_init_font(char_u *font_name, int fontset)
        font_name = lf.lfFaceName;
 #if defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME)
     norm_logfont = lf;
+    sub_logfont = lf;
 #endif
 #ifdef FEAT_MBYTE_IME
-    im_set_font(&lf);
+    update_im_font();
 #endif
     gui_mch_free_font(gui.norm_font);
     gui.norm_font = font;
index c8cb06590de496ce442fe8250af7c972b795d11a..4c53fad305f1e9f3a83f13ccec9abb53c78885ea 100644 (file)
@@ -50,6 +50,7 @@ void gui_mch_delete_lines __ARGS((int row, int num_lines));
 void gui_mch_insert_lines __ARGS((int row, int num_lines));
 void gui_mch_exit __ARGS((int rc));
 int gui_mch_init_font __ARGS((char_u *font_name, int fontset));
+void gui_mch_wide_font_changed __ARGS((void));
 int gui_mch_maximized __ARGS((void));
 void gui_mch_newfont __ARGS((void));
 void gui_mch_settitle __ARGS((char_u *title, char_u *icon));
index 49690b03e4dc610140fddfb1bbf12beb23c83b97..405dd2859a9cdd9096e742f2a629fb9f12ee827e 100644 (file)
@@ -50,6 +50,7 @@ void gui_mch_delete_lines __ARGS((int row, int num_lines));
 void gui_mch_insert_lines __ARGS((int row, int num_lines));
 void gui_mch_exit __ARGS((int rc));
 int gui_mch_init_font __ARGS((char_u *font_name, int fontset));
+void gui_mch_wide_font_changed __ARGS((void));
 int gui_mch_maximized __ARGS((void));
 void gui_mch_newfont __ARGS((void));
 void gui_mch_settitle __ARGS((char_u *title, char_u *icon));
index a3351c3d0dd40412c880806626f6dee5f8d44cb3..b60be3cd382372b4ccbde50b3dc742810d36a678 100644 (file)
@@ -725,6 +725,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    782,
 /**/
     781,
 /**/