Next Previous Contents

5. THE pat2sf PROGRAM

5.1 Introduction

There are various "languages" used by printers and terminals (devices). Soft-font is written in these languages. Examples for printers are Esc/P2 for Epson Printers (and compatibles) and PCL6 for HP Printers (and compatibles). Examples for terminals are WYSE and VT220. Each language has it own method of encoding. My program to create soft-fonts in various device languages (not C of course) is written in the C language. If this software doesn't work for your situation you may need to modify my C program.

pat2sf operates on the pattern file in two stages. The first stage scans the file and puts the *'s (pixels) of the file into matrices in the computer's memory. This is done by the code in source file scan.c. The second stage is to read these matrices and encode the *'s of the matrices into soft-font (using the the appropriate language such as PCL). This is done by functions in the file: encode.c which are called from scan.c. pat2sf.h is a header file for defining data types and constants common to both *.c files. For a more detailed description of the code I've written, see the the file: src_overview and the source code which is hopefully well documented by comments. Also see Font_Langs for how bit-maps are encoded into soft-font code.

5.2 Compiling pat2sf

If you need to use pat2sf (main program of BitFontEdit) to create soft-font, you may need to compile the C source code for it. A unix-style "makefile" is supplied so in some cases all you need to do is to type "make" at the command line prompt to compile it. You may want to look at the makefile and change the options given to the compiler.

You may need to modify the C programs a little before compiling. At the start of pat2sf.h it #defines the maximum character cell size (in Pixels). It also #defines the maximum number of character-matrices ( = patterns) per band in the input file. These 3 #defines determine array sizes in the program. When almost all compliers handle dynamic arrays, the C code will be modified so that these #defines will no longer be needed. Also #defined is the line length of your input file (I made it 80).

5.3 Running pat2sf

When running the program pat2sf to generate a soft-font file you must specify the type of font (the font language) you wish to generate. Don't neglect to determine what LANG_OPTIONS you need. Typing pat2sf alone on the command line displays something like:

--------------------------------To get soft-font:------------------------------- pat2sf [OPTIONS] lang [LANG_OPTIONS] pattern_file > softfont_file lang: the soft-font language. E.g. vt for vt220 terminals. Consult help. pattern_file: the name of the file in which you drew your Characters. softfont_file: the name of the file which this program will create. OPTIONS: (Don't use = for arguments to letter options.) -p --pad_level=80 Append 80 etc. (default=0) padding nulls to each line of output. -s --stdin use standard input. LANG_OPTIONS: Depends on language. See help below to show them. -----------------------------------To get help:--------------------------------- pat2sf -v --version shows version number. pat2sf Display this message pat2sf --help list Show list of supported Languages (LANG). pat2sf --help LANG Show LANG_OPTIONS for Language LANG in this message. NOTE: You must read the manual to find out format of pattern_file, etc.

Then after you have "drawn" your font in a pattern file (or gotten a pattern file from someone else), execute the font generation program (pat2sf). As the program runs, watch the screen closely and make sure that the messages which appear on the screen are OK and that the reported cell size is correct, etc.

The header lines from your pattern file should appear on the CRT. If they don't something is wrong. The only time you should see pixel lines from your pattern file on the screen is when an error message is being displayed. If your header lines are the full width of the screen and your terminal has autowrap enabled, it may appear that the header lines shown on the screen are double spaced (blank lines display between the header lines). This is nothing to be concerned about.

You now (hopefully) have created a soft-font file ready to download. You may want to inspect it before downloading it to see if it looks reasonable. Ditto if it doesn't work right. You may do this using any editor or word processor provided that they can handle control characters (or binary for the case of printer font). VT220 soft-font could even contain a couple of meta-characters (above (or =) char. no. 128) if someone has manually added them to mark the start and end of downloading. You could even verify the code for a certain character manually using the coding principles shown in your terminal manual, or Font_Langs, etc. For dumb terminal fonts, at the end of the soft-font file you should find certain comments about the font including the 2 main header lines taken from the pattern file.

If you see a stack overflow (or underflow) message when running the program on an older Unix-like system, then use the "setstack" command. Setting it to 3072 may be sufficient.

5.4 Embedded Comments in Soft-Font

It is sometimes feasible embed comments in the soft-font even though font languages don't support comments. The purpose of such is to enable one to use an editor (perhaps an editor in binary mode) to examine the soft-font file to determine what the font is for, dates, authors, etc. For dumb terminals, these comments are simply added at the end of the soft-font code by pat2sf. These comments are thus also "downloaded" to the terminal after the font is downloaded. Since a terminal doesn't know they are comments, they may be displayed. It's unlikely that this will cause any damage to the font you've just downloaded. No decision has been made yet as to how to do this for printers since it would both waste paper and be confusing for the printer to print out the comments after each font download. There are likely ways to embed comments within commands that do nothing of any significance.


Next Previous Contents