3
* - a vflibcap entry generator for TeX VF files
5
* - This program prints vflibcap entries to standard output.
7
* - Useful for generating vflibcap for TeX DVI drivers
10
* by Hirotsugu Kakugawa
15
* Copyright (C) 2001 Hirotsugu Kakugawa.
16
* All rights reserved.
18
* This program is free software; you can redistribute it and/or modify
19
* it under the terms of the GNU General Public License as published by
20
* the Free Software Foundation; either version 2, or (at your option)
23
* This program is distributed in the hope that it will be useful,
24
* but WITHOUT ANY WARRANTY; without even the implied warranty of
25
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
* GNU General Public License for more details.
28
* You should have received a copy of the GNU General Public License
29
* along with this program; if not, write to the Free Software
30
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
40
#include <sys/param.h>
43
#include "VFlib-3_6.h"
53
void gen_class_deafult(void);
56
char *mode = DEFAULT_KPS_MODE;
58
int dpi_i = DEFAULT_KPS_DPI;
62
char *vf_fontdirs[NDIRS];
66
char *map_class[NMAPS];
71
char *glyph_style = TEX_GLYPH_STYLE_FILL_STR;
72
char *open_style = TEX_OPEN_STYLE_TRY_STR;
77
main(int argc, char **argv)
84
sprintf(dpi, "%d", dpi_i);
86
cmdline = copy_cmdline(argc, argv);
89
for (i = 0; i < NDIRS; i++){
90
vf_fontdirs[i] = NULL;
94
for (i = 0; i < NMAPS; i++){
103
for (xargc--,xargv++; xargc > 0; xargc--,xargv++){
104
if ((strcmp(*xargv, "--help") == 0)
105
|| (strcmp(*xargv, "-help") == 0)){
106
printf("vflmkvf: generates vflibcap entries for TeX Virtual Fonts\n");
107
printf("Usage: vflmkvf [options]\n");
109
printf(" -d DIR : Virtual Font file directory\n");
110
printf(" -r DPI : Default device resolution\n");
111
printf(" -n MODE : Device mode name for kpathsea\n");
112
printf(" -g STYLE : Glyph style, 'fill' (default) or 'empty'\n");
113
printf(" -o STYLE : Font open style, 'try', 'require', or 'non'\n");
114
printf(" -m CLASS FORMAT : Add mapping rule\n");
115
printf("Example: vflmkvf -d TEXMF -m type1 %%f.pfb -m gf .gf -g fill\n");
118
} else if (strcmp(*xargv, "-d") == 0){
121
fprintf(stderr, "Too many Virtual Font directories\n");
126
vf_fontdirs[n_vff++] = x_strdup(*xargv);
128
} else if (strcmp(*xargv, "-r") == 0){
131
dpi = strdup(*xargv);
133
} else if (strcmp(*xargv, "-n") == 0){
137
mode = x_strdup(*xargv);
139
} else if (strcmp(*xargv, "-m") == 0){
141
fprintf(stderr, "Too many mapfont conversion rules\n");
146
if (strcmp(*xargv, "any") == 0)
147
map_class[n_map] = strdup("*");
149
map_class[n_map] = strdup(*xargv);
152
map_map[n_map] = strdup(*xargv);
155
} else if (strcmp(*xargv, "-g") == 0){
158
if ((strcmp(*xargv, TEX_GLYPH_STYLE_FILL_STR) != 0)
159
&& (strcmp(*xargv, TEX_GLYPH_STYLE_EMPTY_STR) != 0)){
160
fprintf(stderr, "Unknown glyph style name: %s\n", *xargv);
161
fprintf(stderr, "(Must be '%s' or '%s'. Default is '%s'.\n",
162
TEX_GLYPH_STYLE_FILL_STR, TEX_GLYPH_STYLE_EMPTY_STR,
166
glyph_style = strdup(*xargv);
168
} else if (strcmp(*xargv, "-o") == 0){
171
if ((strcmp(*xargv, TEX_OPEN_STYLE_TRY_STR) != 0)
172
&& (strcmp(*xargv, TEX_OPEN_STYLE_REQUIRE_STR) != 0)
173
&& (strcmp(*xargv, TEX_OPEN_STYLE_NONE_STR) != 0)){
174
fprintf(stderr, "Unknown open style name: %s\n", *xargv);
175
fprintf(stderr, "(Must be '%s', '%s' or '%s'. Default is '%s'.\n",
176
TEX_OPEN_STYLE_TRY_STR,
177
TEX_OPEN_STYLE_REQUIRE_STR,
178
TEX_OPEN_STYLE_NONE_STR,
182
open_style = strdup(*xargv);
185
if (*xargv[0] == '-'){
186
fprintf(stderr, "vflmkvf: unknown option %s\n", *xargv);
194
banner("Virtual Font", "vflmkvf", cmdline);
204
gen_class_deafult(void)
209
VF_CAPE_VFLIBCAP_CLASS_DEFAULT_DEFINITION, FONTCLASS_NAME_VF);
210
printf("\n (%s", VF_CAPE_FONT_DIRECTORIES);
211
for (i = 0; i < n_vff; i++)
212
printf("\n \"%s\"", vf_fontdirs[i]);
214
printf("\n (%s %s)", VF_CAPE_DPI, dpi);
215
printf("\n (%s \".vf\" \".ovf\")", VF_CAPE_EXTENSIONS);
216
printf("\n (%s \"%s\")", VF_CAPE_TEX_OPEN_STYLE, open_style);
217
printf("\n (%s \"%s\")", VF_CAPE_TEX_GLYPH_STYLE, glyph_style);
218
printf("\n (%s", VF_CAPE_TEX_FONT_MAPPING);
219
for (i = 0; i < n_map; i++){
220
if (map_need_tfm(map_class[i]) == 0){
221
printf("\n ((%s \"%s\") *)",
222
map_class[i], map_map[i]);
224
printf("\n ((%s \"%s\" %s) *)",
225
map_class[i], map_map[i], TEX_FONT_MAPPING_PTSIZE);