comparison src/gui_w48.c @ 4055:0de969850c06 v7.3.782

updated for version 7.3.782 Problem: Windows: IME composition may use a wrong font. Solution: Use 'guifontwide' for IME when it is set. (Taro Muraoka)
author Bram Moolenaar <bram@vim.org>
date Wed, 23 Jan 2013 18:37:40 +0100
parents 699f8d8f096d
children fbadf0f69877
comparison
equal deleted inserted replaced
4054:806eb14f383c 4055:0de969850c06
321 static void TrackUserActivity __ARGS((UINT uMsg)); 321 static void TrackUserActivity __ARGS((UINT uMsg));
322 #endif 322 #endif
323 323
324 /* 324 /*
325 * For control IME. 325 * For control IME.
326 *
327 * These LOGFONT used for IME.
326 */ 328 */
327 #ifdef FEAT_MBYTE 329 #ifdef FEAT_MBYTE
328 # ifdef USE_IM_CONTROL 330 # ifdef USE_IM_CONTROL
331 /* holds LOGFONT for 'guifontwide' if available, otherwise 'guifont' */
329 static LOGFONT norm_logfont; 332 static LOGFONT norm_logfont;
333 /* holds LOGFONT for 'guifont' always. */
334 static LOGFONT sub_logfont;
330 # endif 335 # endif
331 #endif 336 #endif
332 337
333 #ifdef FEAT_MBYTE_IME 338 #ifdef FEAT_MBYTE_IME
334 static LRESULT _OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData); 339 static LRESULT _OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData);
3088 } 3093 }
3089 3094
3090 return res; 3095 return res;
3091 } 3096 }
3092 3097
3098
3099 #ifdef FEAT_MBYTE_IME
3100 /*
3101 * Set correct LOGFONT to IME. Use 'guifontwide' if available, otherwise use
3102 * 'guifont'
3103 */
3104 static void
3105 update_im_font()
3106 {
3107 LOGFONT lf_wide;
3108
3109 if (p_guifontwide != NULL && *p_guifontwide != NUL
3110 && get_logfont(&lf_wide, p_guifontwide, NULL, TRUE) == OK)
3111 norm_logfont = lf_wide;
3112 else
3113 norm_logfont = sub_logfont;
3114 im_set_font(&norm_logfont);
3115 }
3116 #endif
3117
3118 #ifdef FEAT_MBYTE
3119 /*
3120 * Handler of gui.wide_font (p_guifontwide) changed notification.
3121 */
3122 void
3123 gui_mch_wide_font_changed()
3124 {
3125 # ifdef FEAT_MBYTE_IME
3126 update_im_font();
3127 # endif
3128 }
3129 #endif
3130
3093 /* 3131 /*
3094 * Initialise vim to use the font with the given name. 3132 * Initialise vim to use the font with the given name.
3095 * Return FAIL if the font could not be loaded, OK otherwise. 3133 * Return FAIL if the font could not be loaded, OK otherwise.
3096 */ 3134 */
3097 /*ARGSUSED*/ 3135 /*ARGSUSED*/
3110 3148
3111 if (font_name == NULL) 3149 if (font_name == NULL)
3112 font_name = lf.lfFaceName; 3150 font_name = lf.lfFaceName;
3113 #if defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME) 3151 #if defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME)
3114 norm_logfont = lf; 3152 norm_logfont = lf;
3153 sub_logfont = lf;
3115 #endif 3154 #endif
3116 #ifdef FEAT_MBYTE_IME 3155 #ifdef FEAT_MBYTE_IME
3117 im_set_font(&lf); 3156 update_im_font();
3118 #endif 3157 #endif
3119 gui_mch_free_font(gui.norm_font); 3158 gui_mch_free_font(gui.norm_font);
3120 gui.norm_font = font; 3159 gui.norm_font = font;
3121 current_font_height = lf.lfHeight; 3160 current_font_height = lf.lfHeight;
3122 GetFontSize(font); 3161 GetFontSize(font);