routine DRAW.TEXT(FAMILY, SIZE, WEIGHT, SLANT)
''
''    AUTHOR: Steve Bailey
''    CREATED: 8-31-94
''    DESCRIPTION:
''      Draws system text in the window with the specified font family, size
''      (in points), boldness (range 0-100) and slant (0-100).
''

    define FAMILY as a text variable
    define SIZE, WEIGHT, SLANT as integer variables
    define CURRENT.SEG as an integer saved variable
    define POINTS as a 2-dim real saved array
    define ROW, COLUMN as integer variables
    define I as an integer variable

      '' delete the old system text
    if CURRENT.SEG ne 0
        call DELETE.SEG.R(CURRENT.SEG)
    else  ''first time here
        reserve POINTS(*,*) as 2 by 2
        let POINTS(1,1) = 500
        let POINTS(1,2) = 32268
        call GCOLOR.R(1, 0, 1000, 0)   '' red
    always

      '' describe the font attributes that were picked, then show the 
      '' alphabet of the font
    call OPEN.SEG.R
    
    call GCOLOR.R(2, 1000, 1000, 1000)
    call TEXTCOLOR.R(2)

      '' first show font attributes
    call TEXTFONT.R(1)
    call TEXTSIZE.R(1000)
    call WGTEXT.R(CONCAT.F("Family: ", FAMILY), 1000, 31000)
    call WGTEXT.R(CONCAT.F("Size:   ", ITOT.F(SIZE)), 1000, 30000)
    call WGTEXT.R(CONCAT.F("Weight: ", ITOT.F(WEIGHT)), 1000, 29000)
    call WGTEXT.R(CONCAT.F("Slant:  ", ITOT.F(SLANT)), 1000, 28000)

      '' now show all characters that can be typed in from the keyboard
      '' in both the default and system fonts
    for I = 32 to 126 do
        let ROW =    DIV.F(I - 32, 12) 
        let COLUMN = MOD.F(I - 32, 12) 

          '' print labelling for each row of alphabet letters
        if COLUMN eq 0
              '' draw the separator line
            let POINTS(2,1) = 26000 - ROW * 3000
            let POINTS(2,2) = 26000 - ROW * 3000
            call LINECOLOR.R(1)
            call POLYLINE.R(2, POINTS(*,*))
        
              '' draw labelling on top and bottom of line
            call TEXTFONT.R(1)
            call TEXTALIGN.R(0, 3)
            call WGTEXT.R("This font:", 1000.0, POINTS(2,1))
            call TEXTALIGN.R(0, 4)
            call WGTEXT.R("Keyboard:", 1000.0, POINTS(2,1))
        always

          '' now draw the current letter in the system font just below
        call TEXTALIGN.R(1,3)
        call TEXTSYSFONT.R(FAMILY, SIZE, WEIGHT, SLANT)
        call WGTEXT.R(ATOT.F(I), 7000.0 + COLUMN * 2000, POINTS(2,1))

          '' draw the current letter of the alphabet
        call TEXTALIGN.R(1,4)
        call TEXTFONT.R(1)
        call WGTEXT.R(ATOT.F(I), 7000.0 + COLUMN * 2000, POINTS(2,1))
    loop

      '' save the current segment id
    let CURRENT.SEG = SEGID.V

    call CLOSE.SEG.R
end
