2 /* Copyright (C) 1989, 1990 Free Software Foundation, Inc.
3 Written by James Clark (jjc@jclark.uucp)
5 This file is part of groff.
7 groff is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 1, or (at your option) any later
12 groff is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License along
18 with groff; see the file LICENSE. If not, write to the Free Software
19 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
23 void guess(const char *s
, const font_params
¶m
, char_metric
*metric
)
25 int &height
= metric
->height
;
26 int &depth
= metric
->depth
;
33 if (s
[0] == '\0' || (s
[1] != '\0' && s
[2] != '\0'))
35 #define HASH(c1, c2) (((unsigned char)(c1) << 8) | (unsigned char)(c2))
36 switch (HASH(s
[0], s
[1])) {
39 if (metric
->type
& 01)
40 depth
= param
.desc_depth
;
41 if (metric
->type
& 02)
42 height
= param
.asc_height
;
44 height
= param
.x_height
;
49 // these have zero height and depth
52 height
= param
.asc_height
;
54 depth
= param
.desc_depth
;
69 height
= param
.x_height
;
72 height
= param
.x_height
;
84 height
= param
.asc_height
;
87 height
= param
.asc_height
;
93 height
= param
.x_height
;
94 depth
= param
.desc_depth
;
97 height
= param
.x_height
;
98 depth
= param
.desc_depth
;
126 height
= param
.cap_height
;
152 height
= param
.cap_height
;
167 height
= param
.fig_height
;
175 height
= param
.body_height
;
176 depth
= param
.body_depth
;
179 height
= (param
.em
*3)/4;
193 height
= param
.x_height
;
197 height
= param
.asc_height
;
205 height
= param
.x_height
;
206 depth
= param
.desc_depth
;
213 height
= param
.asc_height
;
214 depth
= param
.desc_depth
;
217 height
= param
.x_height
;
218 depth
= param
.desc_depth
;
229 height
= param
.asc_height
;
233 height
= param
.asc_height
;
239 height
= param
.asc_height
;
245 depth
= param
.comma_depth
;
251 height
= param
.x_height
;
254 height
= param
.x_height
;
257 height
= param
.x_height
;
258 depth
= param
.comma_depth
;
262 height
= param
.x_height
;
272 height
= param
.asc_height
;
276 case HASH('\\', '_'):
280 height
= (param
.em
*3)/4;
283 height
= (param
.em
*3)/4;
328 height
= param
.asc_height
;
341 height
= (param
.em
*3)/4;
380 case HASH('\\', '-'):
462 case HASH('\'', 'A'):
463 case HASH('\'', 'C'):
464 case HASH('\'', 'E'):
465 case HASH('\'', 'I'):
466 case HASH('\'', 'O'):
467 case HASH('\'', 'U'):
468 case HASH('\'', 'a'):
469 case HASH('\'', 'c'):
470 case HASH('\'', 'e'):
471 case HASH('\'', 'i'):
472 case HASH('\'', 'o'):