Mercurial > vim
comparison src/gui_x11.c @ 717:2fa8cb05b861 v7.0218
updated for version 7.0218
author | vimboss |
---|---|
date | Wed, 08 Mar 2006 21:32:40 +0000 |
parents | 862863033fdd |
children | f40f1a8520ff |
comparison
equal
deleted
inserted
replaced
716:8ae24f338cab | 717:2fa8cb05b861 |
---|---|
109 do \ | 109 do \ |
110 { \ | 110 { \ |
111 if (current_fontset != NULL) \ | 111 if (current_fontset != NULL) \ |
112 XwcDrawString(dpy, win, current_fontset, gc, x, y, (wchar_t *)str, n); \ | 112 XwcDrawString(dpy, win, current_fontset, gc, x, y, (wchar_t *)str, n); \ |
113 else \ | 113 else \ |
114 XDrawString16(dpy, win, gc, x, y, str, n); \ | 114 XDrawString16(dpy, win, gc, x, y, (XChar2b *)str, n); \ |
115 } while (0) | |
116 | |
117 #define XDrawImageString16(dpy, win, gc, x, y, str, n) \ | |
118 do \ | |
119 { \ | |
120 if (current_fontset != NULL) \ | |
121 XwcDrawImageString(dpy, win, current_fontset, gc, x, y, (wchar_t *)str, n); \ | |
122 else \ | |
123 XDrawImageString16(dpy, win, gc, x, y, (XChar2b *)str, n); \ | |
115 } while (0) | 124 } while (0) |
116 | 125 |
117 static int check_fontset_sanity __ARGS((XFontSet fs)); | 126 static int check_fontset_sanity __ARGS((XFontSet fs)); |
118 static int fontset_width __ARGS((XFontSet fs)); | 127 static int fontset_width __ARGS((XFontSet fs)); |
119 static int fontset_ascent __ARGS((XFontSet fs)); | 128 static int fontset_ascent __ARGS((XFontSet fs)); |
2501 int len; | 2510 int len; |
2502 int flags; | 2511 int flags; |
2503 { | 2512 { |
2504 int cells = len; | 2513 int cells = len; |
2505 #ifdef FEAT_MBYTE | 2514 #ifdef FEAT_MBYTE |
2506 static XChar2b *buf = NULL; | 2515 static void *buf = NULL; |
2507 static int buflen = 0; | 2516 static int buflen = 0; |
2508 char_u *p; | 2517 char_u *p; |
2509 int wlen = 0; | 2518 int wlen = 0; |
2510 int c; | 2519 int c; |
2511 | 2520 |
2515 * functions. Need a buffer for the 16 bit characters. Keep it | 2524 * functions. Need a buffer for the 16 bit characters. Keep it |
2516 * between calls, because allocating it each time is slow. */ | 2525 * between calls, because allocating it each time is slow. */ |
2517 if (buflen < len) | 2526 if (buflen < len) |
2518 { | 2527 { |
2519 XtFree((char *)buf); | 2528 XtFree((char *)buf); |
2520 buf = (XChar2b *)XtMalloc(len * sizeof(XChar2b)); | 2529 buf = (void *)XtMalloc(len * (sizeof(XChar2b) < sizeof(wchar_t) |
2530 ? sizeof(wchar_t) : sizeof(XChar2b))); | |
2521 buflen = len; | 2531 buflen = len; |
2522 } | 2532 } |
2523 p = s; | 2533 p = s; |
2524 cells = 0; | 2534 cells = 0; |
2525 while (p < s + len) | 2535 while (p < s + len) |
2526 { | 2536 { |
2527 c = utf_ptr2char(p); | 2537 c = utf_ptr2char(p); |
2528 if (c >= 0x10000) /* show chars > 0xffff as ? */ | 2538 # ifdef FEAT_XFONTSET |
2529 c = 0xbf; | 2539 if (current_fontset != NULL) |
2530 buf[wlen].byte1 = (unsigned)c >> 8; | 2540 { |
2531 buf[wlen].byte2 = c; | 2541 if (c >= 0x10000 && sizeof(wchar_t) <= 2) |
2542 c = 0xbf; /* show chars > 0xffff as ? */ | |
2543 ((wchar_t *)buf)[wlen] = c; | |
2544 } | |
2545 else | |
2546 # endif | |
2547 { | |
2548 if (c >= 0x10000) | |
2549 c = 0xbf; /* show chars > 0xffff as ? */ | |
2550 ((XChar2b *)buf)[wlen].byte1 = (unsigned)c >> 8; | |
2551 ((XChar2b *)buf)[wlen].byte2 = c; | |
2552 } | |
2532 ++wlen; | 2553 ++wlen; |
2533 cells += utf_char2cells(c); | 2554 cells += utf_char2cells(c); |
2534 p += utf_ptr2len(p); | 2555 p += utf_ptr2len(p); |
2535 } | 2556 } |
2536 } | 2557 } |