1 /* $XConsortium: snfstr.h,v 1.5 94/04/17 20:17:17 rws Exp $ */
2 /***********************************************************
3 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
7 Permission to use, copy, modify, and distribute this software and its
8 documentation for any purpose and without fee is hereby granted,
9 provided that the above copyright notice appear in all copies and that
10 both that copyright notice and this permission notice appear in
11 supporting documentation, and that the name of Digital not be
12 used in advertising or publicity pertaining to distribution of the
13 software without specific, written prior permission.
15 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
16 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
17 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
18 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
19 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
20 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
23 ******************************************************************/
27 Copyright (c) 1994 X Consortium
29 Permission is hereby granted, free of charge, to any person obtaining
30 a copy of this software and associated documentation files (the
31 "Software"), to deal in the Software without restriction, including
32 without limitation the rights to use, copy, modify, merge, publish,
33 distribute, sublicense, and/or sell copies of the Software, and to
34 permit persons to whom the Software is furnished to do so, subject to
35 the following conditions:
37 The above copyright notice and this permission notice shall be included
38 in all copies or substantial portions of the Software.
40 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
41 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
42 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
43 IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
44 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
45 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
46 OTHER DEALINGS IN THE SOFTWARE.
48 Except as contained in this notice, the name of the X Consortium shall
49 not be used in advertising or otherwise to promote the sale, use or
50 other dealings in this Software without prior written authorization
51 from the X Consortium.
59 * This file describes the Server Natural Font format.
60 * SNF fonts are both CPU-dependent and frame buffer bit order dependent.
61 * This file is used by:
62 * 1) the server, to hold font information read out of font files.
65 * Each font file contains the following
66 * data structures, with no padding in-between.
68 * 1) The XFONTINFO structure
69 * hand-padded to a two-short boundary.
70 * maxbounds.byteoffset is the total number of bytes in the
72 * maxbounds.bitOffset is thetotal width of the unpadded font
74 * 2) The XCHARINFO array
75 * indexed directly with character codes, both on disk
79 * padded in the server-natural way, and
80 * ordered in the device-natural way.
81 * End of glyphs padded to 32-bit boundary.
83 * 4) nProps font properties
85 * 5) a sequence of null-terminated strings, for font properties
88 #define FONT_FILE_VERSION 4
90 typedef struct _snfFontProp {
91 CARD32 name; /* offset of string */
92 INT32 value; /* number or offset of string */
93 Bool indirect; /* value is a string offset */
97 * the following macro definitions describe a font file image in memory
99 #define ADDRCharInfoRec( pfi) \
100 ((snfCharInfoRec *) &(pfi)[1])
102 #define ADDRCHARGLYPHS( pfi) \
103 (((char *) &(pfi)[1]) + BYTESOFCHARINFO(pfi))
106 * pad out glyphs to a CARD32 boundary
108 #define ADDRXFONTPROPS( pfi) \
109 ((snfFontPropRec *) ((char *)ADDRCHARGLYPHS( pfi) + BYTESOFGLYPHINFO(pfi)))
111 #define ADDRSTRINGTAB( pfi) \
112 ((char *)ADDRXFONTPROPS( pfi) + BYTESOFPROPINFO(pfi))
114 #define n2dChars(pfi) (((pfi)->lastRow - (pfi)->firstRow + 1) * \
115 ((pfi)->lastCol - (pfi)->firstCol + 1))
116 #define BYTESOFFONTINFO(pfi) (sizeof(snfFontInfoRec))
117 #define BYTESOFCHARINFO(pfi) (sizeof(snfCharInfoRec) * n2dChars(pfi))
118 #define BYTESOFPROPINFO(pfi) (sizeof(snfFontPropRec) * (pfi)->nProps)
119 #define BYTESOFSTRINGINFO(pfi) ((pfi)->lenStrings)
120 #define BYTESOFGLYPHINFO(pfi) (((pfi)->maxbounds.byteOffset+3) & ~0x3)
121 #define BYTESOFINKINFO(pfi) (sizeof(snfCharInfoRec) * n2dChars(pfi))
123 typedef struct _snfFontProp *snfFontPropPtr;
124 typedef struct _snfCharInfo *snfCharInfoPtr;
125 typedef struct _snfFontInfo *snfFontInfoPtr;
127 typedef struct _snfCharInfo {
128 xCharInfo metrics; /* info preformatted for Queries */
129 unsigned byteOffset:24; /* byte offset of the raster from pGlyphs */
130 unsigned exists:1; /* true iff glyph exists for this char */
131 unsigned pad:7; /* must be zero for now */
134 typedef struct _snfFontInfo {
135 unsigned int version1; /* version stamp */
136 unsigned int allExist;
137 unsigned int drawDirection;
138 unsigned int noOverlap; /* true if:
139 * max(rightSideBearing-characterWidth) <=
140 * minbounds->metrics.leftSideBearing */
141 unsigned int constantMetrics;
142 unsigned int terminalFont; /* Should be deprecated! true if: constant
143 * metrics && leftSideBearing == 0 &&
144 * rightSideBearing == characterWidth &&
145 * ascent == fontAscent && descent ==
147 unsigned int linear:1; /* true if firstRow == lastRow */
148 unsigned int constantWidth:1; /* true if
149 * minbounds->metrics.characterWidth
151 * maxbounds->metrics.characterWidth */
152 unsigned int inkInside:1; /* true if for all defined glyphs:
153 * leftSideBearing >= 0 && rightSideBearing <=
154 * characterWidth && -fontDescent <= ascent <=
155 * fontAscent && -fontAscent <= descent <=
157 unsigned int inkMetrics:1; /* ink metrics != bitmap metrics */
158 /* used with terminalFont */
159 /* see font's pInk{CI,Min,Max} */
160 unsigned int padding:28;
161 unsigned int firstCol;
162 unsigned int lastCol;
163 unsigned int firstRow;
164 unsigned int lastRow;
166 unsigned int lenStrings; /* length in bytes of string table */
167 unsigned int chDefault; /* default character */
168 int fontDescent; /* minimum for quality typography */
169 int fontAscent; /* minimum for quality typography */
170 snfCharInfoRec minbounds; /* MIN of glyph metrics over all chars */
171 snfCharInfoRec maxbounds; /* MAX of glyph metrics over all chars */
172 unsigned int pixDepth; /* intensity bits per pixel */
173 unsigned int glyphSets; /* number of sets of glyphs, for sub-pixel
175 unsigned int version2; /* version stamp double-check */
178 #endif /* SNFSTR_H */