2 * Copyright (c) 2014 - 2015 Steffen (Daode) Nurpmeso <sdaoden@users.sf.net>.
4 * Copyright (C) 1989 - 1992 Free Software Foundation, Inc.
5 * Written by James Clark (jjc@jclark.com)
7 * This 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 2, or (at your option) any later
12 * This 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 COPYING. If not, write to the Free Software
19 * Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
23 #include "addftinfo-config.h"
27 void guess(const char *s
, const font_params
¶m
, char_metric
*metric
)
29 int &height
= metric
->height
;
30 int &depth
= metric
->depth
;
37 if (s
[0] == '\0' || (s
[1] != '\0' && s
[2] != '\0'))
39 #define HASH(c1, c2) (((unsigned char)(c1) << 8) | (unsigned char)(c2))
40 switch (HASH(s
[0], s
[1])) {
43 if (metric
->type
& 01)
44 depth
= param
.desc_depth
;
45 if (metric
->type
& 02)
46 height
= param
.asc_height
;
48 height
= param
.x_height
;
53 // these have zero height and depth
56 height
= param
.asc_height
;
58 depth
= param
.desc_depth
;
73 height
= param
.x_height
;
76 height
= param
.x_height
;
88 height
= param
.asc_height
;
91 height
= param
.asc_height
;
97 height
= param
.x_height
;
98 depth
= param
.desc_depth
;
101 height
= param
.x_height
;
102 depth
= param
.desc_depth
;
130 height
= param
.cap_height
;
156 height
= param
.cap_height
;
171 height
= param
.fig_height
;
179 height
= param
.body_height
;
180 depth
= param
.body_depth
;
183 height
= (param
.em
*3)/4;
197 height
= param
.x_height
;
201 height
= param
.asc_height
;
209 height
= param
.x_height
;
210 depth
= param
.desc_depth
;
217 height
= param
.asc_height
;
218 depth
= param
.desc_depth
;
221 height
= param
.x_height
;
222 depth
= param
.desc_depth
;
233 height
= param
.asc_height
;
237 height
= param
.asc_height
;
243 height
= param
.asc_height
;
249 depth
= param
.comma_depth
;
255 height
= param
.x_height
;
258 height
= param
.x_height
;
261 height
= param
.x_height
;
262 depth
= param
.comma_depth
;
266 height
= param
.x_height
;
276 height
= param
.asc_height
;
280 case HASH('\\', '_'):
284 height
= (param
.em
*3)/4;
287 height
= (param
.em
*3)/4;
332 height
= param
.asc_height
;
345 height
= (param
.em
*3)/4;
384 case HASH('\\', '-'):
466 case HASH('\'', 'A'):
467 case HASH('\'', 'C'):
468 case HASH('\'', 'E'):
469 case HASH('\'', 'I'):
470 case HASH('\'', 'O'):
471 case HASH('\'', 'U'):
472 case HASH('\'', 'a'):
473 case HASH('\'', 'c'):
474 case HASH('\'', 'e'):
475 case HASH('\'', 'i'):
476 case HASH('\'', 'o'):