Subject: bitmapped_fonts

From: xiaofei (XiaoFei Wang)
Date: Sat, 30 Jan 93 01:21:12 CST

Hi, I would like to invite you for an informal and small scale discussion 
on chinese bitmapped fonts. The people I have contacted is list below.
If you are not interested in the discussion please email me so that I
will remove you from the distribution list. If you are, I should have a mail 
alias ready tomorrow so that you can use to communicate with other
programmers. I hope some agreement can be reached. 

The people I have contacted is list below. Please tell me whom I missed.

[email-masked] 
[email-masked] 
[email-masked] 
[email-masked]
[email-masked] 
[email-masked]      
[email-masked] 
[email-masked]
[email-masked]
[email-masked]
[email-masked]
[email-masked]
[email-masked]
[email-masked]
[email-masked] 
[email-masked]
[email-masked]
[email-masked]
[email-masked]
[email-masked]
[email-masked] 
[email-masked]
[email-masked]
[email-masked]
[email-masked]
[email-masked]

To get started, the following is the edited communication log file. 
I have removed the c source from the file for the seek of space
and put them to ifcss.org:/software/tmp. I will send you a message
as soon as the mail alias for communication is ready. 

--
>From xiaofei Tue Jan 26 19:56:28 1993
Return-Path: <xiaofei>
Date: Tue, 26 Jan 93 19:56:05 CST
From: xiaofei (XiaoFei Wang)
To: [email-masked]
Subject: cclib fonts
Cc: [email-masked], xiaofei
Status: RO

:#define SONGTI 	"cclib.24"
:#define KEITI		"cclib.k24"
:#define FANGSONGTI	"cclib.n24"
:#define HEITI		"cclib.h24"
:#define FANTI		"cclib.f24"
:#define USERDEF	"cclib.u24"
:
I have tried the version of gb2ps which
uses standard fonts, it works fine. 
However I have some confusions. 

Where can I find these fonts? 
cclib.24 is in JB Wang's ChTeX 
package the rest are not. 

There are cclib.{knhfj}24 fonts on 
ifcss.org:/software/fonts
but they are 'compressed fonts'
used by cnprint. If 
above fonts are truly standard 24x24 fonts,
then I would suggest the author of
cnprint to name his fonts to something else
to avoid confusin, for example, cclibc.k24

Please help me out

>From [email-masked] Thu Jan 28 06:20:45 1993
Via: uk.ac.loughborough; Thu, 28 Jan 1993 11:48:33 +0000
From: YLu <[email-masked]>
Subject: Re: cclib fonts
To: [email-masked] (XiaoFei Wang)
Date: Thu, 28 Jan 93 11:47:01 GMT
Cc: [email-masked]
Status: RO

> 
> To: [email-masked]
> CC: [email-masked], [email-masked]
>  
> :#define SONGTI         "cclib.24"
> :#define KEITI          "cclib.k24"
> :#define FANGSONGTI     "cclib.n24"
> :#define HEITI          "cclib.h24"
> :#define FANTI          "cclib.f24"
> :#define USERDEF        "cclib.u24"
> :
> I have tried the version of gb2ps which
> uses standard fonts, it works fine.
> However I have some confusions.
>  
> Where can I find these fonts?
> cclib.24 is in JB Wang's ChTeX
> package the rest are not.
>  
> There are cclib.{knhfj}24 fonts on
> ifcss.org:/software/fonts
> but they are 'compressed fonts'
> used by cnprint. If
> above fonts are truly standard 24x24 fonts,
> then I would suggest the author of
> cnprint to name his fonts to something else
> to avoid confusion, for example, cclibc.k24
>  
> Please help me out
>  
> ----------------------
> You can follow the instructions in the GB2PS readme file and you are OUT.
> If I remember correctly, you should not define the fonts that way.  The
> fonts for GB2PS is under the same directory and they are in their original
> name (I do not remember exactly, but you can refer to cclib.jfknh24.readme
> for the names).
>  
> Those cclib.*24 fonts are truely 24x24 fonts but in compressed format, the
> format (or with slight modification) is adopted by ChTeX (at least for its
> 16x16 fonts, I am not exactly sure about 24x24 now, and that was where
> I borrowed the idea), by NJSTAR, and by the author who uses the two 16x16
> fonts (cclib.16 and cclibf.16, these two fonts can also be used by CNPRINT
> V2.11).  The advantage for using the compressed format is obvious.  And I
> hope software developers can use some kind of compressed fonts for the
> benefits of users.  The fonts I posted are by no means standard, but if
> there is a standard, I would like to follow.  Actually, the fonts used by
> present version of GB2PS (V2.02) is compressed compared to those used by
> version 1.0 of GB2PS (but I do not know if they are standard non-compressed
> format, it is obvious that the fonts used by V2.02 and V1.0 of GB2PS can not
> all be standard).
>  
> As to the name change, it would be a serious thing since it would affect
> present users.  However, if there is a reasonable need (even not that strong)
> from other software developers and users,I would like to adopt it for the sake
> of CSS around the world.  I hope Xiaofei can help me to gather the opinions
> from other software developers and users.
>  
> Thank you and have a nice new year !
>  
> Yidao
>  
> 

