summaryrefslogtreecommitdiff
path: root/src/gui_w48.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-01-23 18:37:40 +0100
committerBram Moolenaar <Bram@vim.org>2013-01-23 18:37:40 +0100
commit0f2721223e5b97ac250d729b2359471241a3ab7d (patch)
tree0355c81415f413a46efac2f65f6aecb3a68aa2cf /src/gui_w48.c
parent459339662566bcf5ae9892c7dabb9518e7f70f83 (diff)
downloadvim-git-0f2721223e5b97ac250d729b2359471241a3ab7d.tar.gz
updated for version 7.3.782v7.3.782
Problem: Windows: IME composition may use a wrong font. Solution: Use 'guifontwide' for IME when it is set. (Taro Muraoka)
Diffstat (limited to 'src/gui_w48.c')
-rw-r--r--src/gui_w48.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/gui_w48.c b/src/gui_w48.c
index 1d380fbf9..0a7f367e8 100644
--- a/src/gui_w48.c
+++ b/src/gui_w48.c
@@ -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;