pcf.h revision 23a0898a
11.2Spooka/* $Xorg: pcf.h,v 1.4 2001/02/09 02:04:02 xorgcvs Exp $ */
21.1Such
31.1Such/*
4
5Copyright 1991, 1998  The Open Group
6
7Permission to use, copy, modify, distribute, and sell this software and its
8documentation for any purpose is hereby granted without fee, provided that
9the above copyright notice appear in all copies and that both that
10copyright notice and this permission notice appear in supporting
11documentation.
12
13The above copyright notice and this permission notice shall be included
14in all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
20OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22OTHER DEALINGS IN THE SOFTWARE.
23
24Except as contained in this notice, the name of The Open Group shall
25not be used in advertising or otherwise to promote the sale, use or
26other dealings in this Software without prior written authorization
27from The Open Group.
28
29*/
30/* $XFree86: xc/lib/font/bitmap/pcf.h,v 1.4 2001/12/14 19:56:47 dawes Exp $ */
31
32/*
33 * Author:  Keith Packard, MIT X Consortium
34 */
35
36#ifndef _PCF_H_
37#define _PCF_H_
38
39#include <X11/fonts/fntfilio.h>
40
41/*
42 * Information used to read/write PCF fonts
43 */
44
45typedef struct _PCFTable {
46    CARD32      type;
47    CARD32      format;
48    CARD32      size;
49    CARD32      offset;
50}           PCFTableRec, *PCFTablePtr;
51
52#define PCF_FILE_VERSION	(('p'<<24)|('c'<<16)|('f'<<8)|1)
53#define	PCF_FORMAT_MASK		0xffffff00
54
55#define PCF_DEFAULT_FORMAT	0x00000000
56#define PCF_INKBOUNDS		0x00000200
57#define PCF_ACCEL_W_INKBOUNDS	0x00000100
58#define PCF_COMPRESSED_METRICS	0x00000100
59
60#define PCF_FORMAT_MATCH(a,b) (((a)&PCF_FORMAT_MASK) == ((b)&PCF_FORMAT_MASK))
61
62#define PCF_GLYPH_PAD_MASK	(3<<0)
63#define PCF_BYTE_MASK		(1<<2)
64#define PCF_BIT_MASK		(1<<3)
65#define PCF_SCAN_UNIT_MASK	(3<<4)
66
67#define PCF_BYTE_ORDER(f)	(((f) & PCF_BYTE_MASK)?MSBFirst:LSBFirst)
68#define PCF_BIT_ORDER(f)	(((f) & PCF_BIT_MASK)?MSBFirst:LSBFirst)
69#define PCF_GLYPH_PAD_INDEX(f)	((f) & PCF_GLYPH_PAD_MASK)
70#define PCF_GLYPH_PAD(f)	(1<<PCF_GLYPH_PAD_INDEX(f))
71#define PCF_SCAN_UNIT_INDEX(f)	(((f) & PCF_SCAN_UNIT_MASK) >> 4)
72#define PCF_SCAN_UNIT(f)	(1<<PCF_SCAN_UNIT_INDEX(f))
73#define PCF_FORMAT_BITS(f)	((f) & (PCF_GLYPH_PAD_MASK|PCF_BYTE_MASK|PCF_BIT_MASK|PCF_SCAN_UNIT_MASK))
74
75#define PCF_SIZE_TO_INDEX(s)	((s) == 4 ? 2 : (s) == 2 ? 1 : 0)
76#define PCF_INDEX_TO_SIZE(b)	(1<<b)
77
78#define PCF_FORMAT(bit,byte,glyph,scan) (\
79    (PCF_SIZE_TO_INDEX(scan) << 4) | \
80    (((bit) == MSBFirst ? 1 : 0) << 3) | \
81    (((byte) == MSBFirst ? 1 : 0) << 2) | \
82    (PCF_SIZE_TO_INDEX(glyph) << 0))
83
84#define PCF_PROPERTIES		    (1<<0)
85#define PCF_ACCELERATORS	    (1<<1)
86#define PCF_METRICS		    (1<<2)
87#define PCF_BITMAPS		    (1<<3)
88#define PCF_INK_METRICS		    (1<<4)
89#define	PCF_BDF_ENCODINGS	    (1<<5)
90#define PCF_SWIDTHS		    (1<<6)
91#define PCF_GLYPH_NAMES		    (1<<7)
92#define PCF_BDF_ACCELERATORS	    (1<<8)
93
94extern int pcfReadFont ( FontPtr pFont, FontFilePtr file,
95			 int bit, int byte, int glyph, int scan );
96extern int pcfReadFontInfo ( FontInfoPtr pFontInfo, FontFilePtr file );
97extern int pmfReadFont ( FontPtr pFont, FontFilePtr file,
98			 int bit, int byte, int glyph, int scan );
99extern int pcfWriteFont ( FontPtr pFont, FontFilePtr file );
100extern void pcfError ( const char *, ... );
101
102#endif				/* _PCF_H_ */
103