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