home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / printer / dvi2pcl.lha / storechar.c < prev    next >
C/C++ Source or Header  |  1992-11-25  |  1KB  |  45 lines

  1. /*
  2.  * Does similar things as down_character, but instead of putting
  3.  * the character's pixel pattern in the bitfile it is stored in dynamicaly
  4.  * allocated memory, used for drawing the character in graphic mode. In
  5.  * graphic mode the meaning for x_offset and y_offset is different from
  6.  * downloaded characters and the pixel pattern is stripped off from pending
  7.  * zero bytes in each row.
  8.  */
  9.  
  10. #include "globals.h"
  11.  
  12. void storechar(c)
  13. int    c;
  14.     byte        *q, *p;
  15.     int        i;
  16.     int        width;
  17.     int        height;
  18.     long        length;
  19.     gcharfmt    *g;
  20.  
  21.     pktopxl(c);
  22.     g = &(*gfont)[c];
  23.     if(landscape) { 
  24.         p = (byte *)rotatechar();
  25.         g->pxl_bytes = width  = (c_height + 7)/8;
  26.         g->pxl_rows  = height = c_width;
  27.         g->x_offset  = height - c_hoffset - 1;
  28.         g->y_offset  = -c_voffset;
  29.     }
  30.     else { 
  31.         p = (byte *) pxlbuffer;
  32.         g->pxl_bytes = width  = (c_width + 7)/8;
  33.         g->pxl_rows  = height = c_height;
  34.         g->x_offset = -c_hoffset;
  35.         g->y_offset = -c_voffset;
  36.     }
  37.  
  38.     length = height*width;
  39.     g->pxl_pattern = (byte *)malloc(length);
  40.     q = g->pxl_pattern;
  41.     for(i = 0 ; i < length ; i ++)
  42.         *q++ = *p++;
  43. }
  44.