11-54 Soft Font Creation EN
Class 1 - Bitmap Data
Class 1 or bitmap (raster) character data is a string of bytes
containing the dot-per-bit image of the character, no data
compression. If a bit is set to one, the corresponding dot is printed.
The data is grouped in dot rows. A row describes a one-dot-high strip
of the character from left to right, in the direction of the printer’s raster
scan (see the Portrait Bitmap Character Data Example, at the end of
this chapter). Zeroed bits must be added to the end of each row to
make it contain an integral number of bytes. The dot rows are
organized from top to bottom of the character. For example, the first
dot row of data corresponds to the top dot row of the character.
The number of bytes of the character data should be exactly
Character Width (in bytes) times Character Height. If more
data is received, it is discarded; if less data is received, the character
consists of only the data downloaded.
Class 2 - Compressed Bitmap Data
For a compressed bitmap character, the data is composed of a string
of bytes using a run-length encoding with line repetition compressed
format (see Figure 11-2). The first byte indicates the number of times
the first raster row is repeated after its initial occurrence. It is
assumed that the first pixel in a row is white, hence the second byte
indicates how many white pixels start the row. The third byte indicates
how many black pixels, the fourth byte indicates the number of white
pixels again, etc. If the first pixel in a row is black, the white pixel
indicator (the second byte) is 0. If there are more than 255 pixels in a
row of the same type, there is a byte containing 255, followed by a 0
byte, followed by a byte containing the count of remaining pixels of
the current type.
The width of each row is determined by the character width (in dots)
as specified in the character descriptor for the character. The pixel
count (number of 1’s and 0’s bits) for each row in the character cell
must equal the character width. For example, in Figure 11-5, the cell
width is 20, thus each row (excluding the repetition count byte) adds
up to 20.
Once the row has been filled, the row is duplicated as indicated in its
first byte, then a new row is started.