+
+#if wxUSE_UNICODE
+ // Map the widths for UCS-2 characters back to the UTF-8 input string
+ i = 0;
+ size_t ui = 0;
+ while (i < len) {
+ unsigned char uch = (unsigned char)s[i];
+ positions[i++] = tpos[ui];
+ if (uch >= 0x80) {
+ if (uch < (0x80 + 0x40 + 0x20)) {
+ positions[i++] = tpos[ui];
+ } else {
+ positions[i++] = tpos[ui];
+ positions[i++] = tpos[ui];
+ }
+ }
+ ui++;
+ }
+#else
+
+ // If not unicode then just use the widths we have
+ memcpy(positions, tpos, len * sizeof(*tpos));
+#endif
+
+ delete [] tpos;