It is indeed very confusing and frustrating for every program to use
different "fonts" for, oddly enough, the same purpose.  There ought to
be a standard.  It wouldn't be difficult at all to adopt a standard set
of bitmap Chinese fonts.  I have modified hz2ps, cnprint, gb2ps and
ChTeX to make use of the same set of public domain bitmap (is it called
compressed?) fonts (cclib.24 format).

As I explained briefly in the comment block at the beginning of
readgb.c, the square Chinese bitmap fonts can be arranged differently.
The bitmaps can be stored in row-order or in column-order.  While the
column-order bitmaps may be convenient for use with dot-matrix printers,
the row-order bitmaps are commonly available and seem to be logical for
coding for PostScript printers.  The two formats are readily convertible
(see c2cc.c and gbfconvt.c).

It's obvious that the most economical (disk space conscious) way of
storing Chinese fonts is to use the 1-bit bitmap format as outlined
above.  The GB standard, as I understand, defines (0xF7-0xA1+1)*94 =
8178 legal GB code.  For the 16x16 square font, the maximum font file
size would be 8178*32 = 261696 bytes.  The 24x24 font file would require
8178*72 = 588816 bytes.  The most commonly used 16x16 font files [ziku
(Songti) in BYX 1.1, cclib.16 (Songti) and cclibf.16 (Fanti) in ChTeX
and early versions of NJSTAR] are in row-order and have a hole of 752
legal codes undefined between the eighth Qu and the sixteenth Qu.  This
reduces the file size to (8178-752)*32 = 237632 bytes.  The common 24x24
font files [cclib.24 (Songti) and cclibf.24 (Fanti) used in ChTeX] are
also in row-order and have all the legal codes defined, albeit some 564
blanks between the nineth Qu and the fifteenth Qu.  These files have the
maximum size of 588816 bytes.

The other 24x24 fonts used by cnprint and gb2ps all seem to be derived
from the fonts alib.24 (Kaiti), blib.24 (Fangsongti), dlib.24 (Heiti),
and flib.24 (Fanti) in the cc2tex 1.0 package.  These fonts are stored
in column-order and have 564 coding planes between the nineth Qu and the
fifteenth Qu taken out, thus reducing the file sizes to (8178-564)*72 =
548208 bytes.  The c2cc.c program posted to ccnet by Yang Bo can be used
to convert these fonts to row-oder ones (cclib.24 format, 588816 bytes)
which are directly usable by his modified ChTeX.  I've also posted a
program gbfconvt.c to ccnet some time ago, which fixed a small problem
of c2cc (Yang Bo later rectified it) and can convert between row-order
and column-order Hanzi bitmaps.  Although the full 24x24 font file
(cclib.24) is 588816-548208 = 40608 bytes (about 40k) larger than the
incomplete "compressed (?)" alib.24 or its row-oder counterpart, the
algorithms used in such programs as cnprint and gb2ps to get bitmaps are
much simpler (no conditional statements required) and the extra 40k is
not that large.  Maybe somebody will fill the blanks with interesting
symbols or missing Hanzi characters in the future.

The gb2ps program by W.  Sun uses font files with names like
csong24.ccf, ckei24.ccf, chei24.ccf, cfan24.ccf and cfang24.ccf, which
are in QuWei-indexed PostScript image format.  The .ccf files are
actually text files (on a UNIX system) but were treated as binary ones
(The newline is hard-coded, see:  long size_of_CH = 150;).  It would
have difficulty when porting to MS-DOS platform (I did it for version
1.0).  The font files are unnecessarily large and should be transferred
to MS-DOS systems in binary format.  A single font file can barely be
held on a high density 1.44M floppy disk.  As you can see from the
modified gb2ps.c I posted to you, it is very easy to make it use the
standard format fonts.  The font file names are not significant, they
can be changed to follow a standard scheme.

