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

From: Bo Yang <[email-masked]>
Date: Thu, 21 May 1992 18:35:05 -0700

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 > ccliba.24
                ...
                cat flib.24 | c2cc > cclibf.24

I've successfully modified Wang, Jingbai's ChTeX and made it work with multiple
fonts. There're some problems with gb2ps-2.0, mainly can't print same charactar
with different font styles on same page. Also FanTi font can't work sometimes.
Hope the author will fix these bugs soon.

I'll post a sample PS file made with ChTeX.

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+=bits[j*8+k][i]; ch<<=1; }
                if( ccf) fprintf( stdout, "%2.2x", ch);
                 else fputc( ch, stdout);
                }
            }
            if( ccf) fprintf( stdout, "\n");
        }
}

/*		end here		*/