From: zaphod@ctrg.rri.uwo.ca (Lance R. Bailey)
Subject: Re: Underline font
Reply-To: zaphod@ctrg.rri.uwo.ca
Organization: University of Western Ontario
Distribution: na
Date: Fri, 10 Apr 1992 09:51:57 GMT

In article <3245@vidiot.UUCP> brown@vidiot.UUCP (Vidiot) writes:
>In article <1992Apr7.024443.20428@serval.net.wsu.edu>  
hakimian@yoda.eecs.wsu.edu (Karl Hakimian - staff) writes:
><This may be a stupid question, but how do you under line a word in a  
particular
><font?
><
>You draw a line under it.  Sorry, but PostScript fonts do not have underline
>stuff in them, only the info about the character itself.
>Since you know the starting point of the text, you determine the length of
>the string, drop down a point or two and draw a line of string length.  That
>is a simple way of doing it.

hmmm, i've been meaning to do this for a while, post a collection of my 
"show" commands -- centered on a point, with a box around it, underlined, 
mirrorimage &c.  it is not complete, there are some more i have kicking 
about, but this is the _most_ complete. in all cases, merely replace the
operator show with centershow, or rightshow... this code comes with examples
at the bottom.

cheers.
--
Lance R. Bailey  System/Network Manager         Robarts Research Institute
     NeXT/email: zaphod@ctrg.rri.uwo.ca    box: Clinical Trials Resources Group
            fax: 519.663.3789                   P.O. Box 5015, 100 Perth Dr.
            vox: 519.663.3787 ext. 4108         London, Canada N6A 5K8
         Gaelic: Tha me leatsa ma cheannaicheas tu mi. Thoir dhomh earbsa.


%!
% bordershow.ps
%:::::::::::
/bordershow
{   dup stringwidth pop 
    gsave dup currentfont/FontMatrix get 3 get currentfont/FontBBox get 0 get  
mul
        dup currentlinewidth 2 div neg dup  3 1 roll add rmoveto exch  
currentlinewidth
        add 0 rlineto neg currentlinewidth 2 div
        add 0 exch rlineto currentfont/FontMatrix get 3 get  
currentfont/FontBBox get 3 get mul
        currentlinewidth 2 div add 0 exch rlineto currentlinewidth
        add neg 0 rlineto closepath stroke
    grestore show
} def


% boxshow
%::::::::
/negativeshow
{   dup stringwidth pop 
    gsave dup currentfont/FontMatrix get 3 get currentfont/FontBBox get 0 get  
mul
       dup 0 exch rmoveto exch 
       0 rlineto neg 0  exch rlineto
       currentfont/FontMatrix get 3 get currentfont/FontBBox get 3 get mul
       0 exch rlineto neg 0 rlineto closepath fill
    grestore gsave 1 currentgray sub setgray show grestore
} def



% centershow.ps
%::::::::::::::
/centershow {dup stringwidth pop 2 div neg 0 rmoveto show} def

% mirrorshow.ps
%::::::::::::::
/mirrorshow{dup stringwidth pop 0 rmoveto gsave -1 1 scale show grestore}def

% tallshow.ps
%:::::::::::::::

/sidewayshow
{  gsave
       currentpoint translate currentfont/FontBBox get 3 get  
currentfont/FontMatrix get 3 get
       mul 0 moveto 90 rotate
       {  pop 1  string dup 0 4 -1 roll put stringwidth pop neg
          currentfont/FontBBox get dup 3 get exch 0 get neg add
          currentfont/FontMatrix get 3 get mul neg rmoveto
       } exch kshow
    grestore
} def

% rightshow.ps
%:::::::::::::
/rightshow {dup stringwidth pop neg 0 rmoveto show} def

%undershow.ps
%:::::::::::::
/undershow
{dup stringwidth pop gsave 0 currentlinewidth -0.5 mul rmoveto 0 rlineto stroke  
grestore show}
def


2 setlinewidth % 0.3 setgray
306 20 translate
/Times-Bold findfont 16 scalefont setfont
/str (the quick brown fox jumped over the lazy dog) def

    0 0 moveto str show
    0 20  moveto str negativeshow
    0 40 moveto str rightshow
    0 60 moveto str centershow
    0 80 moveto str undershow
    0 100 moveto str bordershow
    0 120 moveto str mirrorshow
    0 140 moveto str sidewayshow

showpage