Hz2ps by Fung F.  Lee and Ricky Yeung adopted another strategy.  Three
separate smaller font files are used.  You can also tweak the program a
little bit to utilize the standard cclib.24 font file.

Yidao's cnprint is an interesting program.  I had a close look at it
recently on a weekend.  only two lines of code need to be modified to
make it use the standard cclib.24 format.

(1) comment out the following line:
 		if (addr>=1410) addr -= 564;
(2) change the following line:
 			fstring[(addr>=1410)? (addr-564):addr]++;
    to
 			fstring[addr]++;

Since the font file names cclib.j24, cclib.f24, cclib.k24, cclib.h24 and
cclib.n24 have certain defined functions in the program, I didn't change
the program a lot.  The file naming scheme seems to be reasonable.  I
have adopted the same font file names for gb2ps and have renamed
cclib.24 to cclib.j24, and have cclib.24 soft-linked to cclib.j24,
cclibf.24 soft-linked to cclib.f24, and cclibk.24 soft-linked to
cclib.k24 for ChTeX.  Thus the same set of font files can be used for
ChTeX, gb2ps, cnprint, and hz2ps (you can set up environment variables
CCLIB24jt pointing to cclib.j24 and CCLIB24ft pointing to cclib.f24 for
ChTeX if you like).

I would suggest that cnprint should be modified to use the standard
cclib.24 format (complete 588816 bytes).  File names shall remain the
same. Gb2ps can also be upgraded to use the same set of standard fonts.
The Songti font cclib.j24 is the same as cclib.24 in ChTeX and other
packages.  Other font files can be generated from the fonts in cc2tex
1.0 package with c2cc or my gbfconvt.

	gbfconvt -b alib.24 cclib.k24
	gbfconvt -b blib.24 cclib.n24
	gbfconvt -b dlib.24 cclib.h24
	gbfconvt -b flib.24 cclib.f24

or

	c2cc < alib.24 > cclib.k24
	c2cc < blib.24 > cclib.n24
	c2cc < dlib.24 > cclib.h24
	c2cc < flib.24 > cclib.f24

It saves me a lot of disk space. What do you think?

Regards,
Yuzhao

I include gbfconvt.c here.
[ gbfconvt.c deleted here, it can be found in 
ifcss.org:/software/tmp directory. ] 

>From [email-masked] Thu Jan 28 06:20:57 1993
Via: uk.ac.loughborough; Thu, 28 Jan 1993 11:51:38 +0000
From: YLu <[email-masked]>
Subject: Re: cclib fonts -- ccf2lib.c
To: [email-masked] (XiaoFei Wang)
Date: Thu, 28 Jan 93 11:50:45 GMT
Status: RO

The large .ccf font files used in gb2ps can be converted back
to the smaller standard formats as cclib.24 with the following
a couple of lines of C code. There is no need to ftp another
large set of font files if you already have the .ccf files.

[ ccf2lib.c deleted. It can be found from 
ifcss.org:/software/tmp [email-masked] ] 

>From [email-masked] Thu Jan 28 14:38:26 1993
Return-Path: <[email-masked]>
Date: Tue, 26 Jan 93 20:49 CST
From: [email-masked]
Subject: Re: cclib fonts
To: [email-masked]
X-Vms-To: IN%"[email-masked]"
Status: RO

To Xiaofei:

There are obvious contradictions in this message.  He tried GB2PS and it 
works fine, but how could he try it without even one font ?  By the way, the
SongTi font is supplied with GB2PS package (Why he need to get it from ChTex?)
and cclib.24 in ChTex is in compressed format (which can not be used by GB2PS)
if I remembered correctly. 

If you think there is indeed a need to change the name, I would be very glad 
to do so.  Thank you very much. 

Yidao

>From xiaofei Thu Jan 28 15:31:55 1993
Return-Path: <xiaofei>
Date: Thu, 28 Jan 93 15:31:29 CST
From: xiaofei (XiaoFei Wang)
To: [email-masked]
Subject: Re: cclib fonts
Cc: [email-masked], xiaofei
Status: RO

:From: [email-masked]
:To Xiaofei:
:
:There are obvious contradictions in this message.  He tried GB2PS and it 
:works fine, but how could he try it without even one font ?  By the way, the
:SongTi font is supplied with GB2PS package (Why he need to get it from ChTex?)
:and cclib.24 in ChTex is in compressed format (which can not be used by GB2PS)
:if I remembered correctly. 
:
:If you think there is indeed a need to change the name, I would be very glad 
:to do so.  Thank you very much. 
:
:Yidao

