aboutsummaryrefslogtreecommitdiff
path: root/generic/Image.c
diff options
context:
space:
mode:
authorlecoanet2004-02-20 16:00:40 +0000
committerlecoanet2004-02-20 16:00:40 +0000
commite2266aec808d956592dad8f7904acec7e44e1879 (patch)
tree88ef36a01763197c6ce5da6469dcfd4646cb226e /generic/Image.c
parent2a35f5d4ab6964b1b7047980f05474be4685aa78 (diff)
downloadtkzinc-e2266aec808d956592dad8f7904acec7e44e1879.zip
tkzinc-e2266aec808d956592dad8f7904acec7e44e1879.tar.gz
tkzinc-e2266aec808d956592dad8f7904acec7e44e1879.tar.bz2
tkzinc-e2266aec808d956592dad8f7904acec7e44e1879.tar.xz
Some further tweaking to make the utf stuff not
disturb Perl/Tk.
Diffstat (limited to 'generic/Image.c')
-rw-r--r--generic/Image.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/generic/Image.c b/generic/Image.c
index a0dbc99..7802b31 100644
--- a/generic/Image.c
+++ b/generic/Image.c
@@ -1211,7 +1211,9 @@ SuckGlyphsFromServer(ZnWInfo *wi,
unsigned int width, height, length, pixwidth;
unsigned int i, j;
char str_from[] = " ";
+#ifndef PTK
char str_utf[8];
+#endif
unsigned char *bitmapData = NULL;
unsigned int x, y;
int num_chars, written, spanLength=0;
@@ -1244,12 +1246,14 @@ SuckGlyphsFromServer(ZnWInfo *wi,
width = 0;
for (i = 0; i < myfontinfo->num_glyphs; i++) {
*str_from = i + myfontinfo->min_char;
-#ifndef PTK
+#ifdef PTK
+ Tk_MeasureChars(font, str_from, 1, 0, TK_AT_LEAST_ONE, &length);
+#else
Tcl_ExternalToUtf(wi->interp, enc, str_from, 1,
TCL_ENCODING_START|TCL_ENCODING_END,
NULL, str_utf, 8, NULL, &written, NULL);
+ Tk_MeasureChars(font, str_utf, written, 0, TK_AT_LEAST_ONE, &length);
#endif
- Tk_MeasureChars(font, str_utf, 1, 0, TK_AT_LEAST_ONE, &length);
width = MAX(width, length);
}
@@ -1285,12 +1289,14 @@ SuckGlyphsFromServer(ZnWInfo *wi,
numToGrab = 0;
for (i = 0; i < myfontinfo->num_glyphs; i++) {
*str_from = i + myfontinfo->min_char;
-#ifndef PTK
+#ifdef PTK
+ Tk_MeasureChars(font, str_from, 1, 0, TK_AT_LEAST_ONE, &charWidth);
+#else
Tcl_ExternalToUtf(wi->interp, enc, str_from, 1,
TCL_ENCODING_START|TCL_ENCODING_END,
NULL, str_utf, 8, NULL, &written, NULL);
-#endif
Tk_MeasureChars(font, str_utf, written, 0, TK_AT_LEAST_ONE, &charWidth);
+#endif
myfontinfo->glyph[i].width = charWidth;
myfontinfo->glyph[i].height = height;
@@ -1299,8 +1305,13 @@ SuckGlyphsFromServer(ZnWInfo *wi,
myfontinfo->glyph[i].advance = charWidth;
myfontinfo->glyph[i].bitmap = NULL;
if (charWidth != 0) {
+#ifdef PTK
+ Tk_DrawChars(wi->dpy, offscreen, xgc, font, str_from, 1,
+ (int) (8*maxSpanLength*numToGrab), myfontinfo->ascent);
+#else
Tk_DrawChars(wi->dpy, offscreen, xgc, font, str_utf, written,
(int) (8*maxSpanLength*numToGrab), myfontinfo->ascent);
+#endif
grabList[numToGrab] = i;
numToGrab++;
}