%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Font8.SL - Font Description with 8-bit wide characters
% 
% Author:      Alan Snyder
%              Hewlett-Packard/CRC
% Date:        16 March 1983 (code taken from 9836-COLOR.SL)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(CompileTime (load fast-vectors))

% Font8-Patterns is a vector of 256 elements.  Each element is either NIL or a
% Vector of integers.  If NIL, the character has no definition and should be
% displayed as blank space.  If a Vector, then each Integer in the Vector
% represents one scan line of the character, right adjusted, starting with the
% top scan line.  Blank scan lines at the bottom of the raster are not
% included in the vector.  The function fixup-font-patterns, defined at the
% end of this file, can be used to convert this vector so that all elements
% are vectors with a minimum size.  The recommended character height is 14
% scan lines, which includes interline spacing.

(fluid '(font8-patterns))
(setf font8-patterns
  (vector % this vector must go in the heap, since it may be modified
   NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL 
   NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL 
   NIL
   [2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00000000
    2#00000000
    2#00010000
    2#00010000
    ]
   [2#00100100
    2#00100100
    2#00100100
    2#00100100
    ]
   [2#00000000
    2#00000000
    2#01000100
    2#01000100
    2#11111110
    2#01000100
    2#01000100
    2#11111110
    2#01000100
    2#01000100
    ]
   [2#00010000
    2#01111100
    2#11010110
    2#10010000
    2#11010000
    2#01111100
    2#00010110
    2#00010010
    2#11010110
    2#01111100
    2#00010000
    ]
   [2#01100000
    2#10010000
    2#10010010
    2#01100100
    2#00001000
    2#00010000
    2#00100000
    2#01001100
    2#10010010
    2#00010010
    2#00001100
    ]
   [2#00110000
    2#01001000
    2#10001000
    2#10001000
    2#10010000
    2#01100000
    2#01100000
    2#10010000
    2#10001010
    2#10000100
    2#01111010
    ]
   [2#00001000
    2#00001000
    2#00010000
    2#00010000
    ]
   [2#00001000
    2#00010000
    2#00100000
    2#00100000
    2#00100000
    2#00100000
    2#00100000
    2#00100000
    2#00100000
    2#00010000
    2#00001000
    ]
   [2#00100000
    2#00010000
    2#00001000
    2#00001000
    2#00001000
    2#00001000
    2#00001000
    2#00001000
    2#00001000
    2#00010000
    2#00100000
    ]
   [2#00000000
    2#00000000
    2#10010010
    2#01010100
    2#00111000
    2#11111110
    2#00111000
    2#01010100
    2#10010010
    ]
   [2#00000000
    2#00000000
    2#00010000
    2#00010000
    2#00010000
    2#11111110
    2#00010000
    2#00010000
    2#00010000
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#00011000
    2#00011000
    2#00010000
    2#00100000
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#11111110
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#00110000
    2#00110000
    ]
   [2#00000010
    2#00000010
    2#00000100
    2#00000100
    2#00001000
    2#00001000
    2#00010000
    2#00010000
    2#00100000
    2#00100000
    2#01000000
    2#01000000
    ]
   [2#00111000
    2#01000100
    2#10000010
    2#10000110
    2#10001010
    2#10010010
    2#10100010
    2#11000010
    2#10000010
    2#01000100
    2#00111000
    ]
   [2#00010000
    2#00110000
    2#01010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#01111100
    ]
   [2#01111100
    2#11000110
    2#00000010
    2#00000100
    2#00001000
    2#00010000
    2#00100000
    2#01000000
    2#10000000
    2#10000000
    2#11111110
    ]
   [2#01111100
    2#11000110
    2#00000010
    2#00000010
    2#00000110
    2#01111100
    2#00000110
    2#00000010
    2#00000010
    2#11000110
    2#01111100
    ]
   [2#00001000
    2#00011000
    2#00101000
    2#01001000
    2#10001000
    2#11111110
    2#00001000
    2#00001000
    2#00001000
    2#00001000
    2#00001000
    ]
   [2#11111110
    2#10000000
    2#10000000
    2#10000000
    2#10000000
    2#11111100
    2#00000110
    2#00000010
    2#00000010
    2#11000110
    2#01111100
    ]
   [2#01111100
    2#11000110
    2#10000000
    2#10000000
    2#10000000
    2#11111100
    2#10000110
    2#10000010
    2#10000010
    2#11000110
    2#01111100
    ]
   [2#11111110
    2#00000010
    2#00000010
    2#00000010
    2#00000100
    2#00001000
    2#00010000
    2#00100000
    2#00100000
    2#00100000
    2#00100000
    ]
   [2#01111100
    2#11000110
    2#10000010
    2#10000010
    2#11000110
    2#01111100
    2#11000110
    2#10000010
    2#10000010
    2#11000110
    2#01111100
    ]
   [2#01111100
    2#11000110
    2#10000010
    2#10000010
    2#11000110
    2#01111010
    2#00000010
    2#00000010
    2#00000010
    2#11000110
    2#01111100
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#00110000
    2#00110000
    2#00000000
    2#00000000
    2#00110000
    2#00110000
    2#00000000
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00011000
    2#00011000
    2#00000000
    2#00000000
    2#00011000
    2#00011000
    2#00010000
    2#00100000
    ]
   [2#00000100
    2#00001000
    2#00010000
    2#00100000
    2#01000000
    2#10000000
    2#01000000
    2#00100000
    2#00010000
    2#00001000
    2#00000100
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#11111110
    2#00000000
    2#00000000
    2#11111110
    2#00000000
    2#00000000
    2#00000000
    ]
   [2#01000000
    2#00100000
    2#00010000
    2#00001000
    2#00000100
    2#00000010
    2#00000100
    2#00001000
    2#00010000
    2#00100000
    2#01000000
    ]
   [2#01111100
    2#10000010
    2#10000010
    2#00000010
    2#00000100
    2#00001000
    2#00010000
    2#00010000
    2#00000000
    2#00000000
    2#00010000
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#01111110
    2#10000010
    2#10111010
    2#10101010
    2#10111010
    2#10001110
    2#10000000
    2#01111110
    ]
   [2#00010000
    2#00101000
    2#01000100
    2#10000010
    2#10000010
    2#10000010
    2#11111110
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    ]
   [2#11111100
    2#10000110
    2#10000010
    2#10000010
    2#10000110
    2#11111100
    2#10000110
    2#10000010
    2#10000010
    2#10000110
    2#11111100
    ]
   [2#01111100
    2#11000110
    2#10000000
    2#10000000
    2#10000000
    2#10000000
    2#10000000
    2#10000000
    2#10000000
    2#11000110
    2#01111100
    ]
   [2#11111000
    2#10001100
    2#10000110
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#10000110
    2#10001100
    2#11111000
    ]
   [2#11111110
    2#10000000
    2#10000000
    2#10000000
    2#10000000
    2#11111000
    2#10000000
    2#10000000
    2#10000000
    2#10000000
    2#11111110
    ]
   [2#11111110
    2#10000000
    2#10000000
    2#10000000
    2#11111000
    2#10000000
    2#10000000
    2#10000000
    2#10000000
    2#10000000
    2#10000000
    ]
   [2#01111100
    2#11000110
    2#10000000
    2#10000000
    2#10000000
    2#10000000
    2#10001110
    2#10000010
    2#10000010
    2#11000110
    2#01111100
    ]
   [2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#11111110
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    ]
   [2#01111100
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#01111100
    ]
   [2#00000100
    2#00000100
    2#00000100
    2#00000100
    2#00000100
    2#00000100
    2#00000100
    2#00000100
    2#10000100
    2#11001100
    2#01111000
    ]
   [2#10000010
    2#10000100
    2#10001000
    2#10010000
    2#10100000
    2#11000000
    2#10100000
    2#10010000
    2#10001000
    2#10000100
    2#10000010
    ]
   [2#10000000
    2#10000000
    2#10000000
    2#10000000
    2#10000000
    2#10000000
    2#10000000
    2#10000000
    2#10000000
    2#10000000
    2#11111110
    ]
   [2#10000010
    2#11000110
    2#10101010
    2#10111010
    2#10010010
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    ]
   [2#11000010
    2#11000010
    2#11100010
    2#10100010
    2#10110010
    2#10010010
    2#10011010
    2#10001010
    2#10001110
    2#10000110
    2#10000110
    ]
   [2#01111100
    2#11000110
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#11000110
    2#01111100
    ]
   [2#11111100
    2#10000110
    2#10000010
    2#10000010
    2#10000110
    2#11111100
    2#10000000
    2#10000000
    2#10000000
    2#10000000
    2#10000000
    ]
   [2#00111000
    2#01000100
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#10010010
    2#10011010
    2#01001100
    2#00111110
    ]
   [2#11111100
    2#10000110
    2#10000010
    2#10000010
    2#10000110
    2#11111100
    2#10100000
    2#10010000
    2#10001000
    2#10000100
    2#10000010
    ]
   [2#01111100
    2#11000110
    2#10000000
    2#10000000
    2#11000000
    2#01111100
    2#00000110
    2#00000010
    2#00000010
    2#11000110
    2#01111100
    ]
   [2#11111110
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    ]
   [2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#11000110
    2#01111100
    ]
   [2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#01000100
    2#01000100
    2#00101000
    2#00101000
    2#00010000
    ]
   [2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#10010010
    2#10010010
    2#10101010
    2#10101010
    2#11000110
    2#10000010
    ]
   [2#10000010
    2#01000100
    2#01000100
    2#00101000
    2#00101000
    2#00010000
    2#00101000
    2#00101000
    2#01000100
    2#01000100
    2#10000010
    ]
   [2#10000010
    2#01000100
    2#01000100
    2#00101000
    2#00101000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    ]
   [2#11111110
    2#00000010
    2#00000010
    2#00000100
    2#00001000
    2#01111100
    2#00100000
    2#01000000
    2#10000000
    2#10000000
    2#11111110
    ]
   [2#00111000
    2#00100000
    2#00100000
    2#00100000
    2#00100000
    2#00100000
    2#00100000
    2#00100000
    2#00100000
    2#00100000
    2#00111000
    ]
   [2#01000000
    2#01000000
    2#00100000
    2#00100000
    2#00010000
    2#00010000
    2#00001000
    2#00001000
    2#00000100
    2#00000100
    2#00000010
    2#00000010
    ]
   [2#00111000
    2#00001000
    2#00001000
    2#00001000
    2#00001000
    2#00001000
    2#00001000
    2#00001000
    2#00001000
    2#00001000
    2#00111000
    ]
   [2#00010000
    2#00101000
    2#01000100
    2#10000010
    2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#00000000
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#11111110
    ]
   [2#00010000
    2#00010000
    2#00001000
    2#00001000
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#01111100
    2#00000010
    2#00000010
    2#01111110
    2#10000010
    2#10000110
    2#01111010
    ]
   [2#10000000
    2#10000000
    2#10000000
    2#10000000
    2#10111100
    2#11000010
    2#10000010
    2#10000010
    2#10000010
    2#11000010
    2#10111100
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#01111100
    2#10000010
    2#10000000
    2#10000000
    2#10000000
    2#10000010
    2#01111100
    ]
   [2#00000010
    2#00000010
    2#00000010
    2#00000010
    2#01111010
    2#10000110
    2#10000010
    2#10000010
    2#10000010
    2#10000110
    2#01111010
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#01111100
    2#10000010
    2#10000010
    2#11111100
    2#10000000
    2#10000000
    2#01111110
    ]
   [2#00011100
    2#00100010
    2#00100000
    2#00100000
    2#00100000
    2#11111000
    2#00100000
    2#00100000
    2#00100000
    2#00100000
    2#00100000
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#01111100
    2#10000010
    2#10000010
    2#10000010
    2#01111110
    2#00000010
    2#00000010
    2#10000010
    2#01111100
    ]
   [2#10000000
    2#10000000
    2#10000000
    2#10000000
    2#11111100
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    2#10000010
    ]
   [2#00000000
    2#00010000
    2#00000000
    2#00000000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00000000
    ]
   [2#00000000
    2#00001000
    2#00000000
    2#00000000
    2#00001000
    2#00001000
    2#00001000
    2#00001000
    2#00001000
    2#00001000
    2#00001000
    2#01001000
    2#00110000
    2#00000000
    ]
   [2#10000000
    2#10000000
    2#10000000
    2#10000000
    2#10000100
    2#10001000
    2#10010000
    2#10100000
    2#11010000
    2#10001000
    2#10000100
    ]
   [2#01110000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#01111100
    2#00000000
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#11101100
    2#10010010
    2#10010010
    2#10010010
    2#10010010
    2#10010010
    2#10010010
    2#00000000
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#11111000
    2#10000100
    2#10000100
    2#10000100
    2#10000100
    2#10000100
    2#10000100
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#01111000
    2#10000100
    2#10000100
    2#10000100
    2#10000100
    2#10000100
    2#01111000
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#10111100
    2#11000010
    2#10000010
    2#10000010
    2#10000010
    2#11000010
    2#10111100
    2#10000000
    2#10000000
    2#00000000
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#01111010
    2#10000110
    2#10000010
    2#10000010
    2#10000010
    2#10000110
    2#01111010
    2#00000010
    2#00000010
    2#00000000
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#10111100
    2#11000010
    2#10000000
    2#10000000
    2#10000000
    2#10000000
    2#10000000
    2#00000000
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#01111100
    2#10000010
    2#10000000
    2#01111100
    2#00000010
    2#10000010
    2#01111100
    2#00000000
    ]
   [2#00000000
    2#00100000
    2#00100000
    2#00100000
    2#11111000
    2#00100000
    2#00100000
    2#00100000
    2#00100000
    2#00100100
    2#00011000
    2#00000000
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#10000100
    2#10000100
    2#10000100
    2#10000100
    2#10000100
    2#10001100
    2#01110100
    2#00000000
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#10000010
    2#10000010
    2#01000100
    2#01000100
    2#00101000
    2#00111000
    2#00010000
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#10000010
    2#10000010
    2#10000010
    2#10010010
    2#10101010
    2#11000110
    2#10000010
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#10000010
    2#01000100
    2#00101000
    2#00010000
    2#00101000
    2#01000100
    2#10000010
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#10000010
    2#01000100
    2#01000100
    2#00101000
    2#00010000
    2#00100000
    2#01000000
    2#01000000
    2#10000000
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#11111110
    2#00000100
    2#00001000
    2#00010000
    2#00100000
    2#01000000
    2#11111110
    ]
   [2#00001110
    2#00010000
    2#00010000
    2#00010000
    2#00110000
    2#11100000
    2#00110000
    2#00010000
    2#00010000
    2#00010000
    2#00001110
    ]
   [2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    2#00010000
    ]
   [2#11100000
    2#00010000
    2#00010000
    2#00010000
    2#00011000
    2#00001110
    2#00011000
    2#00010000
    2#00010000
    2#00010000
    2#11100000
    ]
   [2#00000000
    2#00000000
    2#00000000
    2#00000000
    2#10011100
    2#01110010
    ]
   NIL
   NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL 
   NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL 
   NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL 
   NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL 
   NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL 
   NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL 
   NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL 
   NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL 
   ))

(de fixup-font-patterns (patterns character-height)
  % Ensure that each element of a font pattern vector is a vector with at
  % least Character-Height elements.  This modification does not change the
  % appearance of the font, but allows the code using the font description to
  % be more efficient (avoid bounds checking, etc.)

  (let ((blank-pattern (make-vector character-height 0)))
    (for (from i 0 (vector-upper-bound patterns))
	 (do (let ((fc (vector-fetch patterns i)))
	       (when (null fc) (setf fc blank-pattern))
	       (when (< (vector-size fc) character-height)
		 (setf fc (concat fc (make-vector
				      (- character-height (vector-size fc))
				      0))))
	       (vector-store patterns i fc)
	       )))))
