1 /***********************************************************
2 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
3 
4                         All Rights Reserved
5 
6 Permission to use, copy, modify, and distribute this software and its
7 documentation for any purpose and without fee is hereby granted,
8 provided that the above copyright notice appear in all copies and that
9 both that copyright notice and this permission notice appear in
10 supporting documentation, and that the name of Digital not be
11 used in advertising or publicity pertaining to distribution of the
12 software without specific, written prior permission.
13 
14 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
15 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
16 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
17 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
19 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
20 SOFTWARE.
21 
22 ******************************************************************/
23 
24 #ifndef DIXFONTSTRUCT_H
25 #define DIXFONTSTRUCT_H
26 
27 #include "servermd.h"
28 #include "dixfont.h"
29 #include <X11/fonts/fontstruct.h>
30 #include <X11/fonts/libxfont2.h>
31 #include "closure.h"
32 #include <X11/Xproto.h>         /* for xQueryFontReply */
33 
34 #define FONTCHARSET(font)	  (font)
35 #define FONTMAXBOUNDS(font,field) (font)->info.maxbounds.field
36 #define FONTMINBOUNDS(font,field) (font)->info.minbounds.field
37 #define TERMINALFONT(font)	  (font)->info.terminalFont
38 #define FONTASCENT(font)	  (font)->info.fontAscent
39 #define FONTDESCENT(font)	  (font)->info.fontDescent
40 #define FONTGLYPHS(font)	  0
41 #define FONTCONSTMETRICS(font)	  (font)->info.constantMetrics
42 #define FONTCONSTWIDTH(font)	  (font)->info.constantWidth
43 #define FONTALLEXIST(font)	  (font)->info.allExist
44 #define FONTFIRSTCOL(font)	  (font)->info.firstCol
45 #define FONTLASTCOL(font)	  (font)->info.lastCol
46 #define FONTFIRSTROW(font)	  (font)->info.firstRow
47 #define FONTLASTROW(font)	  (font)->info.lastRow
48 #define FONTDEFAULTCH(font)	  (font)->info.defaultCh
49 #define FONTINKMIN(font)	  (&((font)->info.ink_minbounds))
50 #define FONTINKMAX(font)	  (&((font)->info.ink_maxbounds))
51 #define FONTPROPS(font)		  (font)->info.props
52 #define FONTGLYPHBITS(base,pci)	  ((unsigned char *) (pci)->bits)
53 #define FONTINFONPROPS(font)	  (font)->info.nprops
54 
55 /* some things haven't changed names, but we'll be careful anyway */
56 
57 #define FONTREFCNT(font)	  (font)->refcnt
58 
59 /*
60  * for linear char sets
61  */
62 #define N1dChars(pfont)	(FONTLASTCOL(pfont) - FONTFIRSTCOL(pfont) + 1)
63 
64 /*
65  * for 2D char sets
66  */
67 #define N2dChars(pfont)	(N1dChars(pfont) * \
68 			 (FONTLASTROW(pfont) - FONTFIRSTROW(pfont) + 1))
69 
70 #ifndef GLYPHPADBYTES
71 #define GLYPHPADBYTES -1
72 #endif
73 
74 #if GLYPHPADBYTES == 0 || GLYPHPADBYTES == 1
75 #define	GLYPHWIDTHBYTESPADDED(pci)	(GLYPHWIDTHBYTES(pci))
76 #define	PADGLYPHWIDTHBYTES(w)		(((w)+7)>>3)
77 #endif
78 
79 #if GLYPHPADBYTES == 2
80 #define	GLYPHWIDTHBYTESPADDED(pci)	((GLYPHWIDTHBYTES(pci)+1) & ~0x1)
81 #define	PADGLYPHWIDTHBYTES(w)		(((((w)+7)>>3)+1) & ~0x1)
82 #endif
83 
84 #if GLYPHPADBYTES == 4
85 #define	GLYPHWIDTHBYTESPADDED(pci)	((GLYPHWIDTHBYTES(pci)+3) & ~0x3)
86 #define	PADGLYPHWIDTHBYTES(w)		(((((w)+7)>>3)+3) & ~0x3)
87 #endif
88 
89 #if GLYPHPADBYTES == 8          /* for a cray? */
90 #define	GLYPHWIDTHBYTESPADDED(pci)	((GLYPHWIDTHBYTES(pci)+7) & ~0x7)
91 #define	PADGLYPHWIDTHBYTES(w)		(((((w)+7)>>3)+7) & ~0x7)
92 #endif
93 
94 #endif                          /* DIXFONTSTRUCT_H */
95