1 /* PSPP - computes sample statistics.
2 Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
3 Written by Ben Pfaff <blp@gnu.org>.
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.
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.
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., 59 Temple Place - Suite 330, Boston, MA
23 /* Possible ligatures. */
30 /* Character type constants. */
31 #define CTYP_NONE 000 /* Neither ascenders nor descenders. */
32 #define CTYP_ASCENDER 001 /* Character has an ascender. */
33 #define CTYP_DESCENDER 002 /* Character has a descender. */
35 /* Font metrics for a single character. */
38 int code; /* Character code. */
39 int type; /* CTYP_* constants. */
40 int width; /* Width. */
41 int height; /* Height above baseline, never negative. */
42 int depth; /* Depth below baseline, never negative. */
44 /* These fields are not yet used, so to save memory, they are left
47 int italic_correction; /* Italic correction. */
48 int left_italic_correction; /* Left italic correction. */
49 int subscript_correction; /* Subscript correction. */
53 /* Kerning for a pair of characters. */
56 int ch1; /* First character. */
57 int ch2; /* Second character. */
58 int adjust; /* Kern amount. */
61 /* Font description. */
64 /* Housekeeping data. */
65 struct pool *owner; /* Containing pool. */
66 char *name; /* Font name. FIXME: this field's
68 char *filename; /* Normalized filename. */
70 /* PostScript-specific courtesy data. */
71 char *internal_name; /* Font internal name. */
72 char *encoding; /* Name of encoding file. */
74 /* Basic font characteristics. */
75 int space_width; /* Width of a space character. */
76 double slant; /* Slant angle, in degrees of forward slant. */
77 unsigned ligatures; /* Characters that have ligatures. */
78 int special; /* 1=This is a special font that will be
79 searched when a character is not present in
81 int ascent, descent; /* Height above, below the baseline. */
83 /* First dereferencing level is font_char_name_to_index(NAME). */
84 /* Second dereferencing level. */
85 short *deref; /* Each entry is an index into metric.
86 metric[deref[lookup(NAME)]] is the metric
87 for character with name NAME. */
88 int deref_size; /* Number of spaces for entries in deref. */
90 /* Third dereferencing level. */
91 struct char_metrics **metric; /* Metrics for font characters. */
92 int metric_size; /* Number of spaces for entries in metric. */
93 int metric_used; /* Number of spaces used in metric. */
96 struct kern_pair *kern; /* Hash table for kerns. */
97 int kern_size; /* Number of spaces for kerns in kern. */
98 int *kern_size_p; /* Next larger hash table size. */
99 int kern_used; /* Number of used spaces in kern. */
100 int kern_max_used; /* Max number used before rehashing. */
103 /* Index into deref[] of character with name "space". */
104 extern int space_index;
106 /* A set of fonts. */
109 struct font_set *next, *prev; /* Next, previous in chain. */
110 struct font_desc *font; /* Current font. */
113 /* Functions to work with any font. */
114 #define destroy_font(FONT) \
115 pool_destroy (FONT->owner)
117 int font_char_name_to_index (const char *);
118 struct char_metrics *font_get_char_metrics (const struct font_desc *font,
120 int font_get_kern_adjust (const struct font_desc *font, int ch1, int ch2);
123 struct groff_device_info
125 /* See groff_font(5). */
126 int res, horiz, vert;
127 int size_scale, unit_width;
128 int (*sizes)[2], n_sizes;
129 char *font_name[4]; /* Names of 4 default fonts. */
130 char *family; /* Name of default font family. */
134 struct font_desc *groff_read_font (const char *fn);
135 struct font_desc *groff_find_font (const char *dev, const char *name);
136 int groff_read_DESC (const char *dev_name, struct groff_device_info * dev);
137 void groff_init (void);
139 struct font_desc *default_font (void);