comparison src/gui.c @ 4950:ba7db05e1482 v7.3.1220

updated for version 7.3.1220 Problem: MS-Windows: When using wide font italic and bold are not included. Solution: Support wide-bold, wide-italic and wide-bold-italic. (Ken Takata, Taro Muraoka)
author Bram Moolenaar <bram@vim.org>
date Mon, 17 Jun 2013 22:43:25 +0200
parents c4d4f0fc12b9
children bbe4bd64c68c
comparison
equal deleted inserted replaced
4949:57a2859a0414 4950:ba7db05e1482
406 gui.bold_font = NOFONT; 406 gui.bold_font = NOFONT;
407 gui.ital_font = NOFONT; 407 gui.ital_font = NOFONT;
408 gui.boldital_font = NOFONT; 408 gui.boldital_font = NOFONT;
409 # ifdef FEAT_XFONTSET 409 # ifdef FEAT_XFONTSET
410 gui.fontset = NOFONTSET; 410 gui.fontset = NOFONTSET;
411 # endif
412 #endif
413 #ifdef FEAT_MBYTE
414 gui.wide_font = NOFONT;
415 # ifndef FEAT_GUI_GTK
416 gui.wide_bold_font = NOFONT;
417 gui.wide_ital_font = NOFONT;
418 gui.wide_boldital_font = NOFONT;
411 # endif 419 # endif
412 #endif 420 #endif
413 421
414 #ifdef FEAT_MENU 422 #ifdef FEAT_MENU
415 # ifndef FEAT_GUI_GTK 423 # ifndef FEAT_GUI_GTK
1010 else 1018 else
1011 # endif 1019 # endif
1012 gui.wide_font = font; 1020 gui.wide_font = font;
1013 # ifdef FEAT_GUI_MSWIN 1021 # ifdef FEAT_GUI_MSWIN
1014 gui_mch_wide_font_changed(); 1022 gui_mch_wide_font_changed();
1023 # else
1024 /*
1025 * TODO: setup wide_bold_font, wide_ital_font and wide_boldital_font to
1026 * support those fonts for 'guifontwide'.
1027 */
1015 # endif 1028 # endif
1016 return OK; 1029 return OK;
1017 } 1030 }
1018 #endif 1031 #endif
1019 1032
2178 guicolor_T fg_color; 2191 guicolor_T fg_color;
2179 guicolor_T bg_color; 2192 guicolor_T bg_color;
2180 guicolor_T sp_color; 2193 guicolor_T sp_color;
2181 #if !defined(MSWIN16_FASTTEXT) && !defined(FEAT_GUI_GTK) 2194 #if !defined(MSWIN16_FASTTEXT) && !defined(FEAT_GUI_GTK)
2182 GuiFont font = NOFONT; 2195 GuiFont font = NOFONT;
2196 # ifdef FEAT_MBYTE
2197 GuiFont wide_font = NOFONT;
2198 # endif
2183 # ifdef FEAT_XFONTSET 2199 # ifdef FEAT_XFONTSET
2184 GuiFontset fontset = NOFONTSET; 2200 GuiFontset fontset = NOFONTSET;
2185 # endif 2201 # endif
2186 #endif 2202 #endif
2187 attrentry_T *aep = NULL; 2203 attrentry_T *aep = NULL;
2267 font = gui.ital_font; 2283 font = gui.ital_font;
2268 hl_mask_todo &= ~HL_ITALIC; 2284 hl_mask_todo &= ~HL_ITALIC;
2269 } 2285 }
2270 else 2286 else
2271 font = gui.norm_font; 2287 font = gui.norm_font;
2288
2289 # ifdef FEAT_MBYTE
2290 /*
2291 * Choose correct wide_font by font. wide_font should be set with font
2292 * at same time in above block. But it will make many "ifdef" nasty
2293 * blocks. So we do it here.
2294 */
2295 if (font == gui.boldital_font && gui.wide_boldital_font)
2296 wide_font = gui.wide_boldital_font;
2297 else if (font == gui.bold_font && gui.wide_bold_font)
2298 wide_font = gui.wide_bold_font;
2299 else if (font == gui.ital_font && gui.wide_ital_font)
2300 wide_font = gui.wide_ital_font;
2301 else if (font == gui.norm_font && gui.wide_font)
2302 wide_font = gui.wide_font;
2303 # endif
2304
2272 } 2305 }
2273 # ifdef FEAT_XFONTSET 2306 # ifdef FEAT_XFONTSET
2274 if (fontset != NOFONTSET) 2307 if (fontset != NOFONTSET)
2275 gui_mch_set_fontset(fontset); 2308 gui_mch_set_fontset(fontset);
2276 else 2309 else
2405 cn = utf_char2cells(c); 2438 cn = utf_char2cells(c);
2406 if (cn > 1 2439 if (cn > 1
2407 # ifdef FEAT_XFONTSET 2440 # ifdef FEAT_XFONTSET
2408 && fontset == NOFONTSET 2441 && fontset == NOFONTSET
2409 # endif 2442 # endif
2410 && gui.wide_font != NOFONT) 2443 && wide_font != NOFONT)
2411 curr_wide = TRUE; 2444 curr_wide = TRUE;
2412 else 2445 else
2413 curr_wide = FALSE; 2446 curr_wide = FALSE;
2414 comping = utf_iscomposing(c); 2447 comping = utf_iscomposing(c);
2415 if (!comping) /* count cells from non-composing chars */ 2448 if (!comping) /* count cells from non-composing chars */
2439 else 2472 else
2440 thislen = i - start + cl; 2473 thislen = i - start + cl;
2441 if (thislen > 0) 2474 if (thislen > 0)
2442 { 2475 {
2443 if (prev_wide) 2476 if (prev_wide)
2444 gui_mch_set_font(gui.wide_font); 2477 gui_mch_set_font(wide_font);
2445 gui_mch_draw_string(gui.row, scol, s + start, thislen, 2478 gui_mch_draw_string(gui.row, scol, s + start, thislen,
2446 draw_flags); 2479 draw_flags);
2447 if (prev_wide) 2480 if (prev_wide)
2448 gui_mch_set_font(font); 2481 gui_mch_set_font(font);
2449 start += thislen; 2482 start += thislen;