3 Copyright 2000, 2015 Akira Kakuto.
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this library; if not, see <http://www.gnu.org/licenses/>.
18 %%----------------------------------------
19 % Special variables for mktexpk ( W32TeX )
20 % ----------------------------------------
21 % MAKETEXPK_STYLE = dosnames
22 % -----------------------------------------
23 % MAKETEXPK_TOP_DIR = $VARTEXFONTS
24 % -----------------------------------------
25 % MAKETEXPK_MODE = canonex
26 % -----------------------------------------
27 % MAKETEXPK_MODE_300 = cx
28 % MAKETEXPK_MODE_400 = nexthi
29 % MAKETEXPK_MODE_600 = canonex
31 %%-----------------------------------------
33 Usage: mktexpk [OPTIONS] name,
36 --dpi DPI use resolution DPI.
37 --bdpi BDPI use base resolution BDPI.
38 --mag MAG use magnificiation MAG.
39 --mfmode MODE use MODE as the METAFONT mode.
40 --destdir DESTDIR write fonts in DESTDIR (absolute path).
42 The following old form is also supported:
43 Usage: mktexmk name dpi bdpi mag [mode]
46 #include <kpathsea/kpathsea.h>
48 #include <web2c/w2c/c-auto.h>
62 int UseAspectRatio
= 0;
64 double AspectRatio
= 1.0;
71 ffgets(char *buf
, int size
, FILE *fi
)
92 else if(c
== 0x0d || c
== 0x0a) {
103 else if(n
== (size
- 3)) {
114 if((c
== ' ') || (c
== '\t'))
116 else if((c
== '<') || (c
== '[')) {
134 fprintf (stderr
, "%s, (C version 1.5 --ak 2006-2012)\n", progname
);
135 fprintf (stderr
, KPSEVERSION WEB2CVERSION
"\n");
141 fprintf (stderr
, "Usage: %s [OPTIONS] NAME,\n\
142 Create a PK font.\n\n\
143 --dpi DPI use resolution DPI.\n\
144 --bdpi BDPI use base resolution BDPI.\n\
145 --mag MAG use magnificiation MAG.\n\
146 --mfmode MODE use MODE as the METAFONT mode.\n\
147 --destdir DESTDIR write fonts in DESTDIR.\n", progname
);
153 fprintf (stderr
, "Usage: %s [OPTIONS] NAME,\n\
154 Create a PK font.\n\n\
155 --dpi DPI use resolution DPI.\n\
156 --bdpi BDPI use base resolution BDPI.\n\
157 --mag MAG use magnificiation MAG.\n\
158 --mfmode MODE use MODE as the METAFONT mode.\n\
159 --destdir DESTDIR write fonts in DESTDIR.\n\n\
160 Try to create a PK file for NAME at resolution DPI, with an assumed\n\
161 device base resolution of BDPI, and a Metafont `mag' of MAG. Use MODE\n\
162 for the METAFONT mode. Use DESTDIR for the root of where to install\n\
163 into. DESTDIR must be an absolute directory name. If DESTDIR is not given,\n\
164 suitable directory is determined according to the TDS.\n\n\
166 Usage: %s name dpi bdpi mag [mode]\n\
167 is also supported.", progname
, progname
);
172 tpkerr (const char *s
)
174 fprintf (stderr
, "%s\n", s
);
182 for (j
= 0; j
< 4; j
++)
188 get_designsize(char *tfname
, char *dsiz
)
191 unsigned char a
, b
, c
, d
;
196 strcpy(dsiz
, "10.0"); /* default */
198 p
= kpse_find_file (tfname
, kpse_tfm_format
, 0);
203 fseek(f
, 28, SEEK_SET
);
209 n
= (a
<< 24) + (b
<< 16) + (c
<< 8) + d
;
211 sprintf(dsiz
, "%.1lf", x
);
217 main (int ac
, char **av
)
219 static char execfile
[SBUF
];
243 FILE *fr
, *fw
, *fnul
, *tfmfileptr
;
245 int i
, savo
, savi
, ret
;
256 char texname
[TBUF
], pfbname
[TBUF
], slant
[TBUF
], extend
[TBUF
], encname
[TBUF
];
262 * style = 0 : MAKETEXPK_STYLE undefined or other than dosnames
263 * style = 1 : MAKETEXPK_STYLE = dosnames
267 * issetdest = 0 : no destdir
268 * issetdest = 1 : destdir
269 * issetdest = 2 : current working dir
281 * oldform = 0 : newform of the command line
282 * oldform = 1 : oldform of the command line
286 * TEMP | TMP | TMPDIR (necessary)
290 tmp
= getenv ("TEMP");
292 tmp
= getenv ("TMP");
294 tmp
= getenv ("TMPDIR");
296 tpkerr ("Please define TEMP | TMP | TMPDIR.");
302 * normalize directory separators
306 for (i
= 0; i
< 4; i
++)
307 arg
[i
] = (char *) malloc (SBUF
);
309 kpse_set_program_name (av
[0], NULL
);
310 progname
= kpse_program_name
;
316 p
= kpse_var_value("SELFAUTOLOC");
318 fprintf(stderr
, "I cannot get SELFAUTOLOC\n");
321 strcpy(texbindir
, p
);
323 for(p
=texbindir
; *p
; p
++) {
324 if(*p
== '/') *p
= '\\';
340 * oldform or newform ?
351 * Old form of the command line
361 if((strlen(av
[1]) > TBUF
-1 ) ||
362 (strlen(av
[2]) > TBUF
-1 ) ||
363 (strlen(av
[3]) > TBUF
-1 ) ||
364 (strlen(av
[4]) > TBUF
-1 )) {
365 fprintf(stderr
, "\nToo long a string.\n");
370 strcpy (name
, av
[1]);
372 strcpy (bdpi
, av
[3]);
375 if(strlen(av
[5]) > TBUF
-1) {
376 fprintf(stderr
, "\nToo long a string.\n");
380 strcpy (mode
, av
[5]);
386 * New form of the command line
388 name
[0] = dpi
[0] = bdpi
[0] = mag
[0] = mode
[0] = destdir
[0] = '\0';
391 if(strlen(av
[i
]) > TBUF
- 1) {
392 fprintf(stderr
, "\nToo long a string.\n");
396 if (av
[i
][0] != '-') {
397 strcpy (name
, av
[i
]);
400 if (!strcmp (av
[i
], "--dpi") || !strcmp (av
[i
], "-dpi")) {
403 tpkerr ("Invalid arguments.");
410 } else if (!strcmp (av
[i
], "--bdpi") || !strcmp (av
[i
], "-bdpi")) {
413 tpkerr ("Invalid arguments.");
418 strcpy (bdpi
, av
[i
]);
420 } else if (!strcmp (av
[i
], "--mag") || !strcmp (av
[i
], "-mag")) {
423 tpkerr ("Invalid arguments.");
430 } else if (!strcmp (av
[i
], "--mfmode") || !strcmp (av
[i
], "-mfmode")) {
433 tpkerr ("Invalid arguments.");
438 strcpy (mode
, av
[i
]);
440 } else if (!strcmp (av
[i
], "--destdir") || !strcmp (av
[i
], "-destdir")) {
443 tpkerr ("Invalid arguments.");
448 strcpy (destdir
, av
[i
]);
451 } else if (!strcmp (av
[i
], "--version") || !strcmp (av
[i
], "-version")) {
456 } else if (!strcmp (av
[i
], "--help") || !strcmp (av
[i
], "-help")) {
462 tpkerr ("Argument error.");
468 } /* End of command line analysis */
470 env
= kpse_var_value ("MAKETEXPK_STYLE");
472 if ((env
== NULL
) || !(*env
) || (env
&& strcmp (env
, "dosnames"))) {
478 * Default program is mf
484 * check if mfmode and bdpi are consistent or not
487 if (bdpi
[0] && mode
[0] && mode
[0] != '/') {
492 strcpy (fullbin
, texbindir
);
493 strcat (fullbin
, "mf-nowin.exe \"\\mode:=");
494 strcat (fullbin
, mode
);
495 strcat (fullbin
, ";mode_setup;message");
496 strcat (fullbin
, "(decimal round pixels_per_inch);");
497 strcat (fullbin
, "end. <nul\"");
499 frd
= popen (fullbin
, "r");
501 tpkerr ("I cannot find METAFONT.\n");
506 (void) fgets (buff
, 126, frd
);
507 (void) fgets (buff
, 126, frd
);
509 system("del /Q mfput.*");
511 len
= (int)strlen (buff
);
512 if (buff
[len
- 1] == '\n') {
513 buff
[len
- 1] = '\0';
514 if (buff
[len
- 2] == '\r')
515 buff
[len
- 2] = '\0';
517 if (strcmp (bdpi
, buff
)) {
518 fprintf(stderr
, "mode_dpi %s and bdpi %s are inconsistent.\n", buff
, bdpi
);
519 fprintf(stderr
, "therefore I reset mfmode.\n");
525 * determine mfmode if not given
528 if (mode
[0] == 0 || mode
[0] == '/') {
530 tpkerr ("Cannot determine the mode.");
531 tpkerr ("I will try other possibilities.");
534 strcpy (rbuff
, "MAKETEXPK_MODE_");
535 strcat (rbuff
, bdpi
);
536 if ((env
= kpse_var_value ("MAKETEXPK_MODE")) && *env
)
538 else if ((env
= kpse_var_value (rbuff
)))
540 else if (!strcmp (bdpi
, "85"))
541 strcpy (mode
, "sun");
542 else if (!strcmp (bdpi
, "100"))
543 strcpy (mode
, "nextscrn");
544 else if (!strcmp (bdpi
, "118"))
545 strcpy (mode
, "pcprevw");
546 else if (!strcmp (bdpi
, "160"))
547 strcpy (mode
, "nectzo");
548 else if (!strcmp (bdpi
, "180"))
549 strcpy (mode
, "toshiba");
550 else if (!strcmp (bdpi
, "200"))
551 strcpy (mode
, "highfax");
552 else if (!strcmp (bdpi
, "240"))
553 strcpy (mode
, "canonlbp");
554 else if (!strcmp (bdpi
, "300"))
556 else if (!strcmp (bdpi
, "320"))
557 strcpy (mode
, "neclm");
558 else if (!strcmp (bdpi
, "360"))
559 strcpy (mode
, "epstylus");
560 else if (!strcmp (bdpi
, "400"))
561 strcpy (mode
, "nexthi");
562 else if (!strcmp (bdpi
, "600"))
563 strcpy (mode
, "ljfour");
564 else if (!strcmp (bdpi
, "720"))
565 strcpy (mode
, "epscszz");
566 else if (!strcmp (bdpi
, "800"))
567 strcpy (mode
, "lwpro");
568 else if (!strcmp (bdpi
, "1000"))
569 strcpy (mode
, "lmaster");
570 else if (!strcmp (bdpi
, "1200"))
571 strcpy (mode
, "ultre");
572 else if (!strcmp (bdpi
, "1270"))
573 strcpy (mode
, "linoone");
574 else if (!strcmp (bdpi
, "1800"))
575 strcpy (mode
, "vtftzz");
576 else if (!strcmp (bdpi
, "2400"))
577 strcpy (mode
, "supre");
578 else if (!strcmp (bdpi
, "2540"))
579 strcpy (mode
, "linotzzh");
580 else if (!strcmp (bdpi
, "3386"))
581 strcpy (mode
, "linolttz");
582 else if (!strcmp (bdpi
, "8000"))
583 strcpy (mode
, "dpdfezzz");
584 else if (!strcmp (bdpi
, "9600"))
585 strcpy (mode
, "ibx");
587 tpkerr ("Cannot determine the mode.");
588 tpkerr ("I will try other possibilities.");
597 tpkerr ("Font name is not given.");
603 if ((p
= strrchr (name
, '.')))
606 strcpy (mfname
, name
);
607 strcat (mfname
, ".mf");
610 if (!(p
= kpse_var_value ("MFINPUTS"))) {
611 tpkerr ("Cannot get value of MFINPUTS.");
617 xputenv("MKTEXMF", "1");
618 if (!(p
= kpse_find_file (mfname
, kpse_mf_format
, 1))) {
619 fprintf (stderr
, "Cannot find %s .\n", mfname
);
620 tpkerr ("I try ps2pk --> gsftopk --> ttf2pk --> hbf2gf.");
626 strcpy (mode
, "modeless");
627 strcpy (tfname
, name
);
628 strcat (tfname
, ".tfm");
629 if (!(p
= kpse_var_value ("TFMFONTS"))) {
630 tpkerr ("Cannot get value of TFMFONTS.");
637 I don't try to create nonexisting tfm here.
639 if (!(p
= kpse_find_file (tfname
, kpse_tfm_format
, 0))) {
640 fprintf (stderr
, "Cannot find %s .\n", tfname
);
645 tfmfileptr
= fopen (p
, "rb");
647 fprintf (stderr
, "I cannot open %s.\n", p
);
652 i
= 256 * getc (tfmfileptr
);
653 i
+= getc (tfmfileptr
);
655 if ((i
== 9) || (i
== 11)) {
656 fprintf (stderr
, "Current font seems to be a Japanese one.\n");
657 fprintf (stderr
, "I give up to create a PK font.\n");
664 if ((p
[0] == '.') && (p
[1] == '/') && (issetdest
!= 1))
667 fpp
= _getcwd (currdir
, SBUF
);
669 fprintf (stderr
, "Failed to get current working directory.\n");
676 i
= (int)strlen (currdir
);
677 if (currdir
[i
- 1] == '/')
678 currdir
[i
- 1] = '\0';
680 strcpy (kpsedot
, "KPSE_DOT=.;");
681 strcat (kpsedot
, currdir
);
684 if (issetdest
== 2) {
685 strcpy (destdir
, currdir
);
688 if (issetdest
== 0) {
689 strcpy (arg
[0], "Dummy");
690 strcpy (arg
[1], "pk");
692 strcpy (arg
[3], mode
);
694 if (!(p
= getdestdir (4, arg
))) {
695 tpkerr ("Cannot get destination directory name.");
702 strcpy (rbuff
, destdir
);
705 * Change backslash into slash
716 fprintf (stderr
, "Destination %s is not found.\n", p
);
721 } else if (!is_dir (p
)) {
723 tpkerr ("Error in make_dir.");
739 tpkerr ("Cannot determine DPI.");
745 if (style
== 1 && issetdest
!= 2) { /* dosnames */
750 tpkerr ("Error in make_dir.");
762 if (style
!= 1 || issetdest
== 2)
763 strcat (p
, dpi
); /* long suffix */
766 /* Now buff and p is the full path name of pk file */
767 /* check the existence of pk file */
769 if (_access (p
, 0) == 0) {
770 fprintf (stderr
, "%s exists.\n", p
);
778 * Go to the temporary directory
781 cdrive
= _getdrive ();
783 tdrive
= tolower (*tmp
) - 'a' + 1;
789 * save stdout and stdin
791 savo
= _dup (fileno (stdout
));
792 savi
= _dup (fileno (stdin
));
795 * connect stdout to stderr
797 _dup2 (fileno (stderr
), fileno (stdout
));
800 * connect stdin to nul
802 if (!(fnul
= fopen ("nul", "rb"))) {
803 fprintf (stderr
, "Cannot open nul device to read.\n");
810 _dup2 (fileno (fnul
), fileno (stdin
));
813 * pkname is the filename of PK font
815 sprintf (pkname
, "%s.%spk", name
, dpi
);
819 * METAFONT command line
822 tpkerr ("Cannot determine MAG.");
830 "--progname=mf --base=mf \\mode:=%s; \\mag:=%s; nonstopmode; input %s;",
833 strcpy (execfile
, "mf-nowin.exe");
834 fprintf (stderr
, "%s %s\n", execfile
, cmd
);
835 strcpy(fullbin
, texbindir
);
836 strcat(fullbin
, execfile
);
837 (void) _spawnlp (_P_WAIT
, fullbin
, execfile
, cmd
, NULL
);
839 sprintf (cmd
, "%s.%sgf", name
, dpi
);
842 * check the consistency
844 if (_access (cmd
, 0) != 0) {
845 tpkerr ("Failed to make gf font by METAFONT.");
856 strcpy (execfile
, "gftopk.exe");
857 fprintf (stderr
, "%s %s %s\n", execfile
, cmd
, pkname
);
858 strcpy(fullbin
, texbindir
);
859 strcat(fullbin
, execfile
);
860 (void) _spawnlp (_P_WAIT
, fullbin
, execfile
, cmd
, pkname
, NULL
);
862 if (_access (pkname
, 0) != 0) {
863 tpkerr ("Failed to make pk from gf.");
879 sprintf (cmd
, "%s.log", name
);
884 sprintf (cmd
, "%s.tfm", name
);
891 * app = 1 : ps2pk --> gsftopk --> ttf2pk --> hbf2gf
894 p
= kpse_find_file ("pspksupp.map", kpse_fontmap_format
, 0);
896 fr
= fopen (p
, "r"); /* Read pspksupp.map */
900 tpkerr ("Cannot open pspksupp.map to read.");
905 while (fgets (rbuff
, SBUF
, fr
)) {
906 if (rbuff
[0] == '%' || rbuff
[0] == '#' || rbuff
[0] == '\n')
908 texname
[0] = pfbname
[0] = slant
[0] = extend
[0] = encname
[0] = '\0';
909 i
= sscanf (rbuff
, "%s %s %s %s %s", texname
, pfbname
, slant
, extend
,
911 if (i
== 2 && !strncmp (texname
, "AspectRatio", 11)) {
912 if (!sscanf (pfbname
, "%lf", &AspectRatio
)) {
913 tpkerr ("File format of pspksupp.map is wrong.");
920 } else if (i
> 0 && !stricmp (texname
, name
)) {
921 p
= kpse_var_value ("T1FONTS");
923 tpkerr ("T1FONTS is not defined.");
928 p
= kpse_find_file (pfbname
, kpse_type1_format
, 0);
930 fprintf (stderr
, "%s is not found.\n", pfbname
);
948 char pscommand
[SBUF
];
949 double slantval
, extendval
;
951 texname
[0] = pfbname
[0] = encname
[0] = '\0';
952 a
[0] = b
[0] = psname
[0] = pscommand
[0] = '\0';
959 p
= kpse_find_file ("ps2pk.map", kpse_fontmap_format
, 0);
961 tpkerr("Necessary map file for ps2pk is not found.");
967 tpkerr ("Cannot open ps2pk.map to read.");
970 while ((ret
=ffgets (rbuff
, LBUF
, fr
)) != FFILE_END
) {
971 if(ret
== BBUFF_FUL
) {
972 fprintf(stderr
, "A line in ps2pk.map seems to be too long.\n");
973 fprintf(stderr
, "I try to continue. But something may be wrong.\n");
977 if((*p
== '%') || (*p
== '#') || (*p
== '\n'))
980 while(!isskip(*p
) && (*p
!= '\n'))
983 if(stricmp(texname
, name
))
986 if((*p
== '%') || (*p
== '#') || (*p
== '\n')) {
987 fprintf(stderr
, "Incorrect line in \"ps2pk.map\".\n");
994 while(!isskip(*p
) && (*p
!= '\n'))
1006 if((*p
== '%') || (*p
== '#') || (*p
== '\n')) {
1007 tpkerr("I cannot use ps2pk due to lack of data.");
1018 if((*p
== '%') || (*p
== '#') || (*p
== '\n'))
1021 if(FileName
&& a
[0] == '\0')
1023 else if(FileName
&& b
[0] == '\0')
1026 tpkerr("Incorrect line in ps2pk.map.");
1029 while(!isskip(*p
) && (*p
!= '\n'))
1033 if((*p
== '%') || (*p
== '#') || (*p
== '\n'))
1043 if((*p
== '%') || (*p
== '#') || (*p
== '\n'))
1046 if (FileName
&& a
[0] == '\0')
1048 else if (FileName
&& b
[0] == '\0')
1051 fprintf(stderr
, "Incorrect line in \"ps2pk.map\".\n");
1054 while(!isskip(*p
) && (*p
!= '\n'))
1058 if((*p
== '%') || (*p
== '#') || (*p
== '\n'))
1068 if((*p
== '%') || (*p
== '#') || (*p
== '\n'))
1072 if((*p
== '%') || (*p
== '#') || (*p
== '\n'))
1075 fprintf(stderr
, "Incorrect line in \"ps2pk.map\".\n");
1082 p
= strstr(pscommand
, "SlantFont");
1085 while(*p
== ' ' || *p
== '\t') p
--;
1086 while(*p
!= ' ' && *p
!= '\t' && *p
!= '\"') p
--;
1088 sscanf(p
, "%lf SlantFont", &slantval
);
1089 sprintf(slant
, "%lf", slantval
);
1090 p
= slant
+ strlen(slant
) - 1;
1096 p
= strstr(pscommand
, "ExtendFont");
1099 while(*p
== ' ' || *p
== '\t') p
--;
1100 while(*p
!= ' ' && *p
!= '\t' && *p
!= '\"') p
--;
1102 sscanf(p
, "%lf ExtendFont", &extendval
);
1103 sprintf(extend
, "%lf", extendval
);
1104 p
= extend
+ strlen(extend
) - 1;
1112 p
= strrchr(a
, '.');
1113 if(p
&& !stricmp(p
, ".enc")) {
1117 else if(p
&& !stricmp(p
, ".pfb")) {
1123 p
= strrchr(b
, '.');
1124 if(p
&& !stricmp(p
, ".enc")) {
1128 else if(p
&& !stricmp(p
, ".pfb")) {
1133 if(pfbname
[0] == '\0')
1135 p
= kpse_find_file (pfbname
, kpse_type1_format
, 0);
1140 if(encname
[0] && bdpi
[0]) {
1142 } else if(!encname
[0] && !bdpi
[0]) {
1152 if (UseAspectRatio
) {
1153 sscanf (dpi
, "%lf", &Xdpi
);
1154 Ydpi
= Xdpi
* AspectRatio
;
1155 sprintf (ydpi
, "%d", (int) Ydpi
);
1159 strcpy(tfname
, name
);
1160 strcat(tfname
, ".tfm");
1161 get_designsize(tfname
, designsize
);
1164 sprintf (cmd
, "-X%s -Y%s -S%s -E%s -P%s %s %s",
1165 dpi
, ydpi
, slant
, extend
, designsize
, pfbname
, pkname
);
1166 } else if (i
== 4 && bdpi
[0]) {
1167 sprintf (cmd
, "-X%s -Y%s -R%s -S%s -E%s -P%s %s %s",
1168 dpi
, ydpi
, bdpi
, slant
, extend
, designsize
, pfbname
, pkname
);
1169 } else if (i
== 4 && encname
[0]) {
1170 sprintf (cmd
, "-e%s -X%s -Y%s -S%s -E%s -P%s %s %s",
1171 encname
, dpi
, ydpi
, slant
, extend
, designsize
, pfbname
, pkname
);
1172 } else if (i
== 5) {
1173 sprintf (cmd
, "-e%s -X%s -Y%s -R%s -S%s -E%s -P%s %s %s",
1174 encname
, dpi
, ydpi
, bdpi
, slant
, extend
, designsize
, pfbname
, pkname
);
1176 tpkerr ("File format of pspksupp.map is wrong.");
1180 strcpy (execfile
, "ps2pk.exe");
1181 fprintf (stderr
, "%s %s\n", execfile
, cmd
);
1182 strcpy(fullbin
, texbindir
);
1183 strcat(fullbin
, execfile
);
1184 (void) _spawnlp (_P_WAIT
, fullbin
, execfile
, cmd
, NULL
);
1186 if (_access (pkname
, 0) != 0) {
1187 tpkerr ("ps2pk failed to make pk font.");
1194 * ps2pk is impossible to use
1199 tpkerr ("ps2pk cannot be used.");
1200 tpkerr ("I try gsftopk.");
1203 strcpy (execfile
, "gsftopk.exe");
1204 fprintf (stderr
, "%s %s %s\n", execfile
, name
, dpi
);
1205 strcpy(fullbin
, texbindir
);
1206 strcat(fullbin
, execfile
);
1207 (void) _spawnlp (_P_WAIT
, fullbin
, execfile
, name
, dpi
, NULL
);
1209 if (_access (pkname
, 0) != 0) {
1210 tpkerr ("gsftopk cannot be used.");
1211 tpkerr ("Next I try ttf2pk.");
1213 strcpy (execfile
, "ttf2pk.exe");
1214 fprintf (stderr
, "%s -q %s %s\n", execfile
, name
, dpi
);
1215 strcpy(fullbin
, texbindir
);
1216 strcat(fullbin
, execfile
);
1217 (void) _spawnlp (_P_WAIT
, fullbin
, execfile
, "-q", name
, dpi
, NULL
);
1219 if (_access (pkname
, 0) != 0) {
1220 tpkerr ("ttf2pk failed.");
1221 tpkerr ("Finally I try hbf2gf.");
1223 strcpy (execfile
, "hbf2gf.exe");
1224 fprintf (stderr
, "%s -q -p %s %s\n", execfile
, name
, dpi
);
1225 strcpy(fullbin
, texbindir
);
1226 strcat(fullbin
, execfile
);
1227 (void) _spawnlp (_P_WAIT
, fullbin
, execfile
, "-q -p", name
, dpi
, NULL
);
1229 sprintf (cmd
, "%s.%sgf", name
, dpi
);
1230 if (_access (cmd
, 0) != 0) {
1231 tpkerr ("All trials failed.");
1238 strcpy (execfile
, "gftopk.exe");
1239 fprintf (stderr
, "%s %s %s\n", execfile
, cmd
, pkname
);
1240 strcpy(fullbin
, texbindir
);
1241 strcat(fullbin
, execfile
);
1242 (void) _spawnlp (_P_WAIT
, fullbin
, execfile
, cmd
, pkname
, NULL
);
1244 if (_access (pkname
, 0) != 0) {
1245 tpkerr ("All trials failed.");
1259 * return to original stdout and stdin
1261 _dup2 (savo
, fileno (stdout
));
1263 _dup2 (savi
, fileno (stdin
));
1274 if (!(fr
= fopen (pkname
, "rb"))) {
1275 fprintf (stderr
, "Cannot open %s to read.\n", pkname
);
1283 if (!(fw
= fopen (buff
, "wb"))) {
1284 fprintf (stderr
, "Cannot open %s to write.\n", buff
);
1292 while ((i
= (int)fread (rbuff
, 1, LBUF
, fr
)))
1293 fwrite (rbuff
, 1, i
, fw
);
1302 * update ls-R if it exists
1310 printf ("%s\n", buff
);