C
C SUBROUTINE 'QGTEXT'
C ===================
C
C OUTPUT A TEXT STRING TO THE GRAPHICS SCREEN
C
      SUBROUTINE QGTEXT (X, Y, SIZ, STR)
C
C PARAMETERS
C
C     X (I)   X POSITION IN PIXELS 0.0 TO 1023.0 (OR MAPPED COORDINATE IF
C                        'QGMAPC' HAS BEEN CALLED)
C     Y (I)   Y POSITION IN PIXELS 0.0 TO 767.0(OR MAPPED COORDINATE IF
C                        'QGMAPC' HAS BEEN CALLED)
C   SIZ (I)   CHARACTER SIZE (HEIGHT IN PIXELS)
C   STR (I)   CHARACTER STRING TO BE OUTPUT
C
C
C SPECIFICATION STATEMENTS
C ------------------------
C
      CHARACTER*(*) STR
      LOGICAL DRAW, MAPSAV
      CHARACTER*1 MODE, ESC, GS, US, FS, CR, FF, SUB
      COMMON /QQCHR/ MODE, ESC, GS, US, FS, CR, FF, SUB
      LOGICAL PSET
      COMMON /QQLAST/ PSET, KXH, KXL, KYH, KYL
      CHARACTER*95 CHLIST
      COMMON /QQCHAR/ CHLIST
      COMMON /QQFONT/ IFONT(32,95)
      LOGICAL PSCRIP, PSON
      COMMON /QQPS/ PSCRIP, PSON, LUNP
      LOGICAL MAP
      COMMON /QQMAP/ MAP, XPMIN, XPMAX, YPMIN, YPMAX, 
     *               XMMIN, XMMAX, YMMIN, YMMAX, XSC, YSC
      SAVE /QQCHR/,/QQLAST/,/QQFONT/,/QQCHAR/,/QQPS/,/QQMAP/
C
C CODE
C ----
C
      CALL QGMPXY(X,Y,XP,YP)
      SCALE = SIZ/20.0
      MAPSAV = MAP
      MAP = .FALSE.
      CALL QGMOVE(XP,YP)
      XX = XP
      YY = YP
      LL=LEN(STR)
      IF (LL.LT.1) THEN
         MAP = MAPSAV
         RETURN
      ENDIF
      IF (PSCRIP.AND.PSON) THEN
         IF (LL.LE.60) THEN
            WRITE (LUNP,1001) STR
         ELSE
            WRITE (LUNP,1002) STR(1:60)
         ENDIF
      ENDIF
      DO 500 L=1,LL
         DO 100 I=1,95
            IF (STR(L:L).EQ.CHLIST(I:I)) THEN
               IND=I
               GOTO 120
            ENDIF
100      CONTINUE
         IND=0
120      IF (IND.GT.0) THEN
            DO 200 I=1,16
               I1 = 2*I-1
               I2 = 2*I
               IF (IFONT(I1,IND).GE.100) GO TO 250
               DRAW=.TRUE.
               IXC = IFONT(I1,IND)
               IYC = IFONT(I2,IND)
               IF (I.EQ.1.OR.IXC.LT.0) DRAW=.FALSE.
               IF (IXC.LT.0) IXC=-IXC
               DX = FLOAT(IXC-1)*SCALE
               DY = FLOAT(IYC-1)*SCALE
               IF (DRAW) THEN
                  CALL QGDRAW (XX+DX,YY+DY)
               ELSE
                  CALL QGMOVE (XX+DX,YY+DY)
               ENDIF
200         CONTINUE
         ENDIF
250      XX = XX + 12.0*SCALE
         CALL QGMOVE (XX,YY)
500   CONTINUE
      IF (PSCRIP.AND.PSON) WRITE (LUNP,1003)
      MAP = MAPSAV
      RETURN
C
C FORMAT STATEMENTS
C -----------------
C
1001  FORMAT ('% o/p string: ',A)
1002  FORMAT ('% o/p string: ',A,' ...')
1003  FORMAT ('% end string:')
      END
