10 static char *afm_charfield(char *s
, char *d
)
12 while (*s
&& !isspace(*s
) && *s
!= ';')
14 while (isspace(*s
) || *s
== ';')
20 static int uwid(int w
)
22 long div
= 72000 / mkfn_res
;
23 return (w
< 0 ? w
- div
/ 20 : w
+ div
/ 20) * (long) 10 / div
;
28 char ch
[TOKLEN
] = "", pos
[TOKLEN
] = "";
29 char c1
[TOKLEN
] = "", c2
[TOKLEN
] = "";
30 char wid
[TOKLEN
] = "", field
[TOKLEN
] = "";
31 char llx
[TOKLEN
] = "0", lly
[TOKLEN
] = "0";
32 char urx
[TOKLEN
] = "0", ury
[TOKLEN
] = "0";
35 while (fgets(ln
, sizeof(ln
), stdin
)) {
38 if (!strncmp("FontName ", ln
, 8)) {
39 sscanf(ln
, "FontName %s", fontname
);
42 if (!strncmp("StartCharMetrics", ln
, 16))
45 while (fgets(ln
, sizeof(ln
), stdin
)) {
48 if (!strncmp("EndCharMetrics", ln
, 14))
52 s
= afm_charfield(s
, field
);
53 if (!strcmp("C", field
)) {
54 s
= afm_charfield(s
, pos
);
57 if (!strcmp("WX", field
)) {
58 s
= afm_charfield(s
, wid
);
61 if (!strcmp("N", field
)) {
62 s
= afm_charfield(s
, ch
);
65 if (!strcmp("B", field
)) {
66 s
= afm_charfield(s
, llx
);
67 s
= afm_charfield(s
, lly
);
68 s
= afm_charfield(s
, urx
);
69 s
= afm_charfield(s
, ury
);
72 if (!strcmp("L", field
)) {
73 s
= afm_charfield(s
, c1
);
74 s
= afm_charfield(s
, c2
);
79 if (ch
[0] && pos
[0] && wid
[0])
80 mkfn_char(ch
, atoi(pos
), 0, uwid(atoi(wid
)),
81 uwid(atoi(llx
)), uwid(atoi(lly
)),
82 uwid(atoi(urx
)), uwid(atoi(ury
)));
84 mkfn_header(fontname
);
85 while (fgets(ln
, sizeof(ln
), stdin
)) {
88 if (!strncmp("StartKernPairs", ln
, 14))
91 while (fgets(ln
, sizeof(ln
), stdin
)) {
94 if (!strncmp("EndKernPairs", ln
, 12))
96 if (sscanf(ln
, "KPX %s %s %s", c1
, c2
, wid
) == 3)
97 mkfn_kern(c1
, c2
, uwid(atoi(wid
)));