Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!orion.cf.uci.edu!uci-ics!zardoz!dhw68k!felix!tgate!ka3ovk!drilex!axiom!linus!philabs!ttidca!tompkins From: tompkins@ttidca.TTI.COM (Pete Tompkins) Newsgroups: comp.lang.postscript Subject: Re: Underlining text Message-ID: <4621@ttidca.TTI.COM> Date: 21 Jun 89 15:33:10 GMT References: <2439@virgin.UUCP> Distribution: na Organization: Citicorp/TTI, Santa Monica Lines: 40 In-reply-to: bann@virgin.UUCP's message of 17 Jun 89 01:56:42 GMT In article <2439@virgin.UUCP> bann@virgin.UUCP (Roger Bannister) writes: > > Is there anybody on the net that has a postscript procedure that will > underline a string no matter what font or size the string happens to be. > I wrote my own procedure but it just didn't cut it. Roger %!PS % dy string underline - % dy is the distance below the text for the underline (be careful % if you start scaling things) % 'underline' outputs the text and underlines it /underline { gsave dup stringwidth % Throwaway dy (which is zero) and save dx (which is the length string) pop /dx exch def show grestore %The requested distance for the line below the string is still on the stack 0 exch neg rmoveto dx 0 rlineto stroke } def /Times-Roman findfont 18 scalefont setfont 100 500 moveto 4 (Testing underlined text.) underline showpage -- *Pete Tompkins (213) 452-9191 ext. 3000 *Citicorp/TTI *Santa Monica, CA *Path: tompkins@ttidca.tti.com