comparison src/gui_w32.c @ 714:0f9f4761ad9c v7.0216

updated for version 7.0216
author vimboss
date Mon, 06 Mar 2006 23:29:24 +0000
parents 5ad3b5d4ecc0
children f664cc974a7a
comparison
equal deleted inserted replaced
713:0c381fb7846c 714:0f9f4761ad9c
2023 * composing characters. */ 2023 * composing characters. */
2024 int i = 0; 2024 int i = 0;
2025 int clen; /* string length up to composing char */ 2025 int clen; /* string length up to composing char */
2026 int cells; /* cell width of string up to composing char */ 2026 int cells; /* cell width of string up to composing char */
2027 int cw; /* width of current cell */ 2027 int cw; /* width of current cell */
2028 int c;
2029 int xtra;
2028 2030
2029 cells = 0; 2031 cells = 0;
2030 for (clen = 0; i < len; ) 2032 for (clen = 0; i < len; )
2031 { 2033 {
2032 unicodebuf[clen] = utf_ptr2char(text + i); 2034 c = utf_ptr2char(text + i);
2033 cw = utf_char2cells(unicodebuf[clen]); 2035 if (c >= 0x10000)
2036 {
2037 /* Turn into UTF-16 encoding. */
2038 unicodebuf[clen] = ((c - 0x10000) >> 10) + 0xD800;
2039 unicodebuf[clen + 1] = ((c - 0x10000) & 0x3ff) + 0xDC00;
2040 xtra = 1;
2041 }
2042 else
2043 {
2044 unicodebuf[clen] = c;
2045 xtra = 0;
2046 }
2047 cw = utf_char2cells(c);
2034 if (cw > 2) /* don't use 4 for unprintable char */ 2048 if (cw > 2) /* don't use 4 for unprintable char */
2035 cw = 1; 2049 cw = 1;
2036 if (unicodepdy != NULL) 2050 if (unicodepdy != NULL)
2037 { 2051 {
2038 /* Use unicodepdy to make characters fit as we expect, even 2052 /* Use unicodepdy to make characters fit as we expect, even
2039 * when the font uses different widths (e.g., bold character 2053 * when the font uses different widths (e.g., bold character
2040 * is wider). */ 2054 * is wider). */
2041 unicodepdy[clen] = cw * gui.char_width; 2055 unicodepdy[clen] = cw * gui.char_width;
2056 if (xtra == 1)
2057 unicodepdy[clen + 1] = cw * gui.char_width;
2042 } 2058 }
2043 cells += cw; 2059 cells += cw;
2044 i += utfc_ptr2len_len(text + i, len - i); 2060 i += utfc_ptr2len_len(text + i, len - i);
2045 ++clen; 2061 clen += xtra + 1;
2046 } 2062 }
2047 ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row), 2063 ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row),
2048 foptions, pcliprect, unicodebuf, clen, unicodepdy); 2064 foptions, pcliprect, unicodebuf, clen, unicodepdy);
2049 len = cells; /* used for underlining */ 2065 len = cells; /* used for underlining */
2050 } 2066 }