summaryrefslogtreecommitdiff
path: root/dviware/dvi2pcl/storechar.c
diff options
context:
space:
mode:
Diffstat (limited to 'dviware/dvi2pcl/storechar.c')
-rw-r--r--dviware/dvi2pcl/storechar.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/dviware/dvi2pcl/storechar.c b/dviware/dvi2pcl/storechar.c
new file mode 100644
index 0000000000..ce6ea1841e
--- /dev/null
+++ b/dviware/dvi2pcl/storechar.c
@@ -0,0 +1,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++;
+}