(****************************************************************************)
(*                                                                          *)
(*                           GSX Text Module                                *)
(*                           ===============                                *)
(* This Module contains all GSX functions for drawing text on graphic       *)
(* devices. Note that not all functions may be implemented for each device, *)
(* but 1 font, 1 size and 1 direction should be available.                  *)
(*                                                                          *)
(* 16.5.1988          Wolfgang Muees, Hagenring 22, 3300 Braunschweig       *)
(*                                                                          *)
(****************************************************************************)


VAR CharWidth  : INTEGER;        (* X dimension of an uppercase "W" *)
    CharHeight : INTEGER;        (* Y dimension of an uppercase "W" *)
    CellWidth  : INTEGER;        (* X Dimension for character & boarder *)
    CellHeight : INTEGER;        (* Y Dimension for character & boarder *)

PROCEDURE DrawText ( X, Y : INTEGER; Text : Lstring );        (* Draw a text string,
                                     starting at coordinates X,Y. If the string cross
                                     screen bounds, nothing harmfull happens, however,
                                     you might not se him. Note that Text length is
                                     trunced to I_inLen ( see GSXMAIN ). *)
BEGIN
  PTSIN[1].X := X;
  PTSIN[1].Y := Y;
  CB.PINLEN  := 1;
  SetText ( Text );
  simple ( 8 );
END;


PROCEDURE PGC ( X, Y : INTEGER; Text : Lstring );             (* Draw graphic characters.
                                     Same as DrawText, but the ASCII values in Text are
                                     translated in graphic symbols like frames, edges etc.
                                     This function is device-dependent ! *)
BEGIN
  PTSIN[1].X := X;
  PTSIN[1].Y := Y;
  CB.PINLEN  := 1;
  SetText ( Text );
  CB.ESCID := 5;
  simple ( 11 );
END;


PROCEDURE CharSize ( Height : INTEGER );  (* Trys to set a text zoom factor. Actual values
                                             for text dimensions are returned in GSXTEXT
                                             VARs defined above. *)
BEGIN
  PTSIN[1].X := 0;
  PTSIN[1].Y := Height;
  CB.PINLEN  := 1;
  simple ( 12 );
  CharWidth  := PTSOUT[1].X;
  CharHeight := PTSOUT[1].Y;
  CellWidth  := PTSOUT[2].X;
  CellHeight := PTSOUT[2].Y;
END;


PROCEDURE CharAngle ( Angle : INTEGER ); (* Sets direction vector for writing text or symbols.
                                        Range is from [0..3600] in 1/10 deg. increment. 0 deg.
                                        is the normal text direction, values increasing ccw. *)
BEGIN
  oneINT ( 13, Angle );
END;


PROCEDURE CharFont ( Number : INTEGER ); (* Select a text font. Highly device dependent. *)
BEGIN
  oneINT ( 21, Number );
END;


PROCEDURE CharColor ( Color : INTEGER ); (* Select a character color index. *)
BEGIN
  oneINT ( 22, Color );
END;

