1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
#include <kpathsea/kpathsea.h>
#include <ptexenc/ptexenc.h>
#include "makejvf.h"
#include "uniblock.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
FILE *vfp,*afp=NULL;
char *atfmname,*vtfmname,*afmname,*vfname,*kanatfm,*jistfm,*ucsqtfm;
int kanatume=-1,chotai=0,baseshift=0,minute=0,useset3=0,hankana=0,fidzero=0;
long ucs=0;
int main(int argc, char ** argv)
{
int i,j,ib;
int c;
long ch;
kpse_set_program_name(argv[0], "makejvf");
set_enc_string("sjis", "euc");
while ((c = getopt (argc, argv, "k:K:Ca:b:mu:3J:U:Hi")) != -1)
switch (c) {
case 'k':
kanatume = atoi(optarg);
break;
case 'K':
kanatfm = xstrdup(optarg);
break;
case 'C':
chotai=1;
break;
case 'a':
afmname = xstrdup(optarg);
{
char *fpath = kpse_find_file(afmname, kpse_afm_format, 0);
if (fpath) {
afp = fopen(fpath, "r");
free(fpath);
}
}
if (!afp) {
fprintf(stderr,"no AFM file, %s.\n",afmname);
exit(100);
}
break;
case 'b':
baseshift = atoi(optarg);
break;
case 'm':
minute=1;
break;
case 'u':
if (!strcmp(optarg, "gb"))
ucs = ENTRY_G;
else if (!strcmp(optarg, "cns"))
ucs = ENTRY_C;
else if (!strcmp(optarg, "jisq"))
ucs = ENTRY_JQ;
else if (!strcmp(optarg, "jis"))
ucs = ENTRY_J;
else if (!strcmp(optarg, "ks"))
ucs = ENTRY_K;
else {
fprintf(stderr,"Charset is not set\n");
ucs = ENTRY_NO;
}
break;
case '3':
useset3=1;
break;
case 'J':
jistfm = xstrdup(optarg);
break;
case 'U':
ucsqtfm = xstrdup(optarg);
break;
case 'H':
hankana=1;
break;
case 'i':
fidzero=1;
break;
default:
usage();
exit(0);
}
if (kanatume>=0 && !afp) {
fprintf(stderr,"No AFM file for kanatume.\n");
exit(100);
}
if (argc - optind != 2) {
usage();
exit(0);
}
atfmname = xmalloc(strlen(argv[optind])+4);
strcpy(atfmname, argv[optind]);
{
const char *p = xbasename(argv[optind]);
vfname = xmalloc(strlen(p)+4);
strcpy(vfname, p);
}
if (FILESTRCASEEQ(&vfname[strlen(vfname)-4], ".tfm")) {
vfname[strlen(vfname)-4] = '\0';
}
strcat(vfname,".vf");
vtfmname = xstrdup(argv[optind+1]);
if (FILESTRCASEEQ(&vtfmname[strlen(vtfmname)-4], ".tfm")) {
vtfmname[strlen(vtfmname)-4] = '\0';
}
tfmget(atfmname);
maketfm(vtfmname);
if (kanatfm) {
if (FILESTRCASEEQ(&kanatfm[strlen(kanatfm)-4], ".tfm")) {
kanatfm[strlen(kanatfm)-4] = '\0';
}
maketfm(kanatfm);
}
if (jistfm) {
if (FILESTRCASEEQ(&jistfm[strlen(jistfm)-4], ".tfm")) {
jistfm[strlen(jistfm)-4] = '\0';
}
maketfm(jistfm);
}
if (ucsqtfm) {
if (FILESTRCASEEQ(&ucsqtfm[strlen(ucsqtfm)-4], ".tfm")) {
ucsqtfm[strlen(ucsqtfm)-4] = '\0';
}
maketfm(ucsqtfm);
}
vfp = vfopen(vfname);
if (ucs) {
ib=0;
for (i=0;i<(useset3*2+1);i++)
for (j=0;j<65536;j++) {
ch=i*65536+j;
if (search_cjk_entry(&ib,ch,ucs))
writevfu(ch,vfp);
}
} else {
for (i=0;i<94;i++)
for (j=0;j<94;j++)
writevf((0x21+i)*256+(0x21+j),vfp);
}
vfclose(vfp);
exit(0);
}
void usage(void)
{
fputs2("MAKEJVF ver.1.1a-u1.21 -- make Japanese VF file.\n", stderr);
fputs2("%% makejvf [<options>] <TFMfile> <PSfontTFM>\n", stderr);
fputs2("options:\n", stderr);
fputs2("-C ĹÂΥ⡼¥É\n", stderr);
fputs2("-K <TFMfile> Èó´Á»úÉôÍѤ˺îÀ®¤¹¤ëPS¥Õ¥©¥ó¥ÈTFM̾\n", stderr);
fputs2("-b <¿ôÃÍ> ¥Ù¡¼¥¹¥é¥¤¥óÊäÀµ\n", stderr);
fputs2(" ʸ»ú¤Î¹â¤µ¤ò1000¤È¤·¤ÆÀ°¿ô¤Ç»ØÄê\n", stderr);
fputs2(" ¥×¥é¥¹¤Çʸ»ú¤¬²¼¤¬¤ê¡¢¥Þ¥¤¥Ê¥¹¤Çʸ»ú¤¬¾å¤¬¤ë\n", stderr);
fputs2("-m ½Ä½ñ¤»þ¤Ë¥¯¥ª¡¼¥È(¡Ç¡É)¤ÎÂå¤ï¤ê¤Ë¥ß¥Ë¥å¡¼¥È(¡ì¡í)¤ò»ÈÍÑ\n", stderr);
fputs2("-a <AFMfile> AFM¥Õ¥¡¥¤¥ë̾¡Ê¤«¤ÊµÍ¤á»þ¤Ë»ÈÍÑ¡Ë\n", stderr);
fputs2("-k <¿ôÃÍ> ¤«¤ÊµÍ¤á¥Þ¡¼¥¸¥ó»ØÄê\n", stderr);
fputs2(" ʸ»úÉý¤ò1000¤È¤·¤ÆÀ°¿ô¤Ç»ØÄê¡£-a¥ª¥×¥·¥ç¥ó¤È¶¦¤Ë»ÈÍÑ\n", stderr);
fputs2("-u <Charset> UCS mode\n", stderr);
fputs2(" <Charset> gb : GB, cns : CNS, ks : KS\n", stderr);
fputs2(" jis : JIS, jisq : JIS quote only\n", stderr);
fputs2("-J <TFMfile> JIS encoded PS font TFM name for quote, double quote (with UCS mode)\n", stderr);
fputs2("-U <TFMfile> UCS encoded PS font TFM name for quote, double quote (with UCS mode)\n", stderr);
fputs2("-3 use set3 (with UCS mode)\n", stderr);
fputs2("-H use half-width katakana (with UCS mode)\n", stderr);
fputs2("-i font ID from No.0\n", stderr);
}
|