summaryrefslogtreecommitdiff
path: root/src/gui_w32.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2006-03-06 23:29:24 +0000
committerBram Moolenaar <Bram@vim.org>2006-03-06 23:29:24 +0000
commit362e1a30c6f3527d5d0efc328c2fb448290cd6fc (patch)
tree91c408352947bec09aee2032949ef1acef606d15 /src/gui_w32.c
parent768b8c4dbcb3cdaccab87daa833ab176a438cc3c (diff)
downloadvim-git-362e1a30c6f3527d5d0efc328c2fb448290cd6fc.tar.gz
updated for version 7.0216v7.0216
Diffstat (limited to 'src/gui_w32.c')
-rw-r--r--src/gui_w32.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/gui_w32.c b/src/gui_w32.c
index 234afe1f3..46ca5468d 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -2025,12 +2025,26 @@ gui_mch_draw_string(
int clen; /* string length up to composing char */
int cells; /* cell width of string up to composing char */
int cw; /* width of current cell */
+ int c;
+ int xtra;
cells = 0;
for (clen = 0; i < len; )
{
- unicodebuf[clen] = utf_ptr2char(text + i);
- cw = utf_char2cells(unicodebuf[clen]);
+ c = utf_ptr2char(text + i);
+ if (c >= 0x10000)
+ {
+ /* Turn into UTF-16 encoding. */
+ unicodebuf[clen] = ((c - 0x10000) >> 10) + 0xD800;
+ unicodebuf[clen + 1] = ((c - 0x10000) & 0x3ff) + 0xDC00;
+ xtra = 1;
+ }
+ else
+ {
+ unicodebuf[clen] = c;
+ xtra = 0;
+ }
+ cw = utf_char2cells(c);
if (cw > 2) /* don't use 4 for unprintable char */
cw = 1;
if (unicodepdy != NULL)
@@ -2039,10 +2053,12 @@ gui_mch_draw_string(
* when the font uses different widths (e.g., bold character
* is wider). */
unicodepdy[clen] = cw * gui.char_width;
+ if (xtra == 1)
+ unicodepdy[clen + 1] = cw * gui.char_width;
}
cells += cw;
i += utfc_ptr2len_len(text + i, len - i);
- ++clen;
+ clen += xtra + 1;
}
ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row),
foptions, pcliprect, unicodebuf, clen, unicodepdy);