@@ -324,10 +324,15 @@ static void TrackUserActivity __ARGS((UINT uMsg));
324324
325325/*
326326 * For control IME.
327+ *
328+ * These LOGFONT used for IME.
327329 */
328330#ifdef FEAT_MBYTE
329331# ifdef USE_IM_CONTROL
332+ /* holds LOGFONT for 'guifontwide' if available, otherwise 'guifont' */
330333static LOGFONT norm_logfont ;
334+ /* holds LOGFONT for 'guifont' always. */
335+ static LOGFONT sub_logfont ;
331336# endif
332337#endif
333338
@@ -3084,6 +3089,39 @@ logfont2name(LOGFONT lf)
30843089 return res ;
30853090}
30863091
3092+
3093+ #ifdef FEAT_MBYTE_IME
3094+ /*
3095+ * Set correct LOGFONT to IME. Use 'guifontwide' if available, otherwise use
3096+ * 'guifont'
3097+ */
3098+ static void
3099+ update_im_font ()
3100+ {
3101+ LOGFONT lf_wide ;
3102+
3103+ if (p_guifontwide != NULL && * p_guifontwide != NUL
3104+ && get_logfont (& lf_wide , p_guifontwide , NULL , TRUE) == OK )
3105+ norm_logfont = lf_wide ;
3106+ else
3107+ norm_logfont = sub_logfont ;
3108+ im_set_font (& norm_logfont );
3109+ }
3110+ #endif
3111+
3112+ #ifdef FEAT_MBYTE
3113+ /*
3114+ * Handler of gui.wide_font (p_guifontwide) changed notification.
3115+ */
3116+ void
3117+ gui_mch_wide_font_changed ()
3118+ {
3119+ #ifdef FEAT_MBYTE_IME
3120+ update_im_font ();
3121+ #endif
3122+ }
3123+ #endif
3124+
30873125/*
30883126 * Initialise vim to use the font with the given name.
30893127 * Return FAIL if the font could not be loaded, OK otherwise.
@@ -3106,9 +3144,10 @@ gui_mch_init_font(char_u *font_name, int fontset)
31063144 font_name = lf .lfFaceName ;
31073145#if defined(FEAT_MBYTE_IME ) || defined(GLOBAL_IME )
31083146 norm_logfont = lf ;
3147+ sub_logfont = lf ;
31093148#endif
31103149#ifdef FEAT_MBYTE_IME
3111- im_set_font ( & lf );
3150+ update_im_font ( );
31123151#endif
31133152 gui_mch_free_font (gui .norm_font );
31143153 gui .norm_font = font ;
0 commit comments