105b261ecSmrg/***********************************************************
205b261ecSmrgCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
305b261ecSmrg
405b261ecSmrg                        All Rights Reserved
505b261ecSmrg
605b261ecSmrgPermission to use, copy, modify, and distribute this software and its
705b261ecSmrgdocumentation for any purpose and without fee is hereby granted,
805b261ecSmrgprovided that the above copyright notice appear in all copies and that
905b261ecSmrgboth that copyright notice and this permission notice appear in
1005b261ecSmrgsupporting documentation, and that the name of Digital not be
1105b261ecSmrgused in advertising or publicity pertaining to distribution of the
1205b261ecSmrgsoftware without specific, written prior permission.
1305b261ecSmrg
1405b261ecSmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
1505b261ecSmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
1605b261ecSmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
1705b261ecSmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
1805b261ecSmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
1905b261ecSmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
2005b261ecSmrgSOFTWARE.
2105b261ecSmrg
2205b261ecSmrg******************************************************************/
2305b261ecSmrg
2405b261ecSmrg#ifndef DIXFONTSTRUCT_H
2505b261ecSmrg#define DIXFONTSTRUCT_H
2605b261ecSmrg
2705b261ecSmrg#include "servermd.h"
2805b261ecSmrg#include "dixfont.h"
2905b261ecSmrg#include <X11/fonts/fontstruct.h>
301b5d61b8Smrg#include <X11/fonts/libxfont2.h>
3105b261ecSmrg#include "closure.h"
3235c4bbdfSmrg#include <X11/Xproto.h>         /* for xQueryFontReply */
3305b261ecSmrg
3405b261ecSmrg#define FONTCHARSET(font)	  (font)
3505b261ecSmrg#define FONTMAXBOUNDS(font,field) (font)->info.maxbounds.field
3605b261ecSmrg#define FONTMINBOUNDS(font,field) (font)->info.minbounds.field
3705b261ecSmrg#define TERMINALFONT(font)	  (font)->info.terminalFont
3805b261ecSmrg#define FONTASCENT(font)	  (font)->info.fontAscent
3905b261ecSmrg#define FONTDESCENT(font)	  (font)->info.fontDescent
4005b261ecSmrg#define FONTGLYPHS(font)	  0
4105b261ecSmrg#define FONTCONSTMETRICS(font)	  (font)->info.constantMetrics
4205b261ecSmrg#define FONTCONSTWIDTH(font)	  (font)->info.constantWidth
4305b261ecSmrg#define FONTALLEXIST(font)	  (font)->info.allExist
4405b261ecSmrg#define FONTFIRSTCOL(font)	  (font)->info.firstCol
4505b261ecSmrg#define FONTLASTCOL(font)	  (font)->info.lastCol
4605b261ecSmrg#define FONTFIRSTROW(font)	  (font)->info.firstRow
4705b261ecSmrg#define FONTLASTROW(font)	  (font)->info.lastRow
4805b261ecSmrg#define FONTDEFAULTCH(font)	  (font)->info.defaultCh
4905b261ecSmrg#define FONTINKMIN(font)	  (&((font)->info.ink_minbounds))
5005b261ecSmrg#define FONTINKMAX(font)	  (&((font)->info.ink_maxbounds))
5105b261ecSmrg#define FONTPROPS(font)		  (font)->info.props
5205b261ecSmrg#define FONTGLYPHBITS(base,pci)	  ((unsigned char *) (pci)->bits)
5305b261ecSmrg#define FONTINFONPROPS(font)	  (font)->info.nprops
5405b261ecSmrg
5505b261ecSmrg/* some things haven't changed names, but we'll be careful anyway */
5605b261ecSmrg
5705b261ecSmrg#define FONTREFCNT(font)	  (font)->refcnt
5805b261ecSmrg
5905b261ecSmrg/*
6005b261ecSmrg * for linear char sets
6105b261ecSmrg */
6205b261ecSmrg#define N1dChars(pfont)	(FONTLASTCOL(pfont) - FONTFIRSTCOL(pfont) + 1)
6305b261ecSmrg
6405b261ecSmrg/*
6505b261ecSmrg * for 2D char sets
6605b261ecSmrg */
6705b261ecSmrg#define N2dChars(pfont)	(N1dChars(pfont) * \
6805b261ecSmrg			 (FONTLASTROW(pfont) - FONTFIRSTROW(pfont) + 1))
6905b261ecSmrg
7005b261ecSmrg#ifndef GLYPHPADBYTES
7105b261ecSmrg#define GLYPHPADBYTES -1
7205b261ecSmrg#endif
7305b261ecSmrg
7405b261ecSmrg#if GLYPHPADBYTES == 0 || GLYPHPADBYTES == 1
7505b261ecSmrg#define	GLYPHWIDTHBYTESPADDED(pci)	(GLYPHWIDTHBYTES(pci))
7605b261ecSmrg#define	PADGLYPHWIDTHBYTES(w)		(((w)+7)>>3)
7705b261ecSmrg#endif
7805b261ecSmrg
7905b261ecSmrg#if GLYPHPADBYTES == 2
8005b261ecSmrg#define	GLYPHWIDTHBYTESPADDED(pci)	((GLYPHWIDTHBYTES(pci)+1) & ~0x1)
8105b261ecSmrg#define	PADGLYPHWIDTHBYTES(w)		(((((w)+7)>>3)+1) & ~0x1)
8205b261ecSmrg#endif
8305b261ecSmrg
8405b261ecSmrg#if GLYPHPADBYTES == 4
8505b261ecSmrg#define	GLYPHWIDTHBYTESPADDED(pci)	((GLYPHWIDTHBYTES(pci)+3) & ~0x3)
8605b261ecSmrg#define	PADGLYPHWIDTHBYTES(w)		(((((w)+7)>>3)+3) & ~0x3)
8705b261ecSmrg#endif
8805b261ecSmrg
8935c4bbdfSmrg#if GLYPHPADBYTES == 8          /* for a cray? */
9005b261ecSmrg#define	GLYPHWIDTHBYTESPADDED(pci)	((GLYPHWIDTHBYTES(pci)+7) & ~0x7)
9105b261ecSmrg#define	PADGLYPHWIDTHBYTES(w)		(((((w)+7)>>3)+7) & ~0x7)
9205b261ecSmrg#endif
9305b261ecSmrg
9435c4bbdfSmrg#endif                          /* DIXFONTSTRUCT_H */
95