home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / g / gs241j11.zip / INCLUDE.SNF / FONT.H < prev    next >
C/C++ Source or Header  |  1992-04-07  |  3KB  |  89 lines

  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.  
  27. #include "servermd.h"
  28.  
  29. #define NullCharInfo ((CharInfoPtr)0)
  30. #define NullFontInfo ((FontInfoPtr)0)
  31. #define LeftToRight 0
  32. #define RightToLeft 1
  33. /*
  34.  * for linear char sets
  35.  */
  36. #define n1dChars(pfi) ((pfi)->lastCol - (pfi)->firstCol + 1)
  37. #define chFirst firstCol    /* usage:  pfi->chFirst */
  38. #define chLast lastCol        /* usage:  pfi->chLast */
  39.  
  40. /*
  41.  * for 2D char sets
  42.  */
  43. #define n2dChars(pfi)    (((pfi)->lastCol - (pfi)->firstCol + 1) * \
  44.              ((pfi)->lastRow - (pfi)->firstRow + 1))
  45.  
  46. #define ADDRXTHISCHARINFO( pf, ch ) \
  47.         ((CharInfoRec *) &((pf)->pCI[(ch) - (pf)->pFI->chFirst]))
  48.  
  49. #define    GLWIDTHPIXELS(pci) \
  50.     ((pci)->metrics.rightSideBearing - (pci)->metrics.leftSideBearing)
  51. #define    GLHEIGHTPIXELS(pci) \
  52.      ((pci)->metrics.ascent + (pci)->metrics.descent)
  53.  
  54.  
  55. #define    GLYPHWIDTHBYTES(pci)    (((GLYPHWIDTHPIXELS(pci))+7) >> 3)
  56. #define    GLYPHHEIGHTPIXELS(pci)    (pci->metrics.ascent + pci->metrics.descent)
  57. #define    GLYPHWIDTHPIXELS(pci)    (pci->metrics.rightSideBearing \
  58.                     - pci->metrics.leftSideBearing)
  59. #define GLWIDTHPADDED( bc)    ((bc+7) & ~0x7)
  60.  
  61. #if GLYPHPADBYTES == 0 || GLYPHPADBYTES == 1
  62. #define    GLYPHWIDTHBYTESPADDED(pci)    (GLYPHWIDTHBYTES(pci))
  63. #define    PADGLYPHWIDTHBYTES(w)        (((w)+7)>>3)
  64. #endif
  65.  
  66. #if GLYPHPADBYTES == 2
  67. #define    GLYPHWIDTHBYTESPADDED(pci)    ((GLYPHWIDTHBYTES(pci)+1) & ~0x1)
  68. #define    PADGLYPHWIDTHBYTES(w)        (((((w)+7)>>3)+1) & ~0x1)
  69. #endif
  70.  
  71. #if GLYPHPADBYTES == 4
  72. #define    GLYPHWIDTHBYTESPADDED(pci)    ((GLYPHWIDTHBYTES(pci)+3) & ~0x3)
  73. #define    PADGLYPHWIDTHBYTES(w)        (((((w)+7)>>3)+3) & ~0x3)
  74. #endif
  75.  
  76. #if GLYPHPADBYTES == 8 /* for a cray? */
  77. #define    GLYPHWIDTHBYTESPADDED(pci)    ((GLYPHWIDTHBYTES(pci)+7) & ~0x7)
  78. #define    PADGLYPHWIDTHBYTES(w)        (((((w)+7)>>3)+7) & ~0x7)
  79. #endif
  80.  
  81. typedef struct _FontProp *FontPropPtr;
  82. typedef struct _CharInfo *CharInfoPtr;
  83. typedef struct _FontInfo *FontInfoPtr;
  84. typedef unsigned int DrawDirection;
  85. typedef struct _ExtentInfo *ExtentInfoPtr;
  86.  
  87.  
  88. #endif /* FONT_H */
  89.