1 /* $XConsortium: pcf.h,v 1.2 94/04/17 20:17:15 keith Exp $ */
5 Copyright (c) 1991 X Consortium
7 Permission is hereby granted, free of charge, to any person obtaining
8 a copy of this software and associated documentation files (the
9 "Software"), to deal in the Software without restriction, including
10 without limitation the rights to use, copy, modify, merge, publish,
11 distribute, sublicense, and/or sell copies of the Software, and to
12 permit persons to whom the Software is furnished to do so, subject to
13 the following conditions:
15 The above copyright notice and this permission notice shall be included
16 in all copies or substantial portions of the Software.
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
22 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 OTHER DEALINGS IN THE SOFTWARE.
26 Except as contained in this notice, the name of the X Consortium shall
27 not be used in advertising or otherwise to promote the sale, use or
28 other dealings in this Software without prior written authorization
29 from the X Consortium.
34 * Author: Keith Packard, MIT X Consortium
41 * Information used to read/write PCF fonts
44 typedef struct _PCFTable {
49 } PCFTableRec, *PCFTablePtr;
51 #define PCF_FILE_VERSION (('p'<<24)|('c'<<16)|('f'<<8)|1)
52 #define PCF_FORMAT_MASK 0xffffff00
54 #define PCF_DEFAULT_FORMAT 0x00000000
55 #define PCF_INKBOUNDS 0x00000200
56 #define PCF_ACCEL_W_INKBOUNDS 0x00000100
57 #define PCF_COMPRESSED_METRICS 0x00000100
59 #define PCF_FORMAT_MATCH(a,b) (((a)&PCF_FORMAT_MASK) == ((b)&PCF_FORMAT_MASK))
61 #define PCF_GLYPH_PAD_MASK (3<<0)
62 #define PCF_BYTE_MASK (1<<2)
63 #define PCF_BIT_MASK (1<<3)
64 #define PCF_SCAN_UNIT_MASK (3<<4)
66 #define PCF_BYTE_ORDER(f) (((f) & PCF_BYTE_MASK)?MSBFirst:LSBFirst)
67 #define PCF_BIT_ORDER(f) (((f) & PCF_BIT_MASK)?MSBFirst:LSBFirst)
68 #define PCF_GLYPH_PAD_INDEX(f) ((f) & PCF_GLYPH_PAD_MASK)
69 #define PCF_GLYPH_PAD(f) (1<<PCF_GLYPH_PAD_INDEX(f))
70 #define PCF_SCAN_UNIT_INDEX(f) (((f) & PCF_SCAN_UNIT_MASK) >> 4)
71 #define PCF_SCAN_UNIT(f) (1<<PCF_SCAN_UNIT_INDEX(f))
72 #define PCF_FORMAT_BITS(f) ((f) & (PCF_GLYPH_PAD_MASK|PCF_BYTE_MASK|PCF_BIT_MASK|PCF_SCAN_UNIT_MASK))
74 #define PCF_SIZE_TO_INDEX(s) ((s) == 4 ? 2 : (s) == 2 ? 1 : 0)
75 #define PCF_INDEX_TO_SIZE(b) (1<<b)
77 #define PCF_FORMAT(bit,byte,glyph,scan) (\
78 (PCF_SIZE_TO_INDEX(scan) << 4) | \
79 (((bit) == MSBFirst ? 1 : 0) << 3) | \
80 (((byte) == MSBFirst ? 1 : 0) << 2) | \
81 (PCF_SIZE_TO_INDEX(glyph) << 0))
83 #define PCF_PROPERTIES (1<<0)
84 #define PCF_ACCELERATORS (1<<1)
85 #define PCF_METRICS (1<<2)
86 #define PCF_BITMAPS (1<<3)
87 #define PCF_INK_METRICS (1<<4)
88 #define PCF_BDF_ENCODINGS (1<<5)
89 #define PCF_SWIDTHS (1<<6)
90 #define PCF_GLYPH_NAMES (1<<7)
91 #define PCF_BDF_ACCELERATORS (1<<8)