#include #include #include "types.h" #include "pcx.h" #include "memman.h" int xs,ys; char *pic; char font_buffer[65536]; word font_p=0; word char_table[256]; int top_line; int bott_line; int base_line; int top_ofs; char znaky[]="0123456789A�BC�D�E��FGHI�JKL��MN�O�PQR�S�T�U��VWXY�Z�" "a�bc�d�e��fghi�jkl��mn�o�pqr�s�t�u��vwxy�z�" "~!@#$%^&*()_+|-=\\[]{};':,./<>?"; void load_font_pic(char *filename) { open_pcx(filename,A_8BIT_NOPAL,&pic); memcpy(&xs,pic,2); memcpy(&ys,pic+2,2); top_line=0; base_line=0; bott_line=-1; } char get_point(int x,int y) { return *(pic+xs*y+x+6); } int find_lead(int last) { last++; while (last=0) { x=base_line-top_line; if (x>top_ofs) top_ofs=x; lead_up_line(&x,&y); } base_line=0;bott_line=-1; do { lead_up_line(&x,&y); top_line=base_line-top_ofs; if ((x=find_next_char(x,top_line,bott_line))==-1) return fp-font_buffer; while (*zn!=0 && x>0) { char_table[*zn]=(fp-font_buffer)+sizeof(char_table); fp=read_char(fp,&x,top_line,bott_line); x=find_next_char(x,top_line,bott_line); zn++; } } while (*zn); return fp-font_buffer; } void save_font(char *filename,word bufsiz) { FILE *f; f=fopen_icase(filename,"wb"); fwrite(char_table,sizeof(char_table),1,f); fwrite(font_buffer,bufsiz,1,f); fclose(f); } void main() { word s; load_font_pic("..\\font\\timese2.pcx"); s=recognize(); save_font("..\\font\\timese2.fon",s); }