        SOFT-FONT: ADDITIONAL NOTES FOR VT220 AND WYSE TERMINALS
		by David S. Lawyer, information compiled July 1990  
		       	(Edited slightly: 1995-7)
CONTENTS:					NULL PADDING
BANK ASSIGNMENTS  				CELL SIZE
VT220 DOWNLOADING & SHELL SCRIPT		FLASHING when DOWNLOADING 
WYSE TERMINALS					LIMITATIONS

BANK ASSIGNMENTS  

After the soft-font has been loaded there are bank assignments that are
required to get your font to display on the screen.  There are 4 banks
for both Wyse and VT220: 0-3 for Wyse and G0-G3 for VT220.   The
following are for Wyse99GT, and Wyse 60.  They might not work for your
terminal.  Note: ESC means the escape character (a single byte) and,
for example, ^N is a the control character SO (alias Shift Out, alias 
ASCII 14 (or Hexadecimal E), etc.

WYSE: To assign a 128 character bank to the keyboard/screen you must go
      thru a 2 step process:
1. Designate one bank as primary and another as secondary.  Examples:
   ESCcB2 makes bank 2 primary;  ESCcC3 makes bank 3 secondary.
2. Select either the primary or secondary bank: ECScD selects the primary;
   ESCcE selects the secondary.
Some terminals may use the secondary bank for "above ASCII" characters with
the high order bit set.  (More info needed.)

VT220: Loading the font assigns it a name but not a bank.  You assign a
       font to a bank by name and then assign 2 banks to the keyboard/screen.
       The lower 94 display characters are kept in bank GL (L=left) while 
       the upper 94 display characters are kept in bank GR (R=right).
1. ESC(!!e assigns the font named "!!e" to bank G0.  The "(" is the code 
   for G0.  Other codes are:  G1: )   G2: *   G3: +   The first two letters
   of the font name must be in the ASCII range of ! to / and the name can't
   be over length 3.
2. ^N assigns G1 to GL, ESC~ assigns G1 to GR.  For G2 these are: ESCn, ESC}
   For G3: ESCo, ESC|   For G0: ^O assigns it to GL (G0 can't be assigned to
   GR).

VT220 DOWNLOADING & SHELL SCRIPT

