[comp.lang.postscript] Superscript etc in Postscript

raj@ursa.UUCP (Raj) (02/28/90)

When you print a string using the show command (or equivalent)
is there a way of embedding escape sequences in the string
to obtain subscript, superscript, bold, italic etc. effects?


Thanks,

Raj




-- 
***********************************************************************
        uucp: sun!gotham!ursa!raj 
        arpa: gotham!ursa!raj@sun.COM 
***********************************************************************

woody@rpp386.cactus.org (Woodrow Baker) (03/05/90)

In article <2879@ursa.UUCP>, raj@ursa.UUCP (Raj) writes:
> 
> 
> When you print a string using the show command (or equivalent)
> is there a way of embedding escape sequences in the string
> to obtain subscript, superscript, bold, italic etc. effects?
> 
Nope. To do this, you have to create a string scanner that examines the
string, looking for the specific control codes that you choose to use.  Then
you have to go do it yourself.  I have written several printer emulators that
do just that.  The most complex one to date, is a complete emulation of the
Diablo emulation with extensions that is found in the NEC P9 printer.
The automated posting has an ascii to postscript routine in it that handles
simple stuff like formfeeds, backspaces, et et.  You might look at it.

Cheers
Woody

jeynes@adobe.COM (Ross A. Jeynes) (03/06/90)

In article <2879@ursa.UUCP> raj@ursa.UUCP () writes:
>When you print a string using the show command (or equivalent)
>is there a way of embedding escape sequences in the string
>to obtain subscript, superscript, bold, italic etc. effects?
>

Here's a very general procedure to do super/subscript. 

The way it works: pass SS the string to be shown, the distance above or
below the baseline to show the string, and a multiplier of the current
pointsize to show the string in (1/2 usually looks pretty good). 

Any other good ideas out there?

--------Cut Here---------
/bdef {bind def} bind def

/SS {  % (str) DeltaY PtSizeMult SS --      superscript / subscript 
  gsave
    currentfont exch scalefont setfont    % (str) DeltaY
    0 exch rmoveto                        % (str)
    show                                  % --
    currentpoint pop                      % x
  grestore
  currentpoint exch pop                   % x y
  moveto
} bdef


/Times-Roman findfont 20 scalefont setfont

100 100 moveto
(This is normal text) show
( and this is superscript) 7 .5 SS

showpage
--------Cut Here---------

Ross "let's program, dudes" Jeynes              
Developer Support                                   jeynes@adobe.com
Adobe Systems Incorporated                 {sun|decwrl}!adobe!jeynes