1
/* $Xorg: bdftopcf.c,v 1.4 2001/02/09 02:05:28 xorgcvs Exp $ */
4
Copyright 1991, 1993, 1998 The Open Group
6
Permission to use, copy, modify, distribute, and sell this software and its
7
documentation for any purpose is hereby granted without fee, provided that
8
the above copyright notice appear in all copies and that both that
9
copyright notice and this permission notice appear in supporting
12
The above copyright notice and this permission notice shall be included
13
in all copies or substantial portions of the Software.
15
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
19
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21
OTHER DEALINGS IN THE SOFTWARE.
23
Except as contained in this notice, the name of The Open Group shall
24
not be used in advertising or otherwise to promote the sale, use or
25
other dealings in this Software without prior written authorization
30
/* $XFree86: xc/programs/bdftopcf/bdftopcf.c,v 1.5 2001/12/14 20:00:39 dawes Exp $ */
33
#include <X11/Xproto.h>
35
#include "fontstruct.h"
44
main (int argc, char *argv[])
47
FontFilePtr input, output;
48
char *input_name = 0, *output_name = 0;
50
int bit, byte, glyph, scan;
52
bzero(&font, sizeof(FontRec));
54
FontDefaultFormat (&bit, &byte, &glyph, &scan);
55
program_name = argv[0];
58
if (argv[0][0] == '-') {
66
if (argv[0][3] != '\0')
68
glyph = argv[0][2] - '0';
80
if (argv[0][3] != '\0')
82
scan = argv[0][2] - '0';
90
if (argv[0][2] != '\0')
96
if (argv[0][2] != '\0')
102
if (argv[0][2] != '\0')
108
if (argv[0][2] != '\0')
113
case 't': /* attempt to make terminal fonts if possible */
114
if (argv[0][2] != '\0')
118
case 'i': /* inhibit ink metric computation */
119
if (argv[0][2] != '\0')
124
output_name = argv[0] + 2;
131
output_name = argv[0];
142
"usage: %s [-p#] [-u#] [-m] [-l] [-M] [-L] [-t] [-i] [-o pcf file] [bdf file]\n",
145
" where # for -p is 1, 2, 4, or 8\n");
147
" and # for -s is 1, 2, or 4\n");
150
input_name = argv[0];
156
input = FontFileOpen (input_name);
159
fprintf (stderr, "%s: can't open bdf source file %s\n",
160
program_name, input_name);
165
input = FontFileOpenFd (0);
166
if (bdfReadFont (&font, input, bit, byte, glyph, scan) != Successful)
168
fprintf (stderr, "%s: bdf input, %s, corrupt\n",
169
program_name, input_name);
174
output = FontFileOpenWrite (output_name);
177
fprintf (stderr, "%s: can't open pcf sink file %s\n",
178
program_name, output_name);
183
output = FontFileOpenWriteFd (1);
184
if (pcfWriteFont (&font, output) != Successful)
186
fprintf (stderr, "%s: can't write pcf file %s\n",
187
program_name, output_name ? output_name : "<stdout>");
189
unlink (output_name);
193
FontFileClose (output);