summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-09-29 12:38:54 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-09-29 12:38:54 (GMT)
commit5020e5e41bb04e9bde15b10902c3dd8edcf0b1eb (patch)
tree27b23d9828d8e560c051b9ff8b3130101c014b23 /win
parent5ae24215a70e8cd5bdbd14ad619bd4230bd22f9a (diff)
parent4c158f250ca869188d30dcf7628676f0b0de236f (diff)
downloadtk-5020e5e41bb04e9bde15b10902c3dd8edcf0b1eb.zip
tk-5020e5e41bb04e9bde15b10902c3dd8edcf0b1eb.tar.gz
tk-5020e5e41bb04e9bde15b10902c3dd8edcf0b1eb.tar.bz2
Fix [6c0d7aec67]: unicode text input Windows 8
Diffstat (limited to 'win')
-rw-r--r--win/tkWinFont.c18
-rw-r--r--win/tkWinKey.c2
-rw-r--r--win/tkWinX.c11
3 files changed, 20 insertions, 11 deletions
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 10ea1b9..021ae1c 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -26,9 +26,9 @@
* Under Windows, a "font family" is uniquely identified by its face name.
*/
-#define FONTMAP_SHIFT 10
+#define FONTMAP_SHIFT 12
-#define FONTMAP_PAGES (1 << (sizeof(Tcl_UniChar)*8 - FONTMAP_SHIFT))
+#define FONTMAP_PAGES (1 << (21 - FONTMAP_SHIFT))
#define FONTMAP_BITSPERPAGE (1 << FONTMAP_SHIFT)
typedef struct FontFamily {
@@ -828,7 +828,7 @@ Tk_MeasureChars(
HFONT oldFont;
WinFont *fontPtr;
int curX, moretomeasure;
- Tcl_UniChar ch;
+ int ch;
SIZE size;
FontFamily *familyPtr;
Tcl_DString runString;
@@ -859,7 +859,7 @@ Tk_MeasureChars(
start = source;
end = start + numBytes;
for (p = start; p < end; ) {
- next = p + Tcl_UtfToUniChar(p, &ch);
+ next = p + TkUtfToUniChar(p, &ch);
thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr);
if (thisSubFontPtr != lastSubFontPtr) {
familyPtr = lastSubFontPtr->familyPtr;
@@ -921,7 +921,7 @@ Tk_MeasureChars(
familyPtr = lastSubFontPtr->familyPtr;
Tcl_DStringInit(&runString);
for (p = start; p < end; ) {
- next = p + Tcl_UtfToUniChar(p, &ch);
+ next = p + TkUtfToUniChar(p, &ch);
Tcl_UtfToExternal(NULL, familyPtr->encoding, p,
(int) (next - p), 0, NULL, buf, sizeof(buf), NULL,
&dstWrote, NULL);
@@ -970,13 +970,13 @@ Tk_MeasureChars(
*/
const char *lastWordBreak = NULL;
- Tcl_UniChar ch2;
+ int ch2;
end = p;
p = source;
ch = ' ';
while (p < end) {
- next = p + Tcl_UtfToUniChar(p, &ch2);
+ next = p + TkUtfToUniChar(p, &ch2);
if ((ch != ' ') && (ch2 == ' ')) {
lastWordBreak = p;
}
@@ -1443,7 +1443,7 @@ MultiFontTextOut(
* string when drawing. */
double angle)
{
- Tcl_UniChar ch;
+ int ch;
SIZE size;
HFONT oldFont;
FontFamily *familyPtr;
@@ -1458,7 +1458,7 @@ MultiFontTextOut(
end = source + numBytes;
for (p = source; p < end; ) {
- next = p + Tcl_UtfToUniChar(p, &ch);
+ next = p + TkUtfToUniChar(p, &ch);
thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr);
if (thisSubFontPtr != lastSubFontPtr) {
if (p > source) {
diff --git a/win/tkWinKey.c b/win/tkWinKey.c
index 89b5d29..31faea0 100644
--- a/win/tkWinKey.c
+++ b/win/tkWinKey.c
@@ -100,7 +100,7 @@ TkpGetString(
} else if (keyEv->send_event == -3) {
/*
- * Special case for WM_UNICHAR.
+ * Special case for WM_UNICHAR and win2000 multi-lingal IME input
*/
len = TkUniCharToUtf(keyEv->keycode, buf);
diff --git a/win/tkWinX.c b/win/tkWinX.c
index 7451806..2dc3b63 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -1526,7 +1526,7 @@ TkWinGetUnicodeEncoding(void)
*
* HandleIMEComposition --
*
- * This function works around a definciency in some versions of Windows
+ * This function works around a deficiency in some versions of Windows
* 2000 to make it possible to entry multi-lingual characters under all
* versions of Windows 2000.
*
@@ -1556,6 +1556,7 @@ HandleIMEComposition(
{
HIMC hIMC;
int n;
+ int high = 0;
if ((lParam & GCS_RESULTSTR) == 0) {
/*
@@ -1612,6 +1613,14 @@ HandleIMEComposition(
event.xkey.keycode = buff[i++];
+ if ((event.xkey.keycode & 0xfc00) == 0xd800) {
+ high = ((event.xkey.keycode & 0x3ff) << 10) + 0x10000;
+ break;
+ } else if (high && (event.xkey.keycode & 0xfc00) == 0xdc00) {
+ event.xkey.keycode &= 0x3ff;
+ event.xkey.keycode += high;
+ high = 0;
+ }
event.type = KeyPress;
Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);