      subroutine spec_str(h,string,nch)
      implicit real (a-h,o-z)
c
c Handle the speclial characters for PostScript 
c
c James Blake
c @(#)spec_str.f	1.1  4/3/89 
c

      character*(*) string
      include 'device_type.h'
      common /tscale/ sfactt
      common /cqpbnf/ xold, yold, fac, ires
c
c Courier font fudge factor to get proper heigh
c
      save  cfudge
      data  cfudge /1.66666666/
      data torad /0.017453293 /
C
C   Set character height
C
         call pliout (nint (h * cfudge * fac * ires))
         call plsout (" H ")
C
C     Output "(string) S ", escape ( ) characters. 
C
      call plcout(char(40))
      j = 0
      item = 0
C 
C Get rid of Prefixed symbols 
C
      do i = 1, nch
        ic = mod(ichar(string(i:i)), 127)
        if (ic .eq. 92 .or. ic .eq. 94 .or. ic .eq. 95) then
           item = item + 1 
        endif
      enddo
      do 20 i = 1, nch - item
        j = j + 1
        ic = mod(ichar(string(j:j)), 127)
C
C Encode the ( and ) symbols
C
        if    (ic .eq. 40) then
            call plsout ("\\050")
        else if     (ic .eq. 41) then
            call plsout ("\\051")
        else if     (ic .eq. 92) then
C
C Encode the angstrom symbol
C
            j = j + 1
            icn = mod(ichar(string(j:j)), 127)
            if (icn .eq. 65) call plsout("\\201")
        else if     (ic .eq. 94) then
            call plsout (") S\n")
C
C   Set character height to be 20% smaller ,
C   Move up by 0.8 * (X)
C
            call pliout (nint (h * cfudge * fac * ires * 0.8))
            call plsout (" H (X) dup stringwidth pop 0.6 mul")
            call plsout(" 0 exch rmoveto\n")
            j = j + 1
            icn = mod(ichar(string(j:j)), 127)
C
C Plot out the character
C
            call plcout(char(40))
            call plcout(char(icn))
            call plsout(") S\n")
C
C Move baseline back
C
            call plsout("stringwidth pop 0.6 mul neg") 
            call plsout(" 0 exch rmoveto\n")
C
C   reset character height
C
            call pliout (nint (h * cfudge * fac * ires))
            call plsout (" H (")
        else if     (ic .eq. 95) then
            call plsout (") S\n")
C
C   Set character height to be 20% smaller
C
            call pliout (nint (h * cfudge * fac * ires * 0.8))
            call plsout (" H (X) dup stringwidth pop ")
            call plsout("0.6 mul neg 0 exch rmoveto\n")
            j = j + 1
            icn = mod(ichar(string(j:j)), 127)
C
C Plot out the character
C
            call plcout(char(40))
            call plcout(char(icn))
            call plsout(") S\n")
C
C Move baseline back
C
            call plsout("stringwidth pop 0.6 mul")
            call plsout(" 0 exch rmoveto\n")
C
C   reset character height
C
            call pliout (nint (h * cfudge * fac * ires))
            call plsout (" H (")
        else
            call plcout(char(ic))
        end if
20    continue
      call plsout(") S ")
      return
      end
