10 char *printdesclang = 0;
15 struct charent spechars[MAXSPECHARS];
18 static char *desctoks[NDESCTOKS] = {
30 char *spechar[MAXSPECHARS];
33 hash(char *s, int l) {
43 char token[MAXTOKENSIZE];
44 char *descnameformat = "%s/dev%s/DESC";
45 char *descfilename = 0;
51 if (debug) Bprint(Bstderr, "readDESC()\n");
52 descfilename = galloc(descfilename, strlen(descnameformat)+strlen(FONTDIR)
53 +strlen(devname), "readdesc");
54 sprint(descfilename, descnameformat, FONTDIR, devname);
55 if ((bfd = Bopen(unsharp(descfilename), OREAD)) == 0) {
56 error(WARNING, "cannot open file %s\n", descfilename);
59 Bfd = bfd; /* &(bfd->Biobufhdr); */
61 while (Bgetfield(Bfd, 's', token, MAXTOKENSIZE) > 0) {
62 for (i=0; i<NDESCTOKS; i++) {
63 if (strcmp(desctoks[i], token) == 0) {
68 if (i<NDESCTOKS) continue;
71 printdesclang=galloc(printdesclang, strlen(token)+1, "readdesc:");
72 strcpy(printdesclang, token);
73 if (debug) Bprint(Bstderr, "PDL %s\n", token);
76 encoding=galloc(encoding, strlen(token)+1, "readdesc:");
77 strcpy(encoding, token);
78 if (debug) Bprint(Bstderr, "encoding %s\n", token);
82 if (!isdigit(*token)) {
83 error(WARNING, "readdesc: expecting number of fonts in mount table.\n");
86 fontmnt = atoi(token) + 1;
87 fontmtab = galloc(fontmtab, fontmnt*sizeof(char *), "readdesc:");
89 for (i=0; i<fontmnt; i++)
93 mountfont(++fontindex, token);
98 /* I don't really care about sizes */
101 /* device resolution in dots per inch */
102 if (!isdigit(*token)) {
103 error(WARNING, "readdesc: expecting device resolution.\n");
106 devres = atoi(token);
107 if (debug) Bprint(Bstderr, "res %d\n", devres);
110 /* I don't really care about horizontal motion resolution */
111 if (debug) Bprint(Bstderr, "ignoring horizontal resolution\n");
114 /* I don't really care about vertical motion resolution */
115 if (debug) Bprint(Bstderr, "ignoring vertical resolution\n");
118 /* unitwidth is the font size at which the character widths are 1:1 */
119 if (!isdigit(*token)) {
120 error(WARNING, "readdesc: expecting unitwidth.\n");
123 unitwidth = atoi(token);
124 if (debug) Bprint(Bstderr, "unitwidth %d\n", unitwidth);
127 /* I don't really care about this list of special characters */
128 if (debug) Bprint(Bstderr, "ignoring special character <%s>\n", token);
134 error(WARNING, "unknown token %s in DESC file.\n", token);