summaryrefslogtreecommitdiff
path: root/dviware/dvi2pcl/storechar.c
blob: ce6ea1841e61f149f1df404ffdb606aba9bd8a82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
 * Does similar things as down_character, but instead of putting
 * the character's pixel pattern in the bitfile it is stored in dynamicaly
 * allocated memory, used for drawing the character in graphic mode. In
 * graphic mode the meaning for x_offset and y_offset is different from
 * downloaded characters and the pixel pattern is stripped off from pending
 * zero bytes in each row.
 */

#include "globals.h"

void storechar(c)
int	c;
{ 
	byte		*q, *p;
	int		i;
	int		width;
	int		height;
	long		length;
	gcharfmt	*g;

	pktopxl(c);
	g = &(*gfont)[c];
	if(landscape) { 
		p = (byte *)rotatechar();
		g->pxl_bytes = width  = (c_height + 7)/8;
		g->pxl_rows  = height = c_width;
		g->x_offset  = height - c_hoffset - 1;
		g->y_offset  = -c_voffset;
	}
	else { 
		p = (byte *) pxlbuffer;
		g->pxl_bytes = width  = (c_width + 7)/8;
		g->pxl_rows  = height = c_height;
		g->x_offset = -c_hoffset;
		g->y_offset = -c_voffset;
	}

	length = height*width;
	g->pxl_pattern = (byte *)malloc(length);
	q = g->pxl_pattern;
	for(i = 0 ; i < length ; i ++)
		*q++ = *p++;
}