summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkUtil.c3
-rw-r--r--macosx/tkMacOSXBitmap.c1
-rw-r--r--macosx/tkMacOSXFont.c29
-rw-r--r--macosx/tkMacOSXPrivate.h2
4 files changed, 9 insertions, 26 deletions
diff --git a/generic/tkUtil.c b/generic/tkUtil.c
index 8d2f42e..17ba443 100644
--- a/generic/tkUtil.c
+++ b/generic/tkUtil.c
@@ -1327,7 +1327,8 @@ TkUtfAtIndex(
int ch;
const char *p = Tcl_UtfAtIndex(src, index);
if ((p > src) && (UCHAR(p[-1]) >= 0xF0)) {
- return p + TkUtfToUniChar(p - 1, &ch);
+ --p;
+ return p + TkUtfToUniChar(p, &ch);
}
return p;
}
diff --git a/macosx/tkMacOSXBitmap.c b/macosx/tkMacOSXBitmap.c
index 615192b..2b08235 100644
--- a/macosx/tkMacOSXBitmap.c
+++ b/macosx/tkMacOSXBitmap.c
@@ -317,7 +317,6 @@ TkpGetNativeAppBitmap(
OSType iconType;
if (OSTypeFromString(name, &iconType) == TCL_OK) {
NSString *iconUTI = OSTYPE_TO_UTI(iconType);
- printf("Found image for UTI %s\n", iconUTI.UTF8String);
NSImage *iconImage = [[NSWorkspace sharedWorkspace]
iconForFileType: iconUTI];
pixmap = PixmapFromImage(display, iconImage, NSSizeToCGSize(size));
diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c
index 6f1ae77..44e25d2 100644
--- a/macosx/tkMacOSXFont.c
+++ b/macosx/tkMacOSXFont.c
@@ -133,7 +133,6 @@ static void DrawCharsInContext(Display *display, Drawable drawable,
_string = [[NSString alloc] initWithString:aString];
self.UTF8String = _string.UTF8String;
}
- printf("Initialized with string %s\n", self.UTF8String);
return self;
}
@@ -166,32 +165,16 @@ static void DrawCharsInContext(Display *display, Drawable drawable,
* The DString has not been initialized. Construct it from
* our string's unicode characters.
*/
-
- char buffer[2*TCL_UTF_MAX];
- unsigned int index, length, ch;
+ char *p;
+ int index;
Tcl_DStringInit(&_ds);
-#if TCL_UTF_MAX == 3
- for (index = 0; index < [_string length]; index++) {
- UniChar uni = [_string characterAtIndex: index];
-
- if (CFStringIsSurrogateHighCharacter(uni)) {
- UniChar low = [_string characterAtIndex: ++index];
- ch = CFStringGetLongCharacterForSurrogatePair(uni, low);
- } else {
- ch = uni;
- }
- length = TkUniCharToUtf(ch, buffer);
- Tcl_DStringAppend(&_ds, buffer, length);
- }
-#else
+ Tcl_DStringSetLength(&_ds, 3 * [_string length]);
+ p = Tcl_DStringValue(&_ds);
for (index = 0; index < [_string length]; index++) {
- ch = (int) [_string characterAtIndex: index];
- length = Tcl_UniCharToUtf(ch, buffer);
- Tcl_DStringAppend(&_ds, buffer, length);
+ p += Tcl_UniCharToUtf([_string characterAtIndex: index], p);
}
-
-#endif
+ Tcl_DStringSetLength(&_ds, p - Tcl_DStringValue(&_ds));
}
return _ds;
}
diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h
index a0645f7..be69fcd 100644
--- a/macosx/tkMacOSXPrivate.h
+++ b/macosx/tkMacOSXPrivate.h
@@ -527,7 +527,7 @@ VISIBILITY_HIDDEN
* byte sequence as initial data. So we add a new class which does provide
* such a constructor. It also has a DString property which is a DString whose
* string pointer is a byte sequence encoding the NSString with the current Tk
- * encoding, namely UTF-8 if TCL_MAX >= 4 or CESU-8 if TCL_MAX = 3.
+ * encoding, namely UTF-8 if TCL_UTF_MAX >= 4 or CESU-8 if TCL_UTF_MAX = 3.
*
*---------------------------------------------------------------------------
*/