Imported Upstream version 1.15.1
[deb_xorg-server.git] / include / dixfontstr.h
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 "closure.h"
31 #include <X11/Xproto.h> /* for xQueryFontReply */
32
33 #define FONTCHARSET(font) (font)
34 #define FONTMAXBOUNDS(font,field) (font)->info.maxbounds.field
35 #define FONTMINBOUNDS(font,field) (font)->info.minbounds.field
36 #define TERMINALFONT(font) (font)->info.terminalFont
37 #define FONTASCENT(font) (font)->info.fontAscent
38 #define FONTDESCENT(font) (font)->info.fontDescent
39 #define FONTGLYPHS(font) 0
40 #define FONTCONSTMETRICS(font) (font)->info.constantMetrics
41 #define FONTCONSTWIDTH(font) (font)->info.constantWidth
42 #define FONTALLEXIST(font) (font)->info.allExist
43 #define FONTFIRSTCOL(font) (font)->info.firstCol
44 #define FONTLASTCOL(font) (font)->info.lastCol
45 #define FONTFIRSTROW(font) (font)->info.firstRow
46 #define FONTLASTROW(font) (font)->info.lastRow
47 #define FONTDEFAULTCH(font) (font)->info.defaultCh
48 #define FONTINKMIN(font) (&((font)->info.ink_minbounds))
49 #define FONTINKMAX(font) (&((font)->info.ink_maxbounds))
50 #define FONTPROPS(font) (font)->info.props
51 #define FONTGLYPHBITS(base,pci) ((unsigned char *) (pci)->bits)
52 #define FONTINFONPROPS(font) (font)->info.nprops
53
54 /* some things haven't changed names, but we'll be careful anyway */
55
56 #define FONTREFCNT(font) (font)->refcnt
57
58 /*
59 * for linear char sets
60 */
61 #define N1dChars(pfont) (FONTLASTCOL(pfont) - FONTFIRSTCOL(pfont) + 1)
62
63 /*
64 * for 2D char sets
65 */
66 #define N2dChars(pfont) (N1dChars(pfont) * \
67 (FONTLASTROW(pfont) - FONTFIRSTROW(pfont) + 1))
68
69 #ifndef GLYPHPADBYTES
70 #define GLYPHPADBYTES -1
71 #endif
72
73 #if GLYPHPADBYTES == 0 || GLYPHPADBYTES == 1
74 #define GLYPHWIDTHBYTESPADDED(pci) (GLYPHWIDTHBYTES(pci))
75 #define PADGLYPHWIDTHBYTES(w) (((w)+7)>>3)
76 #endif
77
78 #if GLYPHPADBYTES == 2
79 #define GLYPHWIDTHBYTESPADDED(pci) ((GLYPHWIDTHBYTES(pci)+1) & ~0x1)
80 #define PADGLYPHWIDTHBYTES(w) (((((w)+7)>>3)+1) & ~0x1)
81 #endif
82
83 #if GLYPHPADBYTES == 4
84 #define GLYPHWIDTHBYTESPADDED(pci) ((GLYPHWIDTHBYTES(pci)+3) & ~0x3)
85 #define PADGLYPHWIDTHBYTES(w) (((((w)+7)>>3)+3) & ~0x3)
86 #endif
87
88 #if GLYPHPADBYTES == 8 /* for a cray? */
89 #define GLYPHWIDTHBYTESPADDED(pci) ((GLYPHWIDTHBYTES(pci)+7) & ~0x7)
90 #define PADGLYPHWIDTHBYTES(w) (((((w)+7)>>3)+7) & ~0x7)
91 #endif
92
93 #endif /* DIXFONTSTRUCT_H */