file-name: Generalize fn_interp_vars().
[pspp-builds.git] / src / output / afm.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 2006 Free Software Foundation, Inc.
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation, either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
16
17 #ifndef AFM_H
18 #define AFM_H 1
19
20 #include <stddef.h>
21 #include <libpspp/str.h>
22
23 /* Metrics for a single character.  */
24 struct afm_character
25   {
26     int code;                   /* Non-negative character code, -1 if none. */
27     const char *name;           /* Character name, if any. */
28     int width;                  /* Width. */
29     int ascent;                 /* Height above baseline, never negative. */
30     int descent;                /* Depth below baseline, never negative. */
31
32     /* Pairwise kerning data for this character in the first
33        position, other characters in the second position. */
34     struct afm_kern_pair *kern_pairs;
35     size_t kern_pair_cnt;
36
37     /* Ligature data for this character in the first position,
38        other characters in the second position. */
39     struct afm_ligature *ligatures;
40     size_t ligature_cnt;
41   };
42
43 struct afm *afm_open (const char *file_name);
44 void afm_close (struct afm *);
45
46 int afm_get_ascent (const struct afm *);
47 int afm_get_descent (const struct afm *);
48 const char *afm_get_findfont_name (const struct afm *);
49
50 const struct afm_character *afm_get_character (const struct afm *,
51                                                int code);
52 const struct afm_character *afm_get_ligature (const struct afm_character *,
53                                               const struct afm_character *);
54 int afm_get_kern_adjustment (const struct afm_character *,
55                              const struct afm_character *);
56
57 size_t afm_encode_string (const struct afm *,
58                           const struct afm_character **, size_t,
59                           struct string *);
60
61 #endif /* afm.h */