Subject: Re: GB code and Bitmap file

From: [email-masked]
Date: Fri, 17 May 91 06:42:56 MDT

YLu writes:

 >
 > There is a small utility called HKU readnews (Riky Yeung's?) which
 > can display Big5 code on an ASCII terminal using the bitmap file
 > 'chinese.16'. I am trying to modify the program so that it can display
 > GB code on a dumb terminal by using the BYX bitmap file 'ziku'. I
 > couldn't figure out exactly how a 2-byte GB code is related to the
 > corresponding bitmap. It should be a simple algorithm. I guess that
 > the format of 'ziku' is similar to that of 'chinese.16', which represents
 > a Chinese word by 32 bytes. The original readnews program can use
 > the bitmap 'ziku', but the output is not what's expected (a "dog"
 > is displayed as a "house", things like that).
 >

Here are the calculations for getting bitmaps from GB and Big5 fonts.

1. GB

   index = ((first_byte - 161) * 94) + (second_byte - 161)
   index = index * num_bytes

2. Big5

   index = ((first_byte - 161) * 190) + (second_byte - 64)
   index = index * num_bytes

Where num_bytes is the number of bytes needed for one bitmap.  A 16x16
font requires 32 bytes for each bitmap, and a 24x24 font requires 72
bytes for each bitmap.

The result of these calculations, index, gives the starting point of
the bitmap in the font file.
-----------------------------------------------------------------------------
[email-masked]                      "I laughed.
Mark Leisher                                I cried.
Computing Research Lab                          I fell down.
New Mexico State University                        It changed my life."
Las Cruces, NM                     - Rich [Cowboy Feng's Space Bar and Grille]