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