Bitmapped Japanese Font Formats
The format for a fixed-size, uncompressed Japanese bitmapped font has the following simple structure.
The size of one character in a Japanese font is n x n (dot units). m is the largest integer that does not exceed (n + 7)/8. The data for one character has the usual format of m x n bytes arranged from the high-order column of the character's bitmap, advancing from left to right with m bytes in each column in order to the bottom row.
If the number of dots in the horizontal width is not divisible by 8, zeros are inserted in the remaining low-order bits in the last byte in each row. The high-order bits are on the left side.
These are arranged in the font file in the JIS code order. If the data for the J character becomes J = (H, L) (H is the high-order byte, and L is the low-order byte), the JIS codes must begin after
((H-33)x94 + L - 33) x m x n
bytes were skipped from the beginning of the file.
2. The above Japanese font (or different vertical and horizontal sizes similar to above) can be handled as a font file compressed by the unique knjtopk.exe function in the dviout.
This becomes
knjtopk c:\font\jfont\kanji.24 temp.24 24 24 H
c:\font\jfont\kanji.24 is an original font, and tmp.24 is the compressed font. The first 24 in the two numerical parameters is the number of horizontal dots. The last 24 is the number of vertical dots.
The standard compression of the PK font or the expansion and compression used by the JXL4 font compress by using the same method. The last parameter H above sets this expansion and compression.
3.The KG Japanese font format is suited for registering and handling a small number of characters. The character bitmapped data is stored without being compressed. Similar to the compressed Japanese font described above, the beginning of the file becomes
0, 0, 247, id[1], width[2], height[2], byte_width[2], dummy[22]
where id becomes "G" to distinguish this font from fonts with other formats. "dummy" is not used and is set to zero. The following characters are the JIS codes of the inserted characters.
total[2], code[total][2]
where "total" is the number of included characters, "code[0],..., code[total-1]" are the JIS codes in the recorded order (same two-byte integer as width[2]). Following this and without any gap, the uncompressed character data (in the format described in 1) are arranged until the end.
The data size of one character is (width + 7)/8 x height. Since the JIS code is placed in the Jth position when code[n-1] is equal to J, data is present from the location of (width + 7)/8 x height x j + 2 x code + 34 bytes from the beginning.