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 / SNFSTRUC.H < prev    next >
C/C++ Source or Header  |  1992-04-07  |  3KB  |  94 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 SNFSTRUCT_H
  25. #define SNFSTRUCT_H 1
  26. #include "font.h"
  27. #include "misc.h"
  28.  
  29. /*
  30.  * This file describes the Server Natural Font format.
  31.  * SNF fonts are both CPU-dependent and frame buffer bit order dependent.
  32.  * This file is used by:
  33.  *    1)  the server, to hold font information read out of font files.
  34.  *    2)  font converters
  35.  *
  36.  * Each font file contains the following
  37.  * data structures, with no padding in-between.
  38.  *
  39.  *    1)  The XFONTINFO structure
  40.  *        hand-padded to a two-short boundary.
  41.  *        maxbounds.byteoffset is the total number of bytes in the
  42.  *            glpyh array
  43.  *        maxbounds.bitOffset is thetotal width of the unpadded font
  44.  *
  45.  *    2)  The XCHARINFO array
  46.  *        indexed directly with character codes, both on disk
  47.  *        and in memory.
  48.  *
  49.  *    3)  Character glyphs
  50.  *        padded in the server-natural way, and
  51.  *        ordered in the device-natural way.
  52.  *        End of glyphs padded to 32-bit boundary.
  53.  *
  54.  *    4)  nProps font properties
  55.  *
  56.  *    5)  a sequence of null-terminated strings, for font properties
  57.  */
  58.  
  59. #define FONT_FILE_VERSION    4
  60.  
  61. typedef struct _FontProp { 
  62.     CARD32    name;        /* offset of string */
  63.     INT32    value;        /* number or offset of string */
  64.     Bool    indirect;    /* value is a string offset */
  65. } FontPropRec;
  66.  
  67. /*
  68.  * the following macro definitions describe a font file image in memory
  69.  */
  70. #define ADDRCharInfoRec( pfi)    \
  71.     ((CharInfoRec *) &(pfi)[1])
  72.  
  73. #define ADDRCHARGLYPHS( pfi)    \
  74.     (((char *) &(pfi)[1]) + BYTESOFCHARINFO(pfi))
  75.  
  76. /*
  77.  * pad out glyphs to a CARD32 boundary
  78.  */
  79. #define ADDRXFONTPROPS( pfi)  \
  80.     ((DIXFontProp *) ((char *)ADDRCHARGLYPHS( pfi) + BYTESOFGLYPHINFO(pfi)))
  81.  
  82. #define ADDRSTRINGTAB( pfi)  \
  83.     ((char *)ADDRXFONTPROPS( pfi) + BYTESOFPROPINFO(pfi))
  84.  
  85. #define    BYTESOFFONTINFO(pfi)    (sizeof(FontInfoRec))
  86. #define BYTESOFCHARINFO(pfi)    (sizeof(CharInfoRec) * n2dChars(pfi))
  87. #define    BYTESOFPROPINFO(pfi)    (sizeof(FontPropRec) * (pfi)->nProps)
  88. #define    BYTESOFSTRINGINFO(pfi)    ((pfi)->lenStrings)
  89. #define    BYTESOFGLYPHINFO(pfi)    (((pfi)->maxbounds.byteOffset+3) & ~0x3)
  90. #define BYTESOFINKINFO(pfi)    (sizeof(CharInfoRec) * (2 + n2dChars(pfi)))
  91.  
  92. #endif /* SNFSTRUCT_H */
  93.  
  94.