123a0898aSmrg/*
223a0898aSmrg
323a0898aSmrgCopyright 1991, 1998  The Open Group
423a0898aSmrg
523a0898aSmrgPermission to use, copy, modify, distribute, and sell this software and its
623a0898aSmrgdocumentation for any purpose is hereby granted without fee, provided that
723a0898aSmrgthe above copyright notice appear in all copies and that both that
823a0898aSmrgcopyright notice and this permission notice appear in supporting
923a0898aSmrgdocumentation.
1023a0898aSmrg
1123a0898aSmrgThe above copyright notice and this permission notice shall be included
1223a0898aSmrgin all copies or substantial portions of the Software.
1323a0898aSmrg
1423a0898aSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1523a0898aSmrgOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1623a0898aSmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1723a0898aSmrgIN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
1823a0898aSmrgOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1923a0898aSmrgARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2023a0898aSmrgOTHER DEALINGS IN THE SOFTWARE.
2123a0898aSmrg
2223a0898aSmrgExcept as contained in this notice, the name of The Open Group shall
2323a0898aSmrgnot be used in advertising or otherwise to promote the sale, use or
2423a0898aSmrgother dealings in this Software without prior written authorization
2523a0898aSmrgfrom The Open Group.
2623a0898aSmrg
2723a0898aSmrg*/
2823a0898aSmrg
2923a0898aSmrg/*
3023a0898aSmrg * Author:  Keith Packard, MIT X Consortium
3123a0898aSmrg */
3223a0898aSmrg
3323a0898aSmrg#ifndef _PCF_H_
3423a0898aSmrg#define _PCF_H_
3523a0898aSmrg
3623a0898aSmrg#include <X11/fonts/fntfilio.h>
3723a0898aSmrg
3823a0898aSmrg/*
3923a0898aSmrg * Information used to read/write PCF fonts
4023a0898aSmrg */
4123a0898aSmrg
4223a0898aSmrgtypedef struct _PCFTable {
4323a0898aSmrg    CARD32      type;
4423a0898aSmrg    CARD32      format;
4523a0898aSmrg    CARD32      size;
4623a0898aSmrg    CARD32      offset;
4723a0898aSmrg}           PCFTableRec, *PCFTablePtr;
4823a0898aSmrg
4923a0898aSmrg#define PCF_FILE_VERSION	(('p'<<24)|('c'<<16)|('f'<<8)|1)
5023a0898aSmrg#define	PCF_FORMAT_MASK		0xffffff00
5123a0898aSmrg
5223a0898aSmrg#define PCF_DEFAULT_FORMAT	0x00000000
5323a0898aSmrg#define PCF_INKBOUNDS		0x00000200
5423a0898aSmrg#define PCF_ACCEL_W_INKBOUNDS	0x00000100
5523a0898aSmrg#define PCF_COMPRESSED_METRICS	0x00000100
5623a0898aSmrg
5723a0898aSmrg#define PCF_FORMAT_MATCH(a,b) (((a)&PCF_FORMAT_MASK) == ((b)&PCF_FORMAT_MASK))
5823a0898aSmrg
5923a0898aSmrg#define PCF_GLYPH_PAD_MASK	(3<<0)
6023a0898aSmrg#define PCF_BYTE_MASK		(1<<2)
6123a0898aSmrg#define PCF_BIT_MASK		(1<<3)
6223a0898aSmrg#define PCF_SCAN_UNIT_MASK	(3<<4)
6323a0898aSmrg
6423a0898aSmrg#define PCF_BYTE_ORDER(f)	(((f) & PCF_BYTE_MASK)?MSBFirst:LSBFirst)
6523a0898aSmrg#define PCF_BIT_ORDER(f)	(((f) & PCF_BIT_MASK)?MSBFirst:LSBFirst)
6623a0898aSmrg#define PCF_GLYPH_PAD_INDEX(f)	((f) & PCF_GLYPH_PAD_MASK)
6723a0898aSmrg#define PCF_GLYPH_PAD(f)	(1<<PCF_GLYPH_PAD_INDEX(f))
6823a0898aSmrg#define PCF_SCAN_UNIT_INDEX(f)	(((f) & PCF_SCAN_UNIT_MASK) >> 4)
6923a0898aSmrg#define PCF_SCAN_UNIT(f)	(1<<PCF_SCAN_UNIT_INDEX(f))
7023a0898aSmrg#define PCF_FORMAT_BITS(f)	((f) & (PCF_GLYPH_PAD_MASK|PCF_BYTE_MASK|PCF_BIT_MASK|PCF_SCAN_UNIT_MASK))
7123a0898aSmrg
7223a0898aSmrg#define PCF_SIZE_TO_INDEX(s)	((s) == 4 ? 2 : (s) == 2 ? 1 : 0)
7323a0898aSmrg#define PCF_INDEX_TO_SIZE(b)	(1<<b)
7423a0898aSmrg
7523a0898aSmrg#define PCF_FORMAT(bit,byte,glyph,scan) (\
7623a0898aSmrg    (PCF_SIZE_TO_INDEX(scan) << 4) | \
7723a0898aSmrg    (((bit) == MSBFirst ? 1 : 0) << 3) | \
7823a0898aSmrg    (((byte) == MSBFirst ? 1 : 0) << 2) | \
7923a0898aSmrg    (PCF_SIZE_TO_INDEX(glyph) << 0))
8023a0898aSmrg
8123a0898aSmrg#define PCF_PROPERTIES		    (1<<0)
8223a0898aSmrg#define PCF_ACCELERATORS	    (1<<1)
8323a0898aSmrg#define PCF_METRICS		    (1<<2)
8423a0898aSmrg#define PCF_BITMAPS		    (1<<3)
8523a0898aSmrg#define PCF_INK_METRICS		    (1<<4)
8623a0898aSmrg#define	PCF_BDF_ENCODINGS	    (1<<5)
8723a0898aSmrg#define PCF_SWIDTHS		    (1<<6)
8823a0898aSmrg#define PCF_GLYPH_NAMES		    (1<<7)
8923a0898aSmrg#define PCF_BDF_ACCELERATORS	    (1<<8)
9023a0898aSmrg
9141c30155Smrgextern int pcfReadFont ( FontPtr pFont, FontFilePtr file,
9223a0898aSmrg			 int bit, int byte, int glyph, int scan );
9323a0898aSmrgextern int pcfReadFontInfo ( FontInfoPtr pFontInfo, FontFilePtr file );
9423a0898aSmrgextern int pcfWriteFont ( FontPtr pFont, FontFilePtr file );
9541c30155Smrgextern void pcfError ( const char *, ... ) _X_ATTRIBUTE_PRINTF(1, 2);
9623a0898aSmrg
9723a0898aSmrg#endif				/* _PCF_H_ */
98