There is no contradictions in my message, let me explain: 

1) the gb2ps I tried is one Y.Lu modified. 
2) the font I used is cclib.24 from chtex package, and now I put on 
   ifcss.org:/software/fonts
   I ftp'ed chtex from crl.nmsu.edu 
3) it works. 
4) the other fonts comes with cnprint, such as cclib.h16, does not work 
   gb2ps-modified, it prints out some chars than what they are
   meant to be.

Above are facts. Now the explanation is, cclib.24 is NOT compressed, 
I just checked the size, cclib.24 is 588.8 kB while 'compressed'
fonts with cnprint such as cclib.{fhkn}24 are 548.2 kB. I do not know
why cclib.j24 is an exception which is 560.5 kB. 

PS: I would like to gather some software developers together to
have an e-mail meeting, purposes: 
1) identifies 'standard' bitmap fonts
2) font naming standard
3) consistency in using fonts 
etc. If you think it is a good idea, I will try to apply a user
alias called [email-masked]
I think CCnet maybe too broad for this purpose. 
Let me know your opinions. 

>From [email-masked] Fri Jan 29 06:22:37 1993
Via: uk.ac.loughborough; Fri, 29 Jan 1993 12:19:40 +0000
From: YLu <[email-masked]>
Subject: Re: cclib fonts
To: [email-masked] (XiaoFei Wang)
Date: Fri, 29 Jan 93 12:18:53 GMT
Cc: [email-masked]
Status: RO

> 
> :From: [email-masked]
> :To Xiaofei:
> :
> :There are obvious contradictions in this message.  He tried GB2PS and it 
> :works fine, but how could he try it without even one font ?  By the way, the
> :SongTi font is supplied with GB2PS package (Why he need to get it from ChTex?)
> :and cclib.24 in ChTex is in compressed format (which can not be used by GB2PS)
> :if I remembered correctly. 
> :
> :If you think there is indeed a need to change the name, I would be very glad 
> :to do so.  Thank you very much. 
> :
> :Yidao
> 
> There is no contradictions in my message, let me explain: 
> 
> 1) the gb2ps I tried is one Y.Lu modified. 
> 2) the font I used is cclib.24 from chtex package, and now I put on 
>    ifcss.org:/software/fonts
>    I ftp'ed chtex from crl.nmsu.edu 
> 3) it works. 
> 4) the other fonts comes with cnprint, such as cclib.h16, does not work 
>    gb2ps-modified, it prints out some chars than what they are
>    meant to be.
> 
> Above are facts. Now the explanation is, cclib.24 is NOT compressed, 
> I just checked the size, cclib.24 is 588.8 kB while 'compressed'
> fonts with cnprint such as cclib.{fhkn}24 are 548.2 kB. I do not know
> why cclib.j24 is an exception which is 560.5 kB. 
> 
> PS: I would like to gather some software developers together to
> have an e-mail meeting, purposes: 
> 1) identifies 'standard' bitmap fonts
> 2) font naming standard
> 3) consistency in using fonts 
> etc. If you think it is a good idea, I will try to apply a user
> alias called [email-masked]
> I think CCnet maybe too broad for this purpose. 
> Let me know your opinions. 
> 
> 

Have you received my messages sent out yesterday? A carbon copy
of one of the messages was also sent to Yidao. I think I have
made it clear the font problems caused by the misunderstanding
of bitmap font formats. There is a minor error in my first message.
The cclib.16 (237632 bytes) bitmap file has an undefined coding
area of 752 Hanzi characters between the seventh Qu and the
fifteenth Qu (not between the eighth Qu and the sixteenth Qu).

