| 1 |
@x |
| 2 |
#include <w2c/config.h> |
| 3 |
@y |
| 4 |
#include <kpathsea/kpathsea.h> |
| 5 |
#include <w2c/config.h> |
| 6 |
@z |
| 7 |
|
| 8 |
% |
| 9 |
% local variable "nt" && "ct" |
| 10 |
@x |
| 11 |
halfword lf,tfm_lh,bc,ec,nw,nh,nd; /* subfile size parameters */ |
| 12 |
@y |
| 13 |
halfword lf,tfm_lh,bc,ec,nw,nh,nd,nt; /* subfile size parameters */ |
| 14 |
@z |
| 15 |
|
| 16 |
@x |
| 17 |
int h_and_d; /* height and depth indices being unpacked */ |
| 18 |
@y |
| 19 |
int h_and_d; /* height and depth indices being unpacked */ |
| 20 |
halfword ct; /* char and type */ |
| 21 |
halfword id; /* JFM font id */ |
| 22 |
@z |
| 23 |
|
| 24 |
@x |
| 25 |
@<Read the character data and the width, height, and depth tables and |
| 26 |
|goto done|@> |
| 27 |
@y |
| 28 |
@<Read the character type table@>; |
| 29 |
@<Read the character data and the width, height, and depth tables and |
| 30 |
|goto done|@> |
| 31 |
@z |
| 32 |
|
| 33 |
@x |
| 34 |
@d read_two(A) { (A)=tfbyte; |
| 35 |
@y |
| 36 |
@d read_pair(A) { (A)=tfbyte; |
| 37 |
tfget; (A)=(A)*0400+tfbyte; |
| 38 |
} |
| 39 |
@d read_triplekanji(A) { (A)=tfbyte; |
| 40 |
tfget; (A)=(A)*0400+tfbyte; |
| 41 |
tfget; (A)=(A)+tfbyte*0200000; |
| 42 |
} |
| 43 |
@d read_two(A) { (A)=tfbyte; |
| 44 |
@z |
| 45 |
|
| 46 |
% |
| 47 |
% routine to process JFM file format |
| 48 |
@x |
| 49 |
@<Read the \.{TFM} size fields@>= |
| 50 |
tfget; read_two(lf); |
| 51 |
@y |
| 52 |
@d yoko_jfm_id 11 /* `yoko-kumi' fonts */ |
| 53 |
@d tate_jfm_id 9 /* `tate-kumi' fonts */ |
| 54 |
@d font_jfm_p(A) (mp->font_id[(A)]!=0) |
| 55 |
@d incr(A) (A)=(A)+1 /* increase a variable by unity */ |
| 56 |
@<Read the \.{TFM} size fields@>= |
| 57 |
tfget; read_two(lf); |
| 58 |
if ( (lf==yoko_jfm_id) || (lf==tate_jfm_id) ) { |
| 59 |
id=lf; |
| 60 |
tfget; read_two(nt); |
| 61 |
tfget; read_two(lf); |
| 62 |
} else { |
| 63 |
id=0; nt=0; |
| 64 |
}; |
| 65 |
@z |
| 66 |
|
| 67 |
@x |
| 68 |
whd_size=(size_t)((ec+1-bc)+nw+nh+nd); |
| 69 |
@y |
| 70 |
whd_size=(size_t)((ec+1-bc)+nt+nw+nh+nd); |
| 71 |
@z |
| 72 |
|
| 73 |
% |
| 74 |
% reserve space for character type table |
| 75 |
@x |
| 76 |
mp->char_base[n]=(int)(mp->next_fmem-(size_t)bc); |
| 77 |
mp->width_base[n]=(int)(mp->next_fmem+(size_t)(ec-bc)+1); |
| 78 |
@y |
| 79 |
mp->font_id[n]=id; |
| 80 |
mp->font_nt[n]=nt; |
| 81 |
mp->ctype_base[n]=mp->next_fmem; |
| 82 |
mp->char_base[n]=(int)(mp->next_fmem+nt-(size_t)bc); |
| 83 |
mp->width_base[n]=(int)(mp->next_fmem+nt+(size_t)(ec-bc)+1); |
| 84 |
@z |
| 85 |
|
| 86 |
% |
| 87 |
% read character type table |
| 88 |
% |
| 89 |
@x |
| 90 |
tf_ignore(4*(tfm_lh-2)) |
| 91 |
@y |
| 92 |
tf_ignore(4*(tfm_lh-2)) |
| 93 |
|
| 94 |
@ @<Read the character type table@>= |
| 95 |
ii=mp->ctype_base[n]+nt; |
| 96 |
i=mp->ctype_base[n]; |
| 97 |
while ( i<ii ) { |
| 98 |
tfget; read_triplekanji(ct); /* allow character codes up to 0xffffff */ |
| 99 |
mp->font_info[i].hh.LH=ct; |
| 100 |
tfget; mp->font_info[i].hh.RH=tfbyte; |
| 101 |
incr(i); |
| 102 |
} |
| 103 |
@z |
| 104 |
|
| 105 |
@x |
| 106 |
mp_pack_file_name(mp, mp->cur_name,mp->cur_area,mp->cur_ext); |
| 107 |
mp->tfm_infile = (mp->open_file)(mp, mp->name_of_file, "r",mp_filetype_metrics); |
| 108 |
@y |
| 109 |
mp_pack_file_name(mp, mp->cur_name,mp->cur_area,mp->cur_ext); |
| 110 |
{ |
| 111 |
char *fulln; |
| 112 |
fulln = kpse_find_file(fname, kpse_tfm_format, 1); |
| 113 |
mp->tfm_infile = (mp->open_file)(mp, fulln, "r",mp_filetype_metrics); |
| 114 |
if(fulln) mp_xfree(fulln); |
| 115 |
} |
| 116 |
@z |