Remove macII support
[oweals/cde.git] / cde / programs / dtudcfonted / dtgpftobdf / bdftosnf.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: bdftosnf.h /main/4 1996/06/25 20:13:29 cde-fuj $ */
24 /*
25  *  (c) Copyright 1995 FUJITSU LIMITED
26  *  This is source code modified by FUJITSU LIMITED under the Joint
27  *  Development Agreement for the CDEnext PST.
28  *  This is unpublished proprietary source code of FUJITSU LIMITED
29  */
30
31
32 #include<X11/Xfuncs.h>
33
34 #ifndef MIN
35 #define MIN(a,b) ((a)>(b)?(b):(a))
36 #endif
37 #ifndef MAX
38 #define MAX(a,b) ((a)>(b)?(a):(b))
39 #endif
40
41 typedef struct _GlyphMap {
42     char        *bits;
43     int         h;
44     int         w;
45     int         widthBytes;
46 } GlyphMap;
47
48 /*
49  * a structure to hold all the pointers to make it easy to pass them all
50  * around. Much like the FONT structure in the server.
51  */
52
53 typedef struct _TempFont {
54     FontInfoPtr pFI;
55     CharInfoPtr pCI;
56     unsigned char *pGlyphs;
57     FontPropPtr pFP;
58     CharInfoPtr pInkCI;
59     CharInfoPtr pInkMin;
60     CharInfoPtr pInkMax;
61 } TempFont; /* not called font since collides with type in X.h */
62
63 #ifdef vax
64 #       define DEFAULTGLPAD     1               /* default padding for glyphs */
65 #       define DEFAULTBITORDER  LSBFirst        /* default bitmap bit order */
66 #       define DEFAULTBYTEORDER LSBFirst        /* default bitmap byte order */
67 #       define DEFAULTSCANUNIT  1               /* default bitmap scan unit */
68
69 #elif defined(sun)
70
71 #  if (sun386 || sun5)
72 #       define DEFAULTGLPAD     4               /* default padding for glyphs */
73 #       define DEFAULTBITORDER  LSBFirst        /* default bitmap bit order */
74 #       define DEFAULTBYTEORDER LSBFirst        /* default bitmap byte order */
75 #       define DEFAULTSCANUNIT  1               /* default bitmap scan unit */
76 #  else
77 #       define DEFAULTGLPAD     4               /* default padding for glyphs */
78 #       define DEFAULTBITORDER  MSBFirst        /* default bitmap bit order */
79 #       define DEFAULTBYTEORDER MSBFirst        /* default bitmap byte order */
80 #       define DEFAULTSCANUNIT  1               /* default bitmap scan unit */
81 #  endif
82
83 #elif defined(apollo)
84
85 #       define DEFAULTGLPAD     2               /* default padding for glyphs */
86 #       define DEFAULTBITORDER  MSBFirst        /* default bitmap bit order */
87 #       define DEFAULTBYTEORDER MSBFirst        /* default bitmap byte order */
88 #       define DEFAULTSCANUNIT  1               /* default bitmap scan unit */
89
90 #elif defined(ibm032)
91
92 #       define DEFAULTGLPAD     1               /* default padding for glyphs */
93 #       define DEFAULTBITORDER  MSBFirst        /* default bitmap bit order */
94 #       define DEFAULTBYTEORDER MSBFirst        /* default bitmap byte order */
95 #       define DEFAULTSCANUNIT  1               /* default bitmap scan unit */
96
97 #elif defined(hpux)
98
99 #       define DEFAULTGLPAD     2               /* default padding for glyphs */
100 #       define DEFAULTBITORDER  MSBFirst        /* default bitmap bit order */
101 #       define DEFAULTBYTEORDER MSBFirst        /* default bitmap byte order */
102 #       define DEFAULTSCANUNIT  1               /* default bitmap scan unit */
103
104 #elif defined(pegasus)
105
106 #       define DEFAULTGLPAD     4               /* default padding for glyphs */
107 #       define DEFAULTBITORDER  MSBFirst        /* default bitmap bit order */
108 #       define DEFAULTBYTEORDER MSBFirst        /* default bitmap byte order */
109 #       define DEFAULTSCANUNIT  1               /* default bitmap scan unit */
110
111 #elif defined(mips)
112 #    ifdef MIPSEL
113
114 #         define DEFAULTGLPAD     4             /* default padding for glyphs */
115 #         define DEFAULTBITORDER  LSBFirst      /* default bitmap bit order */
116 #         define DEFAULTBYTEORDER LSBFirst      /* default bitmap byte order */
117 #         define DEFAULTSCANUNIT  1             /* default bitmap scan unit */
118
119 #     else
120 #         define DEFAULTGLPAD     4             /* default padding for glyphs */
121 #         define DEFAULTBITORDER  MSBFirst      /* default bitmap bit order */
122 #         define DEFAULTBYTEORDER MSBFirst      /* default bitmap byte order */
123 #         define DEFAULTSCANUNIT  1             /* default bitmap scan unit */
124 #     endif
125
126 #else
127 #         define DEFAULTGLPAD     1             /* default padding for glyphs */
128 #         define DEFAULTBITORDER  MSBFirst      /* default bitmap bit order */
129 #         define DEFAULTBYTEORDER MSBFirst      /* default bitmap byte order */
130 #         define DEFAULTSCANUNIT  1             /* default bitmap scan unit */
131 #endif
132
133 #define GLWIDTHBYTESPADDED(bits,nbytes) \
134         ((nbytes) == 1 ? (((bits)+7)>>3)        /* pad to 1 byte */ \
135         :(nbytes) == 2 ? ((((bits)+15)>>3)&~1)  /* pad to 2 bytes */ \
136         :(nbytes) == 4 ? ((((bits)+31)>>3)&~3)  /* pad to 4 bytes */ \
137         :(nbytes) == 8 ? ((((bits)+63)>>3)&~7)  /* pad to 8 bytes */ \
138         : 0)
139