1
2/*****************************************************************
3Copyright (c) 1989,1990, 1991 by Sun Microsystems, Inc. and the X Consortium.
4
5                        All Rights Reserved
6
7Permission to use, copy, modify, and distribute this software and its
8documentation for any purpose and without fee is hereby granted,
9provided that the above copyright notice appear in all copies and that
10both that copyright notice and this permission notice appear in
11supporting documentation, and that the names of Sun Microsystems,
12the X Consortium, and MIT not be used in advertising or publicity
13pertaining to distribution of the software without specific, written
14prior permission.
15
16SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
18SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
19DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
20WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
21ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
22SOFTWARE.
23
24******************************************************************/
25
26#ifndef WFONT_INCLUDED
27#define WFONT_INCLUDED
28
29#define WFONT_MAGIC	0x813
30#define WFONT_MAGIC_PLUS 0x715
31#define WFONT_MAGIC_PEX 0x70686e74
32#define START_PROPS 0x100
33#define START_DISPATCH(_num_props)  (START_PROPS + 160 * _num_props)
34#define START_PATH(_num_ch_, _num_props)  (START_DISPATCH(_num_props) + sizeof(Dispatch) * _num_ch_)
35#define NUM_DISPATCH	128
36
37typedef struct {
38  unsigned short x;
39  unsigned short y;
40} Path_point2dpx;
41
42typedef struct {
43  float x;
44  float y;
45} Path_point2df;
46
47typedef struct {
48  int x;
49  int y;
50  int z;
51} Path_point3di;
52
53typedef struct {
54  float x;
55  float y;
56  float z;
57} Path_point3df;
58
59typedef struct {
60  float x;
61  float y;
62  float z;
63  float w;
64} Path_point4df;
65
66typedef union {
67  Path_point2dpx *pt2dpx;
68  Path_point2df *pt2df;
69  Path_point3di *pt3di;
70  Path_point3df *pt3df;
71  Path_point4df *pt4df;
72} Path_pt_ptr;
73
74typedef enum {
75  PATH_2DF,
76  PATH_2DPX,
77  PATH_3DF,
78  PATH_3DI,
79  PATH_4DF
80} Path_type;
81
82typedef struct {
83  int n_pts;                    /* number of points in the subpath */
84  Path_pt_ptr pts;              /* pointer to them */
85  int closed;                   /* true if the subpath is closed */
86  int dcmp_flag;                /* flag for pgon dcmp, pgon type
87                                 * and dcmped triangle type */
88} Path_subpath;
89
90typedef struct {
91  Path_type type;               /* type of vertices in this path */
92  int n_subpaths;               /* number of subpaths */
93  int n_vertices;               /* total number of vertices */
94  Path_subpath *subpaths;       /* array of subpaths */
95} Path;
96
97typedef Path *Path_handle;
98
99typedef struct {
100  char propname[80];            /* font property name */
101  char propvalue[80];           /* font property value */
102} Property;
103
104typedef struct {
105  int magic;                    /* magic number */
106  char name[80];                /* name of this font */
107  float top,                    /* extreme values */
108    bottom, max_width;
109  int num_ch;                   /* no. of fonts in the set */
110  int num_props;                /* no. of font properties */
111  Property *properties;         /* array of properties */
112} Font_header;
113
114typedef struct {
115  float center,                 /* center of the character */
116    right;                      /* right edge */
117  long offset;                  /* offset in the file of the character
118                                 * * description */
119} Dispatch;
120
121typedef struct {
122  float center, right;
123  Path strokes;
124} Ch_font;
125
126typedef struct {
127  char name[80];
128  float top, bottom, max_width;
129  int num_ch;                   /* # characters in the font */
130  Ch_font **ch_data;
131} Phg_font;
132
133#endif /*WFONT_INCLUDED */
134