| Ticket UUID: | 515857 | |||
| Title: | Text. Underline/overstrike & non-latin font | |||
| Type: | Patch | Version: | None | |
| Submitter: | andy_lennard | Created on: | 2002-02-11 11:48:39 | |
| Subsystem: | 06. Canvas Postscript | Assigned To: | jenglish | |
| Priority: | 6 | Severity: | Minor | |
| Status: | Open | Last Modified: | 2016-08-22 08:40:34 | |
| Resolution: | None | Closed By: | nobody | |
| Closed on: | ||||
| Description: |
If a text item is requested to be underlined or
overstruck, then this is not reflected in the
generated postscript.
Additionally, if a font such as ZapfDingbats is used,
that does not have a Latin encoding, this is not shown
when the postscript is displayed.
I have made some changes to the text handling that
appears to resolve these problems, and I
enclose 'diff' output for the files I have changed
from the 8.4a3 distribution.
diff tkCanvPs.c tkCanvPs.c.orig
210,215d209
< % First test the encoding for this font.\n\
< % If this is a Latin font at position 65 will be
the encoding for\n\
< % the letter \"A\".\n\
< % If it isn't a latin font, don't re-encode it.\n\
< dup /Encoding get 65 get (A) eq {\n\
< % Yes, this is a Latin font, re-encode it...\n\
227d220
< }if\n\
359,360d351
< /overstrike exch def\n\
< /underline exch def\n\
407,410c398
< % Get the width of the characters to be
displayed in case we need\n\
< % to underline or overstrike them.\n\
< dup stringwidth pop dup /strwid exch def\n\
< \n\
---
> dup stringwidth pop\n\
433,478d420
< \n\
< overstrike {\n\
< newpath\n\
< currentfont /FontInfo get /fontinfo exch
def % get current font info\n\
< currentfont /FontMatrix get /fontmatrix
exch def % and the font transformation matrix\n\
< \n\
< fontinfo /UnderlineThickness
get % get the underline thickness\n\
< 0
exch % put
in a dummy x value for dtransform\n\
< fontmatrix
dtransform % scale
according to font size\n\
< 2
mul % make
a bit thicker...\n\
< /overstrikethickness exch
def % and save\n\
<
pop % pop
the dummy x
< \n\
< 0 0
moveto % step
back to the start of the chars we drew\n\
< 0 baseline height 2 div sub
rmoveto % move to half-way up the
characters\n\
<
currentlinewidth %
save the current line width\n\
< overstrikethickness
setlinewidth % set the desired
underline thickness\n\
< strwid 0
rlineto % underline
the characters\n\
< stroke\n\
<
setlinewidth %
restore the original line width\n\
< } if\n\
< \n\
< underline {\n\
< newpath\n\
< currentfont /FontInfo get /fontinfo exch
def % get current font info\n\
< currentfont /FontMatrix get /fontmatrix
exch def % and the font transformation matrix\n\
< \n\
< fontinfo /UnderlinePosition
get % get the underline position\n\
< 0
exch % put
in a dummy x value for dtransform\n\
< fontmatrix dtransform /underlinepos exch
def % scale according to font size\n\
<
pop % pop
the dummy x
< \n\
< fontinfo /UnderlineThickness
get % and get the underline
thickness\n\
< 0 exch\n\
< fontmatrix dtransform /underlinethickness
exch def\n\
< pop\n\
< \n\
< 0 0
moveto % step
back to the start of the chars we drew\n\
< 0 0 underlinepos add
rmoveto % move down a bit\n\
<
currentlinewidth %
save the current line width\n\
< underlinethickness
setlinewidth % set the desired
underline thickness\n\
< strwid 0
rlineto % underline
the characters\n\
< stroke\n\
<
setlinewidth %
restore the original line width\n\
< } if\n\
< \n\
diff tkCanvText.c tkCanvText.c.orig
20d19
< #include "tkFont.h"
1507c1506
< sprintf(buffer, "] %d %g %g %s %s %s %s
DrawText\n",
---
> sprintf(buffer, "] %d %g %g %s %s DrawText\n",
1509,1511c1508
< ((stipple == None) ? "false" : "true"),
< ((((TkFont *) textPtr->tkfont)-
>fa.underline) ? "true" : "false"),
< ((((TkFont *) textPtr->tkfont)-
>fa.overstrike) ? "true" : "false") );
---
> ((stipple == None) ? "false" : "true"));
| |||
| User Comments: |
andy_lennard added on 2002-02-26 13:38:42:
File Added - 18452: tk_changes.tar.gz Logged In: YES user_id=35092 Rather than a file of differences, I've attached a gzipped tar of the original files from the 8.4a3 distribution, and my modified versions. I hope that is more useful. Of course, I may be wrong, and often am... thanks. hobbs added on 2002-02-26 08:21:29: Logged In: YES user_id=72656 can I get that as an attached file, with diff -u settings? That will make it much easier to apply. thanks. | |||
Attachments:
- tk_changes.tar.gz [download] added by andy_lennard on 2002-02-26 13:38:42. [details]
