3 Copyright 1991, 1993, 1998 The Open Group
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
11 The above copyright notice and this permission notice shall be included
12 in all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 OTHER DEALINGS IN THE SOFTWARE.
22 Except as contained in this notice, the name of The Open Group shall
23 not be used in advertising or otherwise to promote the sale, use or
24 other dealings in this Software without prior written authorization
34 #include <X11/Xproto.h>
35 #include <X11/fonts/fontmisc.h>
36 #include <X11/fonts/fontstruct.h>
37 #include <X11/fonts/fntfilio.h>
38 #include <X11/fonts/fntfil.h>
39 #include <X11/fonts/bdfint.h>
40 #include <X11/fonts/pcf.h>
45 main(int argc, char *argv[])
49 FontFilePtr input, output;
51 char *input_name = NULL, *output_name = NULL;
55 int bit, byte, glyph, scan;
57 FontDefaultFormat(&bit, &byte, &glyph, &scan);
58 program_name = argv[0];
61 if (argv[0][0] == '-') {
69 if (argv[0][3] != '\0')
71 glyph = argv[0][2] - '0';
83 if (argv[0][3] != '\0')
85 scan = argv[0][2] - '0';
93 if (argv[0][2] != '\0')
99 if (argv[0][2] != '\0')
105 if (argv[0][2] != '\0')
111 if (argv[0][2] != '\0')
116 case 't': /* attempt to make terminal fonts if possible */
117 if (argv[0][2] != '\0')
121 case 'i': /* inhibit ink metric computation */
122 if (argv[0][2] != '\0')
127 output_name = argv[0] + 2;
133 output_name = argv[0];
138 printf("%s\n", PACKAGE_STRING);
149 "usage: %s [-p#] [-u#] [-m] [-l] [-M] [-L] [-t] [-i] [-o pcf file] [bdf file]\n"
150 " where # for -p is 1, 2, 4, or 8\n"
151 " and # for -s is 1, 2, or 4\n",
155 input_name = argv[0];
160 input = FontFileOpen(input_name);
162 fprintf(stderr, "%s: can't open bdf source file %s\n",
163 program_name, input_name);
168 input = FontFileOpenFd(STDIN_FILENO);
169 if (bdfReadFont(&font, input, bit, byte, glyph, scan) != Successful) {
170 fprintf(stderr, "%s: bdf input, %s, corrupt\n",
171 program_name, input_name ? input_name : "<stdin>");
175 output = FontFileOpenWrite(output_name);
177 fprintf(stderr, "%s: can't open pcf sink file %s\n",
178 program_name, output_name);
183 output = FontFileOpenWriteFd(STDOUT_FILENO);
184 if (pcfWriteFont(&font, output) != Successful) {
185 fprintf(stderr, "%s: can't write pcf file %s\n",
186 program_name, output_name ? output_name : "<stdout>");
192 FontFileClose(output);