Mercurial > vim
comparison src/gui_w32.c @ 26:404aac550f35 v7.0017
updated for version 7.0017
author | vimboss |
---|---|
date | Thu, 07 Oct 2004 21:02:47 +0000 |
parents | 4102fb4ea781 |
children | f6033dcbaf31 |
comparison
equal
deleted
inserted
replaced
25:8cde1a064c7c | 26:404aac550f35 |
---|---|
1707 { | 1707 { |
1708 return global_ime_get_status(); | 1708 return global_ime_get_status(); |
1709 } | 1709 } |
1710 #endif | 1710 #endif |
1711 | 1711 |
1712 #ifdef FEAT_MBYTE | |
1713 /* | |
1714 * Convert latin9 text to ucs-2. | |
1715 */ | |
1716 static void | |
1717 latin9_to_ucs(char_u *text, int len, WCHAR *unicodebuf) | |
1718 { | |
1719 int c; | |
1720 | |
1721 while (len-- >= 0) | |
1722 { | |
1723 c = *text++; | |
1724 switch (c) | |
1725 { | |
1726 case 0xa4: c = 0x20ac; break; /* euro */ | |
1727 case 0xa6: c = 0x0160; break; /* S hat */ | |
1728 case 0xa8: c = 0x0161; break; /* S -hat */ | |
1729 case 0xb4: c = 0x017d; break; /* Z hat */ | |
1730 case 0xb8: c = 0x017e; break; /* Z -hat */ | |
1731 case 0xbc: c = 0x0152; break; /* OE */ | |
1732 case 0xbd: c = 0x0153; break; /* oe */ | |
1733 case 0xbe: c = 0x0178; break; /* Y */ | |
1734 } | |
1735 *unicodebuf++ = c; | |
1736 } | |
1737 } | |
1738 #endif | |
1712 | 1739 |
1713 #ifdef FEAT_RIGHTLEFT | 1740 #ifdef FEAT_RIGHTLEFT |
1714 /* | 1741 /* |
1715 * What is this for? In the case where you are using Win98 or Win2K or later, | 1742 * What is this for? In the case where you are using Win98 or Win2K or later, |
1716 * and you are using a Hebrew font (or Arabic!), Windows does you a favor and | 1743 * and you are using a Hebrew font (or Arabic!), Windows does you a favor and |
1905 break; | 1932 break; |
1906 | 1933 |
1907 /* Check if the Unicode buffer exists and is big enough. Create it | 1934 /* Check if the Unicode buffer exists and is big enough. Create it |
1908 * with the same lengt as the multi-byte string, the number of wide | 1935 * with the same lengt as the multi-byte string, the number of wide |
1909 * characters is always equal or smaller. */ | 1936 * characters is always equal or smaller. */ |
1910 if ((enc_utf8 || (enc_codepage > 0 && (int)GetACP() != enc_codepage)) | 1937 if ((enc_utf8 |
1938 || (enc_codepage > 0 && (int)GetACP() != enc_codepage) | |
1939 || enc_latin9) | |
1911 && (unicodebuf == NULL || len > unibuflen)) | 1940 && (unicodebuf == NULL || len > unibuflen)) |
1912 { | 1941 { |
1913 vim_free(unicodebuf); | 1942 vim_free(unicodebuf); |
1914 unicodebuf = (WCHAR *)alloc(len * sizeof(WCHAR)); | 1943 unicodebuf = (WCHAR *)alloc(len * sizeof(WCHAR)); |
1915 | 1944 |
1948 } | 1977 } |
1949 ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row), | 1978 ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row), |
1950 foptions, pcliprect, unicodebuf, clen, unicodepdy); | 1979 foptions, pcliprect, unicodebuf, clen, unicodepdy); |
1951 len = cells; /* used for underlining */ | 1980 len = cells; /* used for underlining */ |
1952 } | 1981 } |
1953 else if (enc_codepage > 0 && (int)GetACP() != enc_codepage) | 1982 else if ((enc_codepage > 0 && (int)GetACP() != enc_codepage) || enc_latin9) |
1954 { | 1983 { |
1955 /* If we want to display codepage data, and the current CP is not the | 1984 /* If we want to display codepage data, and the current CP is not the |
1956 * ANSI one, we need to go via Unicode. */ | 1985 * ANSI one, we need to go via Unicode. */ |
1957 if (unicodebuf != NULL) | 1986 if (unicodebuf != NULL) |
1958 { | 1987 { |
1959 len = MultiByteToWideChar(enc_codepage, | 1988 if (enc_latin9) |
1989 latin9_to_ucs(text, len, unicodebuf); | |
1990 else | |
1991 len = MultiByteToWideChar(enc_codepage, | |
1960 MB_PRECOMPOSED, | 1992 MB_PRECOMPOSED, |
1961 (char *)text, len, | 1993 (char *)text, len, |
1962 (LPWSTR)unicodebuf, unibuflen); | 1994 (LPWSTR)unicodebuf, unibuflen); |
1963 if (len != 0) | 1995 if (len != 0) |
1964 ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row), | 1996 ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row), |