4 /* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
5 Written by James Clark (jjc@jclark.com)
7 This file is part of groff.
9 groff is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free
11 Software Foundation; either version 2, or (at your option) any later
14 groff is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 You should have received a copy of the GNU General Public License along
20 with groff; see the file COPYING. If not, write to the Free Software
21 Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */
25 void guess(const char *s
, const font_params
¶m
, char_metric
*metric
)
27 int &height
= metric
->height
;
28 int &depth
= metric
->depth
;
35 if (s
[0] == '\0' || (s
[1] != '\0' && s
[2] != '\0'))
37 #define HASH(c1, c2) (((unsigned char)(c1) << 8) | (unsigned char)(c2))
38 switch (HASH(s
[0], s
[1])) {
41 if (metric
->type
& 01)
42 depth
= param
.desc_depth
;
43 if (metric
->type
& 02)
44 height
= param
.asc_height
;
46 height
= param
.x_height
;
51 // these have zero height and depth
54 height
= param
.asc_height
;
56 depth
= param
.desc_depth
;
71 height
= param
.x_height
;
74 height
= param
.x_height
;
86 height
= param
.asc_height
;
89 height
= param
.asc_height
;
95 height
= param
.x_height
;
96 depth
= param
.desc_depth
;
99 height
= param
.x_height
;
100 depth
= param
.desc_depth
;
128 height
= param
.cap_height
;
154 height
= param
.cap_height
;
169 height
= param
.fig_height
;
177 height
= param
.body_height
;
178 depth
= param
.body_depth
;
181 height
= (param
.em
*3)/4;
195 height
= param
.x_height
;
199 height
= param
.asc_height
;
207 height
= param
.x_height
;
208 depth
= param
.desc_depth
;
215 height
= param
.asc_height
;
216 depth
= param
.desc_depth
;
219 height
= param
.x_height
;
220 depth
= param
.desc_depth
;
231 height
= param
.asc_height
;
235 height
= param
.asc_height
;
241 height
= param
.asc_height
;
247 depth
= param
.comma_depth
;
253 height
= param
.x_height
;
256 height
= param
.x_height
;
259 height
= param
.x_height
;
260 depth
= param
.comma_depth
;
264 height
= param
.x_height
;
274 height
= param
.asc_height
;
278 case HASH('\\', '_'):
282 height
= (param
.em
*3)/4;
285 height
= (param
.em
*3)/4;
330 height
= param
.asc_height
;
343 height
= (param
.em
*3)/4;
382 case HASH('\\', '-'):
464 case HASH('\'', 'A'):
465 case HASH('\'', 'C'):
466 case HASH('\'', 'E'):
467 case HASH('\'', 'I'):
468 case HASH('\'', 'O'):
469 case HASH('\'', 'U'):
470 case HASH('\'', 'a'):
471 case HASH('\'', 'c'):
472 case HASH('\'', 'e'):
473 case HASH('\'', 'i'):
474 case HASH('\'', 'o'):