|
|
1.1 ! root 1: /*********************************************************** ! 2: Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, ! 3: and the Massachusetts Institute of Technology, Cambridge, Massachusetts. ! 4: ! 5: All Rights Reserved ! 6: ! 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 names of Digital or MIT not be ! 12: used in advertising or publicity pertaining to distribution of the ! 13: software without specific, written prior permission. ! 14: ! 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 ! 21: SOFTWARE. ! 22: ! 23: ******************************************************************/ ! 24: #ifndef FONT_H ! 25: #define FONT_H 1 ! 26: #define FONT_FILE_VERSION 4 ! 27: ! 28: #include "servermd.h" ! 29: ! 30: #define NullCharInfo ((CharInfoPtr)0) ! 31: #define NullFontInfo ((FontInfoPtr)0) ! 32: #define LeftToRight 0 ! 33: #define RightToLeft 1 ! 34: #define BottomToTop 2 ! 35: #define TopToBottom 3 ! 36: /* ! 37: * for linear char sets ! 38: */ ! 39: #define n1dChars(pfi) ((pfi)->lastCol - (pfi)->firstCol + 1) ! 40: #define chFirst firstCol /* usage: pfi->chFirst */ ! 41: #define chLast lastCol /* usage: pfi->chLast */ ! 42: ! 43: /* ! 44: * for 2D char sets ! 45: */ ! 46: #define n2dChars(pfi) (((pfi)->lastCol - (pfi)->firstCol + 1) * \ ! 47: ((pfi)->lastRow - (pfi)->firstRow + 1)) ! 48: ! 49: /* ! 50: * Some macros that font converters and font i/o routines will need. ! 51: */ ! 52: ! 53: #define GLWIDTHPIXELS(pci) \ ! 54: ((pci)->metrics.rightSideBearing - (pci)->metrics.leftSideBearing) ! 55: #define GLHEIGHTPIXELS(pci) \ ! 56: ((pci)->metrics.ascent + (pci)->metrics.descent) ! 57: ! 58: ! 59: /* ! 60: * the following macro definitions describe a font file image in memory ! 61: */ ! 62: #define ADDRCharInfoRec( pfi) \ ! 63: ((CharInfoRec *) &(pfi)[1]) ! 64: ! 65: #define ADDRCHARGLYPHS( pfi) \ ! 66: (((char *) &(pfi)[1]) + BYTESOFCHARINFO(pfi)) ! 67: #define ADDRXTHISCHARINFO( pf, ch ) \ ! 68: ((CharInfoRec *) &((pf)->pCI[ch])) ! 69: ! 70: ! 71: /* ! 72: * pad out glyphs to a CARD32 boundary ! 73: */ ! 74: #define ADDRXFONTPROPS( pfi) \ ! 75: ((DIXFontProp *) ((char *)ADDRCHARGLYPHS( pfi) + BYTESOFGLYPHINFO(pfi))) ! 76: ! 77: #define ADDRSTRINGTAB( pfi) \ ! 78: ((char *)ADDRXFONTPROPS( pfi) + BYTESOFPROPINFO(pfi)) ! 79: ! 80: #define BYTESOFFONTINFO(pfi) (sizeof(FontInfoRec)) ! 81: #define BYTESOFCHARINFO(pfi) (sizeof(CharInfoRec) * n2dChars(pfi)) ! 82: #define BYTESOFPROPINFO(pfi) (sizeof(FontPropRec) * (pfi)->nProps) ! 83: #define BYTESOFSTRINGINFO(pfi) ((pfi)->lenStrings) ! 84: #define BYTESOFGLYPHINFO(pfi) (((pfi)->maxbounds.byteOffset+3) & ~0x3) ! 85: ! 86: #define GLYPHWIDTHBYTES(pci) (((GLYPHWIDTHPIXELS(pci))+7) >> 3) ! 87: #define GLYPHHEIGHTPIXELS(pci) (pci->metrics.ascent + pci->metrics.descent) ! 88: #define GLYPHWIDTHPIXELS(pci) (pci->metrics.rightSideBearing \ ! 89: - pci->metrics.leftSideBearing) ! 90: #define GLWIDTHPADDED( bc) ((bc+7) & ~0x7) ! 91: ! 92: #if GLYPHPADBYTES == 0 || GLYPHPADBYTES == 1 ! 93: #define GLYPHWIDTHBYTESPADDED(pci) (GLYPHWIDTHBYTES(pci)) ! 94: #endif ! 95: ! 96: #if GLYPHPADBYTES == 2 ! 97: #define GLYPHWIDTHBYTESPADDED(pci) ((GLYPHWIDTHBYTES(pci)+1) & ~0x1) ! 98: #endif ! 99: ! 100: #if GLYPHPADBYTES == 4 ! 101: #define GLYPHWIDTHBYTESPADDED(pci) ((GLYPHWIDTHBYTES(pci)+3) & ~0x3) ! 102: #endif ! 103: ! 104: #if GLYPHPADBYTES == 8 /* for a cray? */ ! 105: #define GLYPHWIDTHBYTESPADDED(pci) ((GLYPHWIDTHBYTES(pci)+7) & ~0x7) ! 106: #endif ! 107: ! 108: typedef struct _FontProp *FontPropPtr; ! 109: typedef struct _CharInfo *CharInfoPtr; ! 110: typedef struct _FontInfo *FontInfoPtr; ! 111: typedef unsigned int DrawDirection; ! 112: typedef struct _ExtentInfo *ExtentInfoPtr; ! 113: ! 114: ! 115: #endif /* FONT_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.