Subject: translate fonts in cc2tex to cclib or ccf( gb2ps) format, FIXED BUG

From: Bo Yang <[email-masked]>
Date: Fri, 22 May 1992 16:51:51 -0700

As Y. LU ([email-masked]) has kindly pointed out, there's a bug at c2cc.c
so that two vertical scanning lines are loosen. A silly bug, here's the fix.

--------------
This is a short program to translate the KaiTi, HeiTi, FangSong, FanTi
24*24 fonts in cc2tex-1.0 packages to cclib or ccf format, to be
used with modified ChTeX or gb2ps.

COMPILE:  save this message as c2cc.c, delete the lines before --- CUT---,
          do:
                cc -O -o c2cc c2cc.c

USE:      download the fonts alib.24, blib.24, dlib.24, flib.24 from
          crl.nmsu.edu, under pub/chinese/fonts.

          to use with gb2ps:
                cat alib.24 | c2cc -ccf > ckei24.ccf
                cat blib.24 | c2cc -ccf > cfang24.ccf
                cat dlib.24 | c2cc -ccf > chei24.ccf
                cat flib.24 | c2cc -ccf > cfan24.ccf

          to use with ChTeX:
		cat alib.24 | c2cc > cclibk.24
		cat blib.24 | c2cc > cclibb.24
		cat dlib.24 | c2cc > cclibh.24
		cat flib.24 | c2cc > cclibf.24

I'll release the modified Wang, Jingbai's ChTeX (ChyTeX) which works with
multiple fonts. There're some problems with gb2ps-2.0, mainly can't print same
character with different font styles on same page. Also FanTi font can't work
sometimes. Hope the author of gb2ps will fix these bugs soon.

Good Luck on your hacking

Bo
-------------- CUT HERE ---------- c2cc.c ----------------
#include <stdio.h>
#include <string.h>

main(argc, argv)
int argc;
char **argv;
{
register int i, j, k;
unsigned char ch, bits[24][24];
int ccf=0, code=0;

    if( argv>1)
        if( strncmp(argv[1], "-ccf", 4) == 0) ccf=1;
    for( code =0; code < 94*87; code++) {
        for( i=0; i<72; i++) {
            ch= (code >= 9*94 && code <15*94) ? 0 : fgetc(stdin);
                  /* blank planes inserted     */
            for( j=0; j<8; j++) {
                bits[i/3][(i%3)*8+7-j] = ch & 0x01;
                ch >>= 1;
                }
            }
        if(ccf) fprintf( stdout, "%2.2d%2.2d ", code/94+1, (code%94)+1);
        for( i=0; i<24; i++) {
            for( j=0; j<3; j++){
                ch=0;
                for( k=0; k<8; k++) { ch<<=1; ch+=bits[j*8+k][i]; }
                if( ccf) fprintf( stdout, "%2.2x", ch);
                 else fputc( ch, stdout);
                }
            }
            if( ccf) fprintf( stdout, "\n");
        }
}

/*	end of file			*/