DEFINITION MODULE FontReader;

(* Author:         Andrew Trevorrow
   Implementation: University of Hamburg Modula-2 under VAX/VMS version 4
   Date Started:   November, 1986

   Description:
   Routines for reading font files in a variety of formats.
*)

FROM SYSTEM IMPORT
   ADDRESS;           (* byte address *)

FROM DVIReader IMPORT
   fontinfoptr;

VAR
   FillPixelTable : PROC;
   (* Fill currfont^.pixelptr with info from the currently open font file. *)

   GetBitmap : PROCEDURE (CARDINAL,       (* pixel height of bitmap *)
                          CARDINAL,       (* pixel width of bitmap *)
                          CARDINAL,       (* mapadr in font file *)
                          VAR ADDRESS);   (* starting address of bitmap *)
   (* Allocate space for bitmap and fill it with raster info at mapadr
      in the currently open font file.
      Each bitmap row uses an integral number of words (each 32 bits).
      Note that byte-aligned rows would use about 35% less memory but
      would increase the processing time needed to display each bitmap.
      It was felt that speed is more important than memory.
   *)

PROCEDURE InitFontReader;
(* Use the /FONT_DIRECTORY and /DUMMY_FONT values to assign appropriate
   routines to the above procedure variables, and to decide on the format
   of file specifications created by BuildFontSpec.
*)

PROCEDURE BuildFontSpec (fontptr : fontinfoptr);
(* Build a complete file specification in fontptr^.fontspec.
   This will only be done once per font; fontspeclen will no longer be 0.
   fontptr^.fontexists becomes TRUE if the file can be found.
*)

PROCEDURE OpenFontFile (VAR filespec : ARRAY OF CHAR) : BOOLEAN;
(* Return TRUE if given font file is successfully opened.
   The value of filespec is not changed; it is declared a VAR parameter
   for efficiency reasons.
*)

PROCEDURE CloseFontFile;
(* Close the currently open font file. *)

END FontReader.
