      SUBROUTINE DESBOUT(IFONT,IFONT1,ITB,IC,CBOUT,L,XBOUT,YBOUT,XHELP
     &                  ,IMENU,CSEC,LSEC,DX,DY2,ITOUR2
     &                  ,ICOL0,ICOL1,ICOL2,ICOL3,ILANG)
      DIMENSION XBOUT(2),YBOUT(2)
      CHARACTER*32 CBOUT,CSEC
C
      II = IABS(ITB)
      IF (ICOL0.EQ.5) THEN
        CALL GSPAT(ICOL3)
        CALL MY_GSAREA2(XBOUT,YBOUT)
      ENDIF
      IF (ITB.EQ.9) THEN
        CALL DRAPEAU(ILANG,XBOUT,YBOUT,XHELP)
      ELSEIF(L.GT.0) THEN
        IF (ITB.EQ.2.OR.ITB.EQ.3) THEN
          DDX = 2.*DX
        ELSE
          DDX = 1.8*DX
        ENDIF
        IF (IC.EQ.5) THEN
          IF (IMENU.EQ.0) THEN
            XX = (XBOUT(1)+XBOUT(2))*0.5
          ELSE
            XX = (XBOUT(1)+XBOUT(2)-DDX)*0.5
          ENDIF
        ELSEIF(IC.EQ.4) THEN
          XX = XBOUT(1)+DX*1.5
        ELSE
          IF (IMENU.EQ.0) THEN
            XX = XBOUT(2)-DX
          ELSE
            XX = XBOUT(2)-DX-DDX
          ENDIF
        ENDIF
        CALL GSLSS(IFONT)
        CALL ASFCOL(ICOL0)
         IF (II.NE.5) THEN
          YY = (YBOUT(1)+YBOUT(2))*0.5
          CALL GSCHAR3(XX,YY,L,CBOUT,IC,1)
        ELSE
          YY = YBOUT(2)-DY2
          IC2 = IC-3
          CALL GSCHAR3(XX,YY,L,CBOUT(1:L),IC2,1)
          YY = YBOUT(1)+DY2
          IC2 = IC+3
          CALL GSCHAR3(XX,YY,L,CBOUT(2*L+1:3*L),IC2,1)
          YY = (YBOUT(1)+YBOUT(2))*0.5
          CALL GSCHAR3(XX,YY,L,CBOUT(L+1:2*L),IC,1)
        ENDIF
      ENDIF
      IF (LSEC.GT.0) THEN
        CALL GSLSS(IFONT1)
        CALL ASFCOL(ICOL3)
        IF (IMENU.EQ.0) THEN
          XX = XBOUT(2)-DX
        ELSE
          XX = XBOUT(2)-DX-DDX
        ENDIF
c        IF (II.NE.5) THEN
          YY = (YBOUT(1)+YBOUT(2))*0.5
          CALL GSCHAR3(XX,YY,LSEC,CSEC,6,1)
c        ELSE
c          YY = YBOUT(2)-DY2
c          CALL GSCHAR3(XX,YY,LSEC,CSEC(1:LSEC),3,1)
c          YY = (YBOUT(1)+YBOUT(2))*0.5
c          CALL GSCHAR3(XX,YY,LSEC,CSEC(LSEC+1:2*LSEC),6,1)
c          YY = YBOUT(1)+DY2
c          CALL GSCHAR3(XX,YY,LSEC,CSEC(2*LSEC+1:3*LSEC),9,1)
c        ENDIF
      ENDIF
      IF (ITB.EQ.9) THEN
        CALL MYBORD(XBOUT,YBOUT,BIDON,0,1,0,0)
      ELSEIF(ITB.GT.0.AND.II.NE.6) THEN
        CALL MYBORD(XBOUT,YBOUT,BIDON,0,ITOUR2,ICOL1,ICOL2)
      ENDIF
      IF (IMENU.NE.0) THEN
        XX = XBOUT(2)-(DX+DDX)*0.5
        YY = (YBOUT(1)+YBOUT(2))*0.5
        DDX = DX*0.8
        IF (IABS(IMENU).EQ.1) THEN
          IOPT = -IMENU
          CALL GSTRIANGLE(IOPT,XX,YY,DDX,-1)
        ELSEIF(IABS(IMENU).EQ.2) THEN
          CALL GSRECTANGLE(1,XX,YY,DDX,1)
        ENDIF
      ENDIF
      IF (ICOL0.EQ.5) CALL GSPAT(8)
      END
C-----------------------------------------------------------------------
      SUBROUTINE ECRANG(ANGX,ANGY,ANGZ,IFONT1,XBOUT,YBOUT,DX,DY2)
      DIMENSION YBOUT(2)
      CHARACTER*18 CSEC
C
      CALL ARC(ANGX,ANGY,ANGZ)
      CALL ASFCOL(3)
      CALL GSLSS(IFONT1)
      CALL GSPAT(8)
      XX = XBOUT - DX
      WRITE (CSEC,'(3F6.1)') ANGX
      YY = YBOUT(2) - DY2
      CALL GSCHAR3(XX,YY,6,CSEC,3,1)
      WRITE (CSEC,'(3F6.1)') ANGY
      YY = .5*(YBOUT(1)+YBOUT(2))
      CALL GSCHAR3(XX,YY,6,CSEC,6,1)
      YY = YBOUT(1) + DY2
      WRITE (CSEC,'(3F6.1)') ANGZ
      CALL GSCHAR3(XX,YY,6,CSEC,9,1)
      END
C-----------------------------------------------------------------------
      SUBROUTINE DRAPEAU(ILANG,XBOUT,YBOUT,XHELP)
      DIMENSION XBOUT(2),YBOUT(2),X(2),Y(2)
C
      CALL GSPAT(7)
      CALL MY_GSAREA2(XBOUT,YBOUT)
      IF (ILANG.EQ.0) THEN
        X(1) = XBOUT(1)
        X(2) = XBOUT(1) + (XBOUT(2)-XBOUT(1))/3.
        CALL GSPAT(3)
        CALL MY_GSAREA2(X,YBOUT)
        X(1) = XBOUT(2) - (XBOUT(2)-XBOUT(1))/3.
        X(2) = XBOUT(2)
        CALL GSPAT(1)
        CALL MY_GSAREA2(X,YBOUT)
      ELSE
        CALL VRAIECOORD(XHELP,YBOUT(1),IX0,IY0)
        CALL VRAIECOORD(XHELP,YBOUT(2),IX0,IY1)
        NN = IABS(IY0-IY1)
        DY = 2.*(YBOUT(2)-YBOUT(1))/REAL(NN)
        CALL GSCOL(1)
        CALL GSLW(1)
        YY = YBOUT(1)
        DO I=1,1+NN/2
          CALL GSMOVE(XBOUT(1),YY)
          CALL GSLINE(XBOUT(2),YY)
          YY = YY + DY
        ENDDO
        X(1) = XBOUT(1)
        X(2) = (XBOUT(1) + XBOUT(2))*0.5
        Y(1) = (YBOUT(1) + YBOUT(2))*0.5
        Y(2) = YBOUT(2)
        CALL GSPAT(3)
        CALL MY_GSAREA2(X,Y)
      ENDIF
      END
