1/*
2
3Copyright 1990, 1998  The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included
12in all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
18OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20OTHER DEALINGS IN THE SOFTWARE.
21
22Except as contained in this notice, the name of The Open Group shall
23not be used in advertising or otherwise to promote the sale, use or
24other dealings in this Software without prior written authorization
25from The Open Group.
26
27*/
28
29#ifndef BDFINT_H
30#define BDFINT_H
31
32#define bdfIsPrefix(buf,str)	(!strncmp((char *)buf,str,strlen(str)))
33#define	bdfStrEqual(s1,s2)	(!strcmp(s1,s2))
34
35#define	BDF_GENPROPS	6
36#define NullProperty	((FontPropPtr)0)
37
38/*
39 * This structure holds some properties we need to generate if they aren't
40 * specified in the BDF file and some other values read from the file
41 * that we'll need to calculate them.  We need to keep track of whether
42 * or not we've read them.
43 */
44typedef struct BDFSTAT {
45    int         linenum;
46    char       *fileName;
47    char        fontName[MAXFONTNAMELEN];
48    float       pointSize;
49    int         resolution_x;
50    int         resolution_y;
51    int         digitCount;
52    int         digitWidths;
53    int         exHeight;
54
55    FontPropPtr fontProp;
56    FontPropPtr pointSizeProp;
57    FontPropPtr resolutionXProp;
58    FontPropPtr resolutionYProp;
59    FontPropPtr resolutionProp;
60    FontPropPtr xHeightProp;
61    FontPropPtr weightProp;
62    FontPropPtr quadWidthProp;
63    BOOL        haveFontAscent;
64    BOOL        haveFontDescent;
65    BOOL        haveDefaultCh;
66}           bdfFileState;
67
68extern void bdfError ( const char * message, ... ) _X_ATTRIBUTE_PRINTF(1, 2);
69extern void bdfWarning ( const char *message, ... ) _X_ATTRIBUTE_PRINTF(1, 2);
70extern unsigned char * bdfGetLine ( FontFilePtr file, unsigned char *buf,
71				    int len );
72extern Atom bdfForceMakeAtom ( const char *str, int *size );
73extern Atom bdfGetPropertyValue ( char *s );
74extern int bdfIsInteger ( char *str );
75extern unsigned char bdfHexByte ( unsigned char *s );
76extern Bool bdfSpecialProperty ( FontPtr pFont, FontPropPtr prop,
77				 char isString, bdfFileState *bdfState );
78extern int bdfReadFont( FontPtr pFont, FontFilePtr file,
79			int bit, int byte, int glyph, int scan );
80extern int bdfReadFontInfo( FontInfoPtr pFontInfo, FontFilePtr file );
81
82extern void FontCharInkMetrics ( FontPtr pFont, CharInfoPtr pCI,
83				 xCharInfo *pInk );
84extern void FontCharReshape ( FontPtr pFont, CharInfoPtr pSrc,
85			      CharInfoPtr pDst );
86
87#endif				/* BDFINT_H */
88