diff -Naur tk8.3-8.3.3.orig/generic/tkCanvPs.c tk8.3-8.3.3/generic/tkCanvPs.c --- tk8.3-8.3.3.orig/generic/tkCanvPs.c Thu Apr 18 23:49:15 2002 +++ tk8.3-8.3.3/generic/tkCanvPs.c Fri Apr 19 02:45:22 2002 @@ -149,6 +149,33 @@ \n\ \n", /* End of part 1 */ +"/cstringshow {\n\ + {\n\ + dup type /stringtype eq\n\ + { show } { glyphshow }\n\ + ifelse\n\ + }\n\ + forall\n\ +} bind def\n\ +\n\ +\n\ +\n\ +/cstringwidth {\n\ + 0 exch 0 exch\n\ + {\n\ + dup type /stringtype eq\n\ + { stringwidth } { \n\ + currentfont /Encoding get exch 1 exch put (\\001) stringwidth \n\ + }\n\ + ifelse \n\ + exch 3 1 roll add 3 1 roll add exch\n\ + }\n\ + forall\n\ +} bind def\n\ +\n\ +\n\ +\n" + , /* Start of part 2 (2000 characters) */ "% font ISOEncode font\n\ @@ -311,7 +338,7 @@ \n\ /lineLength 0 def\n\ strings {\n\ - stringwidth pop\n\ + cstringwidth pop\n\ dup lineLength gt {/lineLength exch def}", /* End of part 4 */ @@ -346,10 +373,10 @@ % display it.\n\ \n\ strings {\n\ - dup stringwidth pop\n\ + dup cstringwidth pop\n\ justify neg mul 0 moveto\n\ stipple {\n\ -\n\ + \n\ % The text is stippled, so turn it into a path and print\n\ % by calling StippledText, which in turn calls StippleFill.\n\ % Unfortunately, many Postscript interpreters will get\n\ @@ -359,16 +386,30 @@ gsave\n\ /char (X) def\n\ {\n\ - char 0 3 -1 roll put\n\ - currentpoint\n\ - gsave\n\ - char true charpath clip StippleText\n\ - grestore\n\ - char stringwidth translate\n\ - moveto\n\ + dup type /stringtype eq {\n\ + % This segment is a string.\n\ + {\n\ + char 0 3 -1 roll put\n\ + currentpoint\n\ + gsave\n\ + char true charpath clip % StippleText\n\ + grestore\n\ + char stringwidth translate\n\ + moveto\n\ + } forall\n\ + } {\n\ + % This segment is glyph name\n\ + % Temporary override\n\ + currentfont /Encoding get exch 1 exch put\n\ + currentpoint\n\ + gsave (\\001) true charpath clip % StippleText\n\ + grestore\n\ + (\\001) stringwidth translate\n\ + moveto\n\ + } ifelse\n\ } forall\n\ - grestore\n\ - } {show} ifelse\n\ + grestore \n\ + } {cstringshow} ifelse\n\ 0 spacing neg translate\n\ } forall\n\ } bind def\n\ diff -Naur tk8.3-8.3.3.orig/generic/tkFont.c tk8.3-8.3.3/generic/tkFont.c --- tk8.3-8.3.3.orig/generic/tkFont.c Thu Apr 18 23:49:15 2002 +++ tk8.3-8.3.3/generic/tkFont.c Fri Apr 19 01:22:49 2002 @@ -2729,22 +2729,27 @@ Tk_TextLayout layout; /* The layout to be rendered. */ { #define MAXUSE 128 - char buf[MAXUSE+10]; + char buf[MAXUSE+30]; LayoutChunk *chunkPtr; int i, j, used, c, baseline; Tcl_UniChar ch; CONST char *p; TextLayout *layoutPtr; + char uindex[5]="\0\0\0\0"; + char *glyphname; layoutPtr = (TextLayout *) layout; chunkPtr = layoutPtr->chunks; baseline = chunkPtr->y; used = 0; + buf[used++] = '['; buf[used++] = '('; for (i = 0; i < layoutPtr->numChunks; i++) { if (baseline != chunkPtr->y) { buf[used++] = ')'; + buf[used++] = ']'; buf[used++] = '\n'; + buf[used++] = '['; buf[used++] = '('; baseline = chunkPtr->y; } @@ -2765,24 +2770,40 @@ const char *q=p; int charsize; p +=(charsize= Tcl_UtfToUniChar(p,&ch)); - Tcl_UtfToExternal(interp,NULL,q,charsize,0,NULL,one_char,3, - NULL,NULL,NULL); - c = UCHAR(one_char[0]); - /* c = UCHAR( ch & 0xFF) */; - if ((c == '(') || (c == ')') || (c == '\\') || (c < 0x20) - || (c >= UCHAR(0x7f))) { - /* - * Tricky point: the "03" is necessary in the sprintf - * below, so that a full three digits of octal are - * always generated. Without the "03", a number - * following this sequence could be interpreted by - * Postscript as part of this sequence. - */ + if ( Tcl_UtfToExternal(interp,NULL,q,charsize,0,NULL,one_char,2, + NULL,NULL,NULL) == TCL_OK) { + c = UCHAR(one_char[0]); + /* c = UCHAR( ch & 0xFF) */; + if ((c == '(') || (c == ')') || (c == '\\') || (c < 0x20) + || (c >= UCHAR(0x7f))) { + /* + * Tricky point: the "03" is necessary in the sprintf + * below, so that a full three digits of octal are + * always generated. Without the "03", a number + * following this sequence could be interpreted by + * Postscript as part of this sequence. + */ - sprintf(buf + used, "\\%03o", c); - used += 4; + sprintf(buf + used, "\\%03o", c); + used += 4; + } else { + buf[used++] = c; + } } else { - buf[used++] = c; + /* This character doesn't belong to system character set. + * So, we must use full glyph name */ + sprintf(uindex,"%04X",ch); /* endianness? */ + if (glyphname = Tcl_GetVar2( interp , "::tcl::psglyphs",uindex,0)) { + if (used > 0 && buf [used-1] == '(') + --used; + else + buf[used++] = ')'; + buf[used++] = '/'; + while( *glyphname ) + buf[used++] = *glyphname++ ; + buf[used++] = '('; + } + } if (used >= MAXUSE) { buf[used] = '\0'; @@ -2804,6 +2825,7 @@ chunkPtr++; } buf[used++] = ')'; + buf[used++] = ']'; buf[used++] = '\n'; buf[used] = '\0'; Tcl_AppendResult(interp, buf, (char *) NULL);