An example of a header to send to the terminal before sending the
soft-font for many symbols: <ESC>P0;33;1;4{!!T  where:

<ESC>P is the ASCII escape character followed by P.  The DCS 8-bit control
	character (=90 hex) may be used instead of <ESC>P.
0 => Load "printable" character bank of 94 characters (above control 
     characters).  If it is 2 => graphic character bank (32 characters 
     from 5F thru 7E)  
33 => First character to load is # 33 ("A" position) as explained below.
1 => Don't erase old characters which may exist in this bank.  0 => erase.
4 => Char_Matrix size is 10x7.  See your manual.  May not be required.
!!T => Font will be named !!T. 

Note that the VT220 font was tested on a Wyse 99GT terminal which can
handle both Wyse and VT220 type fonts.  The soft-font is loaded
sequentially into character positions of increasing order starting at a
specified character position such as 33 to start off with a
redefinition of "A".  33 means the 33 rd printable character assuming
that <space> is the 0th character.  Note that the 94 printable
characters are ASCII 33-126 (hex. 21-7E) and exclude <space>(32=20h.)
and <delete> (127=7F).  Some VT220's may take two more parameters
before the { symbol, but I don't know what they mean.   At the end of
the downloading of all the soft-font send an <ESC>\.

For Wyse99GT I found that a "matrix size" (= cell size) of 12x7 is
possible by neglecting to specify the "matrix size" in the header. 

Here is a sample shell script for use in setting up the terminal and
downloading on a Unix-like computer system:

# This will download Russian (Cyrillic) font (ISO-5) to a Wyse99GT terminal
# and put it into 8-bit VT220 mode.  It is only for the Wyse terminals
# at UCI (University of California at Irvine) which are set up to emulate
# VT100 and are connected to the external world via their Aux Port.
# Downloading font at 9600 baud requires either Xon/Xoff flow control or
# the use of padding nulls.  This script opted to use Xon/Xoff.
# The next line defines ESC as Hex 1B, but most printers will not print the
# actual ESC character so you may see nothing after the = sign.
set ESC=^[
echo "Loading 8-bit GOSTCII Cyrillic font.  Wait!  CRT will blank, flash etc."
# Sleep to have time to read echo shown above. 
sleep 1
# Go to native personality since can't enable Xon/Xoff from ANSI personalities.
echo -n "${ESC}[42h"
# Set Xon/Xoff flow control for Aux port (connected to terminal server).
echo -n "${ESC}c31"
# Put message at top of CRT in status line
echo -n "${ESC}FGOSTCII Cyrillic Font
"
# Change to VT220 personality and 8-bit transmission mode on.
echo -n "${ESC}~=${ESC} G"
# (Would be useful to make Funct key meta but how?)
# Send initialization sequences to the Wyse 99GT terminal per Programmers
# guide pp. 8-10 to 8-14.  Note that ! must be quoted with \ inside quotes.
echo -n "${ESC}P0;0;0;{\!\!C"
# Send the font named !!C (above) from the soft-font file fontv to the terminal.
cat fontv
# fontv file contains trailer for Wyse99GT: ESC \ 
# assign !!C font to bank  G2.
# Then assign bank G2 to GR (the rt. half display bank).  See Wyse
# Programmers guide pp. 7-6 to 7-8.  Note ! quoted by \.
echo -n "${ESC}*\!\!C${ESC}}"
# Enable 8 bit chars to pass 8-bit bytes to host
stty -istrip cs8
echo "Loading of Cyrillic font (IS0 5, 8-bit) completed."

WYSE TERMINALS

For Wyse there is no header or trailer for the soft-font as a whole, but
each soft-font code glyph has a header and a ^Y trailer.  Some terminals
may not need the ^Y but the font generation software adds it anyway.  
The header ESCcA37B means: Put this character in cell 7B of bank 3.  
This software puts this header into its soft-font output.  ESC is the 
"escape" character and ^Y means Control-Y.

NULL PADDING

Some devices such as older Wyse terminals can't receive downloaded
font at highest baud rate which the device supports.  There are 3
types of fixes for this problem: 1.  Lower the baud rate.  2. Enable
Xon/Xoff flow control (Doesn't always solve the problem.)  3. Add null
padding to your soft-font file by using a flag such as -p 80 when
generating the soft-font.  On a Wyse 99GT terminal it was necessary to
use 80 nulls per line of soft-font (-p 80) in order to download font
at 9600 baud.   

Another method (not always a good one) of introducing delays is to
have the program which downloads the font contain delays.  But if the
terminals communicate with computers over a network, the network may
accumulate data in packets and thus eliminate some of your delays
(while adding other delays).  The same sort of thing could happen when
data being downloaded is buffered in the host computer.

FLASHING when DOWNLOADING

Both the Wyse 99GT and Wyse 60 terminals flash erratically when font is
being downloaded.  If you use a shell script for downloading soft-font
you may want to put a message in it to send to the terminal once the
font has been downloaded.  If you fail to see this message just after
you download font then something has gone wrong.  Sometimes a second
try will succeed. If it doesn't you had might try adding more delay. 
Once everything works OK you may want to remove this message.

LIMITATIONS

The coding rules used in this program for Wyse and VT220 terminals came
from the Wyse 99GT Programmer's Guide chapters 7 and 8.  Perhaps info
from other manuals would result in an extended/improved program.

Wyse characters cannot be wider than 8 pixels.  Note that cell sizes
(in pixels) are the sizes used the pattern file which you draw and are
often less than the cell height mentioned in the terminal manuals.  See
2nd paragraph of "Input Pattern File Format".