There is a small MS-DOS utility program written by Zhang Ruoxin
called cc (confusing, isn't it?) which can display the whole
bitmaps of a square Hanzi font file on a PC screen with EGA or
VGA display.  My readgb program which has a few options can also
be used to check font files.

My point is that a program can and should employ standard format
fonts without effecting the program's functionality. The saves
precious disk space for somes users if they want to try those
different programs.

For the commonly used 24x24 Hanzi fonts which are mainly used
for printing purpose and have reasonably good quality, a few
different styles (faces) are available as public domain data.
Let's all use the standard cclib.24 format which is, after
all, complete (with blank areas though) and easy to understand
and program. Suppose we use file names cclib.[jfhkn]24 or
cclib[jfhkn].24 for the Songti, Fanti, Heiti, Kaiti and
Fangsongti, respectively, these files should and can be
made to follow the cclib.24 format (see c2cc and gbfconvt).

Regards,
Yuzhao

>From [email-masked] Fri Jan 29 06:36:29 1993
Via: uk.ac.loughborough; Fri, 29 Jan 1993 12:34:52 +0000
From: YLu <[email-masked]>
Subject: Re: cclib fonts -- modified cnprint.c
To: [email-masked] (XiaoFei Wang)
Date: Fri, 29 Jan 93 12:34:20 GMT
Status: RO

Please use c2cc or my gbfconvt to generate cclib.[fkhn]24
from [abdf]lib.24 in the cc2tex 1.0 pacakage or ccf2lib.c
to convert those .ccf files in the gb2ps 2.02 package back
to the standard formats and use file names cclib.[jfkhn]24
as described in my previous messages. The modified gb2ps
program I posted to you (you may change the SONGTI definition
to "cclib.j24" if you like) should work with those fonts
together with a slightly modified cnprint.c. I think I
should post to you the cnprint.c source I've modified for
personal use.

------ CUT HERE ------
[ modified cnprint.c deleted, It can be found from 
ifcss.org:/software/tmp [email-masked] ] 

>From [email-masked] Fri Jan 29 12:01:29 1993
Return-Path: <[email-masked]>
Date: Fri, 29 Jan 93 11:54 CST
From: [email-masked]
Subject: Re: cclib fonts
To: [email-masked]
X-Vms-To: IN%"[email-masked]"
Status: RO

Let me (Yidao) first breiefly answer the question headed by ??????????. 

cclib.j24 uses a compressed format (72 bytes for one character), which is 
the same as cclib.24 (I do not know if there is an orietation difference
since I did not have read access to cclib.24).  Also, cclib.j24 left out
6 empty sections.  cclib.{fhkn}24 all share the same feature.  In addition,
cclib.j24 encoded the ASCII characters as well in compressed format but
cclib.{fhkn}24 not. This should explain the size difference.  I did not post 
any 16x16 fonts on ftp site. 

I think it is a good idea to gather software developers together to disscuss
the font problems. It would be a very good thing for all the CSS around the 
world. 

As to Y.LU's proposal (see below), I think we are common at the point that 
we should use compressed format (i.e. 72 bytes for one 24x24 character and
32 bytes for one 16x16 character).  I also agree with Y.LU on the point that
the orietation used by gb2ps and cnprint is simpler for PostScript driver
programs (Sorry I do not know exactly if cclib.24 on the ftp site now uses 
the same orietation).  

The next question is wether to encode the 6 empty sections in our "standard".
It is true encoding the 6 empty sections would allow upward competivity of 
the software if someday the empty sections is filled, but at the expense of
some extra disk spaces at each user.  I personally have no inclination at
this point.  The reason I adopt the present version (leave them out) was that
when I started to modify GB2PS I did not intend to make it public (GB2PS 
did not work properly on my VAX/VMS site, including V2.02). 

And what should we do with 16x16 fonts?

My suggestion now is:

1. use the compressed format with the orietation used by present gb2ps and 
	cnprint. 

2. Put the ASCII at the end of all Chinese character, if the ASCII exists. 

3. Better to use the same order and location for 16x16 and 24x24 fonts, i.e.
	whether leave out the same number of sections or encode all the empty 
	sections as well. 
   Y.Lu seems to favor encoding all the empty sections as well.  I have no
	objections to this.  If others agree, I'll change cclib.{jfjkn}24 so 
	that they do not leave the 6 empty sections and post them back.  The
	so modified cclib.j24 would replace present cclib.24 since a mis-
	represented character in almost all 24x24 Jianti fonts (I do not know
	if the present cclib.24 contains the same mistake) has been fixed in 
	present cclib.j24. 

I hope we can settle this soon so that I can post my cnprint V2.11 earlier.
 
Thank you very much and I'd like to hear from you. 

Yidao

---------------------------------------------------------

>From [email-masked] Fri Jan 29 12:43:14 1993
Return-Path: <[email-masked]>
Date: Fri, 29 Jan 93 12:36 CST
From: [email-masked]
Subject: Re: cclib fonts
To: [email-masked]
X-Vms-To: IN%"[email-masked]"
Status: RO

I just tested cclib.24.  It contains the same information as cclib.j24 except
it also included 6 empty sections.  The structure, orietation are the same.