home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast.iso / dv_x / dvix.zip / PXL.H < prev    next >
C/C++ Source or Header  |  1992-10-05  |  2KB  |  78 lines

  1. /*
  2.  *    Written by Eric C. Cooper, CMU
  3.  *
  4.  */
  5. /* $Header: /user/bruce/dvix/RCS/pxl.h,v 1.2 1991/11/04 02:04:49 root Exp $ */
  6.  
  7. #define BITS_PER_LONG 32
  8. #define BITS_PER_SHORT 16
  9. #define BITS_PER_BYTE 8
  10.  
  11. #define BYTES_PER_LONG (BITS_PER_LONG/BITS_PER_BYTE)
  12. #define BYTES_PER_SHORT (BITS_PER_SHORT/BITS_PER_BYTE)
  13.  
  14. #define SHORTS_PER_LONG (BITS_PER_LONG/BITS_PER_SHORT)
  15.  
  16. #define ROUNDUP(x,y) (((x)+(y)-1)/(y))
  17.  
  18. /*
  19.  * Raster ops.
  20.  */
  21. #define ROP_CLEAR    0
  22. #define ROP_ERASE    2
  23. #define ROP_COPYREV    3
  24. #define ROP_COPY    12
  25. #define ROP_PAINT    14
  26. #define ROP_FILL    15
  27.  
  28. /*
  29.  * Bitmap structure for raster ops.
  30.  */    
  31. struct bitmap{
  32.     short h, w;        /* height and width in pixels */
  33.     short bytes_wide;    /* scan-line width in bytes */
  34.     char *bits;        /* pointer to the bits */
  35. };
  36.  
  37. #define MAXCHARS 256        /* make 256 for 8 bit characters */
  38. #define MAXPXLCHARS 128
  39. /*
  40.  * Per-character information.
  41.  * There is one of these for each character in a font.
  42.  * All fields are filled in at font definition time,
  43.  * except for the bitmap, which is "faulted in"
  44.  * when the character is first referenced.
  45.  */
  46. struct glyph {
  47.     long addr;        /* address of bitmap in PXL file */
  48.     long dvi_adv;        /* DVI units to move reference point */
  49.     short x, y;        /* x and y offset in pixels */
  50.     struct bitmap bitmap;    /* bitmap for character */
  51.     short pxl_adv;        /* pixels to move reference point */
  52. };
  53.  
  54. /*
  55.  * The layout of a font information block.
  56.  * There is one of these for every loaded font or
  57.  * magnification thereof.
  58.  *
  59.  * Also note the strange units.  The design size is in 1/2^20 point
  60.  * units (also called micro-points), and the individual character widths
  61.  * are in the TFM file in 1/2^20 ems units, i.e. relative to the design size.
  62.  */
  63.  
  64. struct font {
  65.     struct font *next;        /* link to next font info block */
  66.     struct font *prev;        /* link to previous font info block */
  67.     int TeXnumber;            /* font number (in DVI file) */
  68.     int scale;            /* scaled size in DVI units */
  69.     int design;            /* design size in DVI units */
  70.     int pksize;            /* mod for DV/X, MS-DOS (GBP) */
  71.     int size;            /* mod for DV/X, MS-DOS (GBP) */
  72.     char *fontname;            /* PXL file name */
  73.     FILE *file;            /* open PXL file or NULL */
  74.     enum fmt { PxlFormat,PkFormat } format;
  75.     long glyphaddr;
  76.     struct glyph glyph[MAXCHARS];
  77. };
  78.