[net.sources.mac] MacDraw to Imagen program, 2 of 2

weber@brand.UUCP (Allan G. Weber) (12/19/85)

Allan Weber
USC Signal and Image Processing Institute
Arpa:	Weber%Brand@USC-ECL
Usenet:	...sdcrdcf!oberon!brand!weber

This is part 2 of 2 of my MacDraw to imPress program for printing MacDraw
pictures on Imagen laser printers.

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	mactext.c
#	patterns.c
#	pxl.h
#	scaletfm.c
#	textimp.c
#	types.h
# This archive created: Wed Dec 18 15:12:23 1985
export PATH; PATH=/bin:$PATH
if test -f 'mactext.c'
then
	echo shar: will not over-write existing file "'mactext.c'"
else
cat << \SHAR_EOF > 'mactext.c'
/*
	This routine is meant to act as an interface between drawimp
	(which knows nothing about how text is done on the Imagen or
	the format of a font file) and the textimp routine (which
	knows nothing about Macintoshs or MacDraw.
	It translates MacDraw font and style numbers into font
	specifications and also does ajustments for the weird way
	that the MacDraw text is placed in the object rectangles.
*/

#include <stdio.h>
#include "drawimp.h"

/* This table and the following constants are used to specify the font
   file names.  The constants should correspond to the strings in "fontname". 
   In other words, fontname[AMR] should be "amr". */
static char *fontname[] = { "amr", "ambx", "amti", "amsy", "ambsy", "ammi" };
#define ANY	-2
#define NONE	-1
#define AMR 	0
#define AMBX	1
#define AMTI	2
#define AMSY	3
#define AMBSY	4
#define AMMI	5
#define DEF_FONT AMR

#define MAX_SIZES   8

/* The following table maps the Mac font sizes into TeX font sizes.  The
   value of "f_size" is combined with the font name from the "fontname"
   array to make a string like "amr10".  The "d_size" and "a_size" fields
   are the "design size" and "at size" for the font in TeX sp units (65536
   sp's to a point) and are used to select the size of font to be used.  The
   d_size is just the f_size * 65536.  The a_size is selected to match one
   of the fonts available on the system.  The routines which find the
   font file will look for a file with a name like "amr10.nnnnpxl", where
   nnnn is the integer result of 
	(a_size / d_size) * (printer_resolution_in_DPI / 200) * 1000.
   The a_size values should be changed to cause the above equation to give
   a result that matches whatever font size is desired for that size of Mac
   font.  The values in the table below were selected to produce characters
   of about the right size on a 300DPI Imagen given the available font
   files.  Since I don't know what fonts are usually around for 240DPI
   devices so I can't tell if any of these values will map to the fonts that
   would be available for that resolution printer.

   TeX does all this in a much cleaner way, but this will do for now.
*/ 
static struct fontsize { 
	int f_size, d_size, a_size;
	int il_size, sp_size, tab_size;
	int shift_down, shift_right;
 } fontsize[MAX_SIZES] = {
	 0,        0,       0,	 0,	 0,	 0,	 0,	 0,
	 9,   589824,  589824,	12,      3,	 6,	 9,	 1, /* 9 */ 
	10,   655360,  655360,	12,	 3,      6,	 9,	 1, /* 10 */ 
	10,   655360,  786432,	16,	 4,	 8,     11,	 1, /* 12 */
	10,   655360,  943718,	19,	 4,	 8,	13,      1, /* 14 */ 
	10,   655360, 1132462,	23,	 6,	12,	16,	 2, /* 18 */
	10,   655360, 1630745,	29,	 8,	16,	20,	 2, /* 24 */
	10,   655360, 2174485,	46,	12,	24,	33,	 2  /* 36 */
 };

/* This table maps Mac font and character codes to TeX font and character
   codes.  The table contains three entries for each Mac character code.
   The entries give the TeX font and character for plain, bold, italic.
   Control characters such as carriage return, tab, and space are in the
   table with a 0x80 added to the ASCII code to flag them so textimp can
   handle them differently. */
static struct fontcode {
	short font;
	short code;
} fontcode[224][3] = {	/* order is: plain, bold, italic */
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	ANY,	0x89,	ANY,	0x89,	ANY,	0x89,	/* 09 tab */
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	ANY,	0x8D,	ANY,	0x8D,	ANY,	0x8D,	/* 0D carriage ret */
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	

	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	

	ANY,	0xA0,	ANY,	0xA0,	ANY,	0xA0,	/* 20 space */
	AMR,	0041,	AMBX,	0041,	AMTI,	0041,	/* 21 ! */
	AMR,	0175,	AMBX,	0175,	AMTI,	0175,	/* 22 " */
	AMR,	0043,	AMBX,	0043,	AMTI,	0043,	/* 23 # */
	AMR,	0044,	AMBX,	0044,	AMTI,	0044,	/* 24 $ */
	AMR,	0045,	AMBX,	0045,	AMTI,	0045,	/* 25 % */
	AMR,	0046,	AMBX,	0046,	AMTI,	0046,	/* 26 & */
	AMR,	0023,	AMBX,	0023,	AMTI,	0023,	/* 27 ' */
	AMR,	0050,	AMBX,	0050,	AMTI,	0050,	/* 28 ( */
	AMR,	0051,	AMBX,	0051,	AMTI,	0051,	/* 29 ) */
	AMR,	0052,	AMBX,	0052,	AMTI,	0052,	/* 2A * */
	AMR,	0053,	AMBX,	0053,	AMTI,	0053,	/* 2B + */
	AMR,	0054,	AMBX,	0054,	AMTI,	0054,	/* 2C , */
	AMR,	0055,	AMBX,	0055,	AMTI,	0055,	/* 2D - */
	AMR,	0056,	AMBX,	0056,	AMTI,	0056,	/* 2E . */
	AMR,	0057,	AMBX,	0057,	AMTI,	0057,	/* 2F / */

	AMR,	0060,	AMBX,	0060,	AMTI,	0060,	/* 30 0 */
	AMR,	0061,	AMBX,	0061,	AMTI,	0061,	/* 31 1 */
	AMR,	0062,	AMBX,	0062,	AMTI,	0062,	/* 32 2 */
	AMR,	0063,	AMBX,	0063,	AMTI,	0063,	/* 33 3 */
	AMR,	0064,	AMBX,	0064,	AMTI,	0064,	/* 34 4 */
	AMR,	0065,	AMBX,	0065,	AMTI,	0065,	/* 35 5 */
	AMR,	0066,	AMBX,	0066,	AMTI,	0066,	/* 36 6 */
	AMR,	0067,	AMBX,	0067,	AMTI,	0067,	/* 37 7 */
	AMR,	0070,	AMBX,	0070,	AMTI,	0070,	/* 38 8 */
	AMR,	0071,	AMBX,	0071,	AMTI,	0071,	/* 39 9 */
	AMR,	0072,	AMBX,	0072,	AMTI,	0072,	/* 3A : */
	AMR,	0073,	AMBX,	0073,	AMTI,	0073,	/* 3B ; */
	AMMI,	0074,	AMMI,	0074,	AMMI,	0074,	/* 3C < */
	AMR,	0075,	AMBX,	0075,	AMTI,	0075,	/* 3D = */
	AMMI,	0076,	AMMI,	0076,	AMMI,	0076,	/* 3E > */
	AMR,	0077,	AMBX,	0077,	AMTI,	0077,	/* 3F ? */

	AMR,	0100,	AMBX,	0100,	AMTI,	0100,	/* 40 @ */
	AMR,	0101,	AMBX,	0101,	AMTI,	0101,	/* 41 A */
	AMR,	0102,	AMBX,	0102,	AMTI,	0102,	/* 42 B */
	AMR,	0103,	AMBX,	0103,	AMTI,	0103,	/* 43 C */
	AMR,	0104,	AMBX,	0104,	AMTI,	0104,	/* 44 D */
	AMR,	0105,	AMBX,	0105,	AMTI,	0105,	/* 45 E */
	AMR,	0106,	AMBX,	0106,	AMTI,	0106,	/* 46 F */
	AMR,	0107,	AMBX,	0107,	AMTI,	0107,	/* 47 G */
	AMR,	0110,	AMBX,	0110,	AMTI,	0110,	/* 48 H */
	AMR,	0111,	AMBX,	0111,	AMTI,	0111,	/* 49 I */
	AMR,	0112,	AMBX,	0112,	AMTI,	0112,	/* 4A J */
	AMR,	0113,	AMBX,	0113,	AMTI,	0113,	/* 4B K */
	AMR,	0114,	AMBX,	0114,	AMTI,	0114,	/* 4C L */
	AMR,	0115,	AMBX,	0115,	AMTI,	0115,	/* 4D M */
	AMR,	0116,	AMBX,	0116,	AMTI,	0116,	/* 4E N */
	AMR,	0117,	AMBX,	0117,	AMTI,	0117,	/* 4F O */

	AMR,	0120,	AMBX,	0120,	AMTI,	0120,	/* 50 P */
	AMR,	0121,	AMBX,	0121,	AMTI,	0121,	/* 51 Q */
	AMR,	0122,	AMBX,	0122,	AMTI,	0122,	/* 52 R */
	AMR,	0123,	AMBX,	0123,	AMTI,	0123,	/* 53 S */
	AMR,	0124,	AMBX,	0124,	AMTI,	0124,	/* 54 T */
	AMR,	0125,	AMBX,	0125,	AMTI,	0125,	/* 55 U */
	AMR,	0126,	AMBX,	0126,	AMTI,	0126,	/* 56 V */
	AMR,	0127,	AMBX,	0127,	AMTI,	0127,	/* 57 W */
	AMR,	0130,	AMBX,	0130,	AMTI,	0130,	/* 58 X */
	AMR,	0131,	AMBX,	0131,	AMTI,	0131,	/* 59 Y */
	AMR,	0132,	AMBX,	0132,	AMTI,	0132,	/* 5A Z */
	AMR,	0133,	AMBX,	0133,	AMTI,	0133,	/* 5B [ */
	AMSY,	0156,	AMBSY,	0156,	AMSY,	0156,	/* 5C \ */
	AMR,	0135,	AMBX,	0135,	AMTI,	0135,	/* 5D ] */
	AMR,	0136,	AMBX,	0136,	AMTI,	0136,	/* 5E ^ */
	NONE,	0,	NONE,	0,	NONE,	0,	/* 5F _ */

	AMR,	0022,	AMBX,	0022,	AMTI,	0022,	/* 60 ` */
	AMR,	0141,	AMBX,	0141,	AMTI,	0141,	/* 61 a */
	AMR,	0142,	AMBX,	0142,	AMTI,	0142,	/* 62 b */
	AMR,	0143,	AMBX,	0143,	AMTI,	0143,	/* 63 c */
	AMR,	0144,	AMBX,	0144,	AMTI,	0144,	/* 64 d */
	AMR,	0145,	AMBX,	0145,	AMTI,	0145,	/* 65 e */
	AMR,	0146,	AMBX,	0146,	AMTI,	0146,	/* 66 f */
	AMR,	0147,	AMBX,	0147,	AMTI,	0147,	/* 67 g */
	AMR,	0150,	AMBX,	0150,	AMTI,	0150,	/* 68 h */
	AMR,	0151,	AMBX,	0151,	AMTI,	0151,	/* 69 i */
	AMR,	0152,	AMBX,	0152,	AMTI,	0152,	/* 6A j */
	AMR,	0153,	AMBX,	0153,	AMTI,	0153,	/* 6B k */
	AMR,	0154,	AMBX,	0154,	AMTI,	0154,	/* 6C l */
	AMR,	0155,	AMBX,	0155,	AMTI,	0155,	/* 6D m */
	AMR,	0156,	AMBX,	0156,	AMTI,	0156,	/* 6E n */
	AMR,	0157,	AMBX,	0157,	AMTI,	0157,	/* 6F o */

	AMR,	0160,	AMBX,	0160,	AMTI,	0160,	/* 70 p */
	AMR,	0161,	AMBX,	0161,	AMTI,	0161,	/* 71 q */
	AMR,	0162,	AMBX,	0162,	AMTI,	0162,	/* 72 r */
	AMR,	0163,	AMBX,	0163,	AMTI,	0163,	/* 73 s */
	AMR,	0164,	AMBX,	0164,	AMTI,	0164,	/* 74 t */
	AMR,	0165,	AMBX,	0165,	AMTI,	0165,	/* 75 u */
	AMR,	0166,	AMBX,	0166,	AMTI,	0166,	/* 76 v */
	AMR,	0167,	AMBX,	0167,	AMTI,	0167,	/* 77 w */
	AMR,	0170,	AMBX,	0170,	AMTI,	0170,	/* 78 x */
	AMR,	0171,	AMBX,	0171,	AMTI,	0171,	/* 79 y */
	AMR,	0172,	AMBX,	0172,	AMTI,	0172,	/* 7A z */
	AMSY,	0146,	AMBSY,	0146,	AMSY,	0146,	/* 7B { */
	AMSY,	0152,	AMBSY,	0152,	AMSY,	0152,	/* 7C | */
	AMSY,	0147,	AMBSY,	0147,	AMSY,	0147,	/* 7D } */
	AMR,	0176,	AMBX,	0176,	AMTI,	0176,	/* 7E ~ */
	NONE,	0,	NONE,	0,	NONE,	0,	/* 7F  */

	/* the next two groups (0x8* and 0x9*) are letters with things
	above or below them, like accent marks.  For now, just output
	the letter without the extra mark */

	AMR,	0101,	AMBX,	0101,	AMTI,	0101,	/* 80 A */
	AMR,	0101,	AMBX,	0101,	AMTI,	0101,	/* 81 A */
	AMR,	0103,	AMBX,	0103,	AMTI,	0103,	/* 82 C */
	AMR,	0105,	AMBX,	0105,	AMTI,	0105,	/* 83 E */
	AMR,	0116,	AMBX,	0116,	AMTI,	0116,	/* 84 N */
	AMR,	0117,	AMBX,	0117,	AMTI,	0117,	/* 85 O */
	AMR,	0125,	AMBX,	0125,	AMTI,	0125,	/* 86 U */
	AMR,	0141,	AMBX,	0141,	AMTI,	0141,	/* 87 a */
	AMR,	0141,	AMBX,	0141,	AMTI,	0141,	/* 88 a */
	AMR,	0141,	AMBX,	0141,	AMTI,	0141,	/* 89 a */
	AMR,	0141,	AMBX,	0141,	AMTI,	0141,	/* 8A a */
	AMR,	0141,	AMBX,	0141,	AMTI,	0141,	/* 8B a */
	AMR,	0141,	AMBX,	0141,	AMTI,	0141,	/* 8C a */
	AMR,	0143,	AMBX,	0143,	AMTI,	0143,	/* 8D c */
	AMR,	0145,	AMBX,	0145,	AMTI,	0145,	/* 8E e */
	AMR,	0145,	AMBX,	0145,	AMTI,	0145,	/* 8F e */

	AMR,	0145,	AMBX,	0145,	AMTI,	0145,	/* 90 e */
	AMR,	0145,	AMBX,	0145,	AMTI,	0145,	/* 91 e */
	AMR,	0151,	AMBX,	0151,	AMTI,	0151,	/* 92 i */
	AMR,	0151,	AMBX,	0151,	AMTI,	0151,	/* 93 i */
	AMR,	0151,	AMBX,	0151,	AMTI,	0151,	/* 94 i */
	AMR,	0151,	AMBX,	0151,	AMTI,	0151,	/* 95 i */
	AMR,	0156,	AMBX,	0156,	AMTI,	0156,	/* 96 n */
	AMR,	0157,	AMBX,	0157,	AMTI,	0157,	/* 97 o */
	AMR,	0157,	AMBX,	0157,	AMTI,	0157,	/* 98 o */
	AMR,	0157,	AMBX,	0157,	AMTI,	0157,	/* 99 o */
	AMR,	0157,	AMBX,	0157,	AMTI,	0157,	/* 9A o */
	AMR,	0157,	AMBX,	0157,	AMTI,	0157,	/* 9B o */
	AMR,	0165,	AMBX,	0165,	AMTI,	0165,	/* 9C u */
	AMR,	0165,	AMBX,	0165,	AMTI,	0165,	/* 9D u */
	AMR,	0165,	AMBX,	0165,	AMTI,	0165,	/* 9E u */
	AMR,	0165,	AMBX,	0165,	AMTI,	0165,	/* 9F u */

	AMSY,	0171,	AMBSY,	0171,	AMSY,	0171,	/* A0 dagger */
	AMR,	0027,	AMBX,	0027,	AMTI,	0027,	/* A1 degree */
	NONE,	0,	NONE,	0,	NONE,	0,	/* A2 cents */
	AMTI,	0044,	AMTI,	0044,	AMTI,	0044,	/* A3 British pound */
	AMSY,	0170,	AMBSY,	0170,	AMSY,	0170,	/* A4 ?? */
	AMSY,	0017,	AMBSY,	0017,	AMSY,	0017,	/* A5 filled dot */
	AMSY,	0173,	AMBSY,	0173,	AMSY,	0173,	/* A6 paragraph */
	AMR,	0031,	AMBX,	0031,	AMTI,	0031,	/* A7 ?? */
	NONE,	0,	NONE,	0,	NONE,	0,	/* A8 registered */
	NONE,	0,	NONE,	0,	NONE,	0,	/* A9 copyright */
	NONE,	0,	NONE,	0,	NONE,	0,	/* AA trademark */
	AMR,	0023,	AMBX,	0023,	AMTI,	0023,	/* AB accent */
	AMR,	0177,	AMBX,	0177,	AMTI,	0177,	/* AC two dots */
	NONE,	0,	NONE,	0,	NONE,	0,	/* AD not equal */
	AMR,	0035,	AMBX,	0035,	AMTI,	0035,	/* AE AE */
	AMR,	0037,	AMBX,	0037,	AMTI,	0037,	/* AF O with slash */

	AMSY,	0061,	AMBSY,	0061,	AMSY,	0061,	/* B0 infinity */
	AMSY,	0006,	AMBSY,	0006,	AMSY,	0006,	/* B1 plus-minus */
	AMSY,	0024,	AMBSY,	0024,	AMSY,	0024,	/* B2 <= */
	AMSY,	0025,	AMBSY,	0025,	AMSY,	0025,	/* B3 >= */
	NONE,	0,	NONE,	0,	NONE,	0,	/* B4 ?? */
	AMMI,	0026,	AMMI,	0026,	AMMI,	0026,	/* B5 mu */
	NONE,	0,	NONE,	0,	NONE,	0,	/* B6 ?? */
	AMR,	0006,	AMBX,	0006,	AMTI,	0006,	/* B7 Sigma */
	AMR,	0005,	AMBX,	0005,	AMTI,	0005,	/* B8 Pi */
	AMMI,	0031,	AMMI,	0031,	AMMI,	0031,	/* B9 pi */
	AMSY,	0163,	AMBSY,	0163,	AMSY,	0163,	/* BA integral */
	NONE,	0,	NONE,	0,	NONE,	0,	/* BB ?? */
	NONE,	0,	NONE,	0,	NONE,	0,	/* BC ?? */
	AMR,	0012,	AMBX,	0012,	AMTI,	0012,	/* BD Omega */
	AMR,	0032,	AMBX,	0032,	AMTI,	0032,	/* BE ae */
	AMR,	0034,	AMBX,	0034,	AMTI,	0034,	/* BF o with slash */

	AMR,	0076,	AMBX,	0076,	AMTI,	0076,	/* C0 ? upside down */
	AMR,	0074,	AMBX,	0074,	AMTI,	0074,	/* C1 ! upside down */
	AMSY,	0072,	AMBSY,	0072,	AMSY,	0072,	/* C2 not */
	AMSY,	0160,	AMBSY,	0160,	AMSY,	0160,	/* C3 radical */
	NONE,	0,	NONE,	0,	NONE,	0,	/* C4 ?? */
	AMSY,	0031,	AMBSY,	0031,	AMSY,	0031,	/* C5 approx. equal */
	AMSY,	0064,	AMBSY,	0064,	AMSY,	0064,	/* C6 triangle */
	AMSY,	0034,	AMBSY,	0034,	AMSY,	0034,	/* C7 << */
	AMSY,	0035,	AMBSY,	0035,	AMSY,	0035,	/* C8 >> */
	NONE,	0,	NONE,	0,	NONE,	0,	/* C9 ellipsis */
	NONE,	0,	NONE,	0,	NONE,	0,	/* CA non-brea. sp. */
	NONE,	0,	NONE,	0,	NONE,	0,
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	

	AMR,	0173,	AMBX,	0173,	AMTI,	0173,	/* D0 n-dash */
	AMR,	0174,	AMBX,	0174,	AMTI,	0174,	/* D1 m-dash */
	AMR,	0134,	AMBX,	0134,	AMTI,	0134,	/* D2 open quotes */
	AMR,	0042,	AMBX,	0042,	AMTI,	0042,	/* D3 close quotes */
	AMR,	0140,	AMBX,	0140,	AMTI,	0140,	/* D4 open quote */
	AMR,	0047,	AMBX,	0047,	AMTI,	0047,	/* D5 close quote */
	AMSY,	0004,	AMBSY,	0004,	AMSY,	0004,	/* D6 divide */
	AMSY,	0005,	AMBSY,	0005,	AMSY,	0005,	/* D7 diamond */
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	
	NONE,	0,	NONE,	0,	NONE,	0,	

};
#define MAX_CHAR (sizeof(fontcode) / sizeof(struct fontcode))

int il_size, sp_size, tab_size;
static init = 0;
static char fontspec[40];
extern char *malloc();

mactext(s,startv,starth,style,font,size,spacing,align,angle)
char *s;
int startv,starth,style,font,size,spacing,align,angle;
{
	int id, i, v, h, cur_font, new_line;
	struct fontsize *fs;
	struct fontcode *fc;
	char *p, *b;
	if (init == 0) {
		fs = fontsize;	/* change things to Imagen units */
		for (i = 0; i <= MAX_SIZES; i++) {
			fs->il_size     = md2im(fs->il_size);
			fs->sp_size     = md2im(fs->sp_size);
			fs->tab_size    = md2im(fs->tab_size);
			fs->shift_down  = md2im(fs->shift_down);
			fs->shift_right = md2im(fs->shift_right);
			fs++;
		}
		init = 1;
	}
	if (size > 7)
		size = 7;
	fs = &fontsize[size];
	il_size = fs->il_size;
	sp_size = fs->sp_size;
	tab_size= fs->tab_size;
	v = startv + fs->shift_down;
	h = starth + fs->shift_right;
/*	fprintf(stderr,"startv=%d, starth=%d, size=%d, v=%d, h=%d\n",
		startv, starth, size, v, h); */
	if (style > 2)		/* only plain, bold, and italic */
		style = 0;	/* anything else is plain */
	b = malloc(strlen(s) + 1);
	new_line = 1;
	while (*s != '\0') {
		p = b;
		cur_font = NONE;
		while (*s != '\0') {
			i = *s & 0377;
			if (i >= MAX_CHAR)
				i = 0;
			fc = &fontcode[i][style];
			if (cur_font == NONE && fc->font != ANY)
				cur_font = fc->font;
			if (fc->font != ANY && fc->font != NONE &&
			    cur_font != fc->font)
				break;	/* changed fonts */
			if (fc->font != NONE)
				*p++ = fc->code;
			s++;
		}
		*p = '\0';
		if (cur_font == NONE)
			cur_font = DEF_FONT;
		sprintf(fontspec,"%s%d",fontname[cur_font],fs->f_size);
/*		fprintf(stderr,"%s %s\n",fontspec,b); */
		id = selectfont(fontspec, fs->a_size, fs->d_size);
		textimp(b,v,h,new_line);
		new_line = 0;	/* make textimp leave position as is */
	}
}
SHAR_EOF
fi # end of overwriting check
if test -f 'patterns.c'
then
	echo shar: will not over-write existing file "'patterns.c'"
else
cat << \SHAR_EOF > 'patterns.c'
char pattern[37][128] = {
	{						/* 00 (not used) */
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00	},
	{							/* 01 */
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00	},
	{							/* 02 */
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
	{							/* 03 */
		0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
		0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
		0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
		0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
		0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
		0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
		0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
		0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
		0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
		0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
		0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
		0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
		0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
		0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
		0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
		0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff },
	{							/* 04 */
		0xdd,0xdd,0xdd,0xdd,0x77,0x77,0x77,0x77,
		0xdd,0xdd,0xdd,0xdd,0x77,0x77,0x77,0x77,
		0xdd,0xdd,0xdd,0xdd,0x77,0x77,0x77,0x77,
		0xdd,0xdd,0xdd,0xdd,0x77,0x77,0x77,0x77,
		0xdd,0xdd,0xdd,0xdd,0x77,0x77,0x77,0x77,
		0xdd,0xdd,0xdd,0xdd,0x77,0x77,0x77,0x77,
		0xdd,0xdd,0xdd,0xdd,0x77,0x77,0x77,0x77,
		0xdd,0xdd,0xdd,0xdd,0x77,0x77,0x77,0x77,
		0xdd,0xdd,0xdd,0xdd,0x77,0x77,0x77,0x77,
		0xdd,0xdd,0xdd,0xdd,0x77,0x77,0x77,0x77,
		0xdd,0xdd,0xdd,0xdd,0x77,0x77,0x77,0x77,
		0xdd,0xdd,0xdd,0xdd,0x77,0x77,0x77,0x77,
		0xdd,0xdd,0xdd,0xdd,0x77,0x77,0x77,0x77,
		0xdd,0xdd,0xdd,0xdd,0x77,0x77,0x77,0x77,
		0xdd,0xdd,0xdd,0xdd,0x77,0x77,0x77,0x77,
		0xdd,0xdd,0xdd,0xdd,0x77,0x77,0x77,0x77	},
	{							/* 05 */
		0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,
		0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,
		0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,
		0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,
		0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,
		0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,
		0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,
		0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,
		0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,
		0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,
		0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,
		0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,
		0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,
		0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,
		0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55,
		0xaa,0xaa,0xaa,0xaa,0x55,0x55,0x55,0x55	},
	{							/* 06 */
		0x88,0x88,0x88,0x88,0x22,0x22,0x22,0x22,
		0x88,0x88,0x88,0x88,0x22,0x22,0x22,0x22,
		0x88,0x88,0x88,0x88,0x22,0x22,0x22,0x22,
		0x88,0x88,0x88,0x88,0x22,0x22,0x22,0x22,
		0x88,0x88,0x88,0x88,0x22,0x22,0x22,0x22,
		0x88,0x88,0x88,0x88,0x22,0x22,0x22,0x22,
		0x88,0x88,0x88,0x88,0x22,0x22,0x22,0x22,
		0x88,0x88,0x88,0x88,0x22,0x22,0x22,0x22,
		0x88,0x88,0x88,0x88,0x22,0x22,0x22,0x22,
		0x88,0x88,0x88,0x88,0x22,0x22,0x22,0x22,
		0x88,0x88,0x88,0x88,0x22,0x22,0x22,0x22,
		0x88,0x88,0x88,0x88,0x22,0x22,0x22,0x22,
		0x88,0x88,0x88,0x88,0x22,0x22,0x22,0x22,
		0x88,0x88,0x88,0x88,0x22,0x22,0x22,0x22,
		0x88,0x88,0x88,0x88,0x22,0x22,0x22,0x22,
		0x88,0x88,0x88,0x88,0x22,0x22,0x22,0x22	},
	{							/* 07 */
		0x88,0x88,0x88,0x88,0x00,0x00,0x00,0x00,
		0x22,0x22,0x22,0x22,0x00,0x00,0x00,0x00,
		0x88,0x88,0x88,0x88,0x00,0x00,0x00,0x00,
		0x22,0x22,0x22,0x22,0x00,0x00,0x00,0x00,
		0x88,0x88,0x88,0x88,0x00,0x00,0x00,0x00,
		0x22,0x22,0x22,0x22,0x00,0x00,0x00,0x00,
		0x88,0x88,0x88,0x88,0x00,0x00,0x00,0x00,
		0x22,0x22,0x22,0x22,0x00,0x00,0x00,0x00,
		0x88,0x88,0x88,0x88,0x00,0x00,0x00,0x00,
		0x22,0x22,0x22,0x22,0x00,0x00,0x00,0x00,
		0x88,0x88,0x88,0x88,0x00,0x00,0x00,0x00,
		0x22,0x22,0x22,0x22,0x00,0x00,0x00,0x00,
		0x88,0x88,0x88,0x88,0x00,0x00,0x00,0x00,
		0x22,0x22,0x22,0x22,0x00,0x00,0x00,0x00,
		0x88,0x88,0x88,0x88,0x00,0x00,0x00,0x00,
		0x22,0x22,0x22,0x22,0x00,0x00,0x00,0x00	},
	{							/* 08 */
		0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,
		0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00,
		0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,
		0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00,
		0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,
		0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00,
		0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,
		0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00,
		0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,
		0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00,
		0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,
		0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00,
		0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,
		0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00,
		0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,
		0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00	},
	{							/* 09 */
		0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00	},
	{							/* 10 */
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x40,0x00,0x00,0x01,0x40,0x00,0x00,0x01,
		0x40,0x00,0x00,0x01,0x20,0x00,0x00,0x02,
		0x20,0x00,0x00,0x02,0x10,0x00,0x00,0x04,
		0x10,0x00,0x00,0x04,0x08,0x00,0x00,0x08,
		0x06,0x00,0x00,0x30,0x01,0x80,0x00,0xC0,
		0x00,0x70,0x07,0x00,0x00,0x0F,0xF8,0x00,
		0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,
		0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,
		0x00,0x01,0x40,0x00,0x00,0x01,0x40,0x00,
		0x00,0x01,0x40,0x00,0x00,0x02,0x20,0x00,
		0x00,0x02,0x20,0x00,0x00,0x04,0x10,0x00,
		0x00,0x04,0x10,0x00,0x00,0x08,0x08,0x00,
		0x00,0x30,0x06,0x00,0x00,0xC0,0x01,0x80,
		0x07,0x00,0x00,0x70,0xF8,0x00,0x00,0x0F },
	{							/* 11 */
		0xff,0xff,0xff,0xff,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0xff,0xff,0xff,0xff,0x00,0x00,0x80,0x00,
		0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,
		0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,
		0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,
		0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,
		0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,
		0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,
		0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00 },
	{							/* 12 */
		0x00,0x01,0x80,0x00,0x00,0x02,0x40,0x00,
		0x00,0x04,0x20,0x00,0x00,0x08,0x10,0x00,
		0x00,0x10,0x08,0x00,0x00,0x20,0x04,0x00,
		0x00,0x40,0x02,0x00,0x00,0x80,0x01,0x00,
		0x01,0x00,0x00,0x80,0x02,0x00,0x00,0x40,
		0x04,0x00,0x00,0x20,0x08,0x00,0x00,0x10,
		0x10,0x00,0x00,0x08,0x20,0x00,0x00,0x04,
		0x40,0x00,0x00,0x02,0x80,0x00,0x00,0x01,
		0x00,0x01,0x80,0x00,0x00,0x02,0x40,0x00,
		0x00,0x04,0x20,0x00,0x00,0x08,0x10,0x00,
		0x00,0x10,0x08,0x00,0x00,0x20,0x04,0x00,
		0x00,0x40,0x02,0x00,0x00,0x80,0x01,0x00,
		0x01,0x00,0x00,0x80,0x02,0x00,0x00,0x40,
		0x04,0x00,0x00,0x20,0x08,0x00,0x00,0x10,
		0x10,0x00,0x00,0x08,0x20,0x00,0x00,0x04,
		0x40,0x00,0x00,0x02,0x80,0x00,0x00,0x01 },
	{							/* 13 */
		0x80,0x00,0x00,0x00,0x40,0x00,0x00,0x00,
		0x20,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
		0x08,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
		0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
		0x00,0x80,0x00,0x00,0x00,0x40,0x00,0x00,
		0x00,0x20,0x00,0x00,0x00,0x10,0x00,0x00,
		0x00,0x08,0x00,0x00,0x00,0x04,0x00,0x00,
		0x00,0x02,0x00,0x00,0x00,0x01,0x00,0x00,
		0x00,0x00,0x80,0x00,0x00,0x00,0x40,0x00,
		0x00,0x00,0x20,0x00,0x00,0x00,0x10,0x00,
		0x00,0x00,0x08,0x00,0x00,0x00,0x04,0x00,
		0x00,0x00,0x02,0x00,0x00,0x00,0x01,0x00,
		0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x40,
		0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x10,
		0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x04,
		0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x01	},
	{							/* 14 */
		0xff,0xf0,0x00,0x00,0x7f,0xf8,0x00,0x00,
		0x3f,0xfc,0x00,0x00,0x1f,0xfe,0x00,0x00,
		0x0f,0xff,0x00,0x00,0x07,0xff,0x80,0x00,
		0x03,0xff,0xc0,0x00,0x01,0xff,0xe0,0x00,
		0x00,0xff,0xf0,0x00,0x00,0x7f,0xf8,0x00,
		0x00,0x3f,0xfc,0x00,0x00,0x1f,0xfe,0x00,
		0x00,0x0f,0xff,0x00,0x00,0x07,0xff,0x80,
		0x00,0x03,0xff,0xc0,0x00,0x01,0xff,0xe0,
		0x00,0x00,0xff,0xf0,0x00,0x00,0x7f,0xf8,
		0x00,0x00,0x3f,0xfc,0x00,0x00,0x1f,0xfe,
		0x00,0x00,0x0f,0xff,0x80,0x00,0x07,0xff,
		0xc0,0x00,0x03,0xff,0xe0,0x00,0x01,0xfd,
		0xf0,0x00,0x00,0xff,0xf8,0x00,0x00,0x7f,
		0xfc,0x00,0x00,0x3f,0xfe,0x00,0x00,0x1f,
		0xff,0x00,0x00,0x0f,0xff,0x80,0x00,0x07,
		0xff,0xc0,0x00,0x03,0xff,0xe0,0x00,0x01 },
	{							/* 15 */
		0xff,0xf0,0xff,0xf0,0x7f,0xf8,0x7f,0xf8,
		0x3f,0xfc,0x3f,0xfc,0x1f,0xfe,0x1f,0xfe,
		0x0f,0xff,0x0f,0xff,0x87,0xff,0x87,0xff,
		0xc3,0xff,0xc3,0xff,0xe1,0xff,0xe1,0xff,
		0xf0,0xff,0xf0,0xff,0xf8,0x7f,0xf8,0x7f,
		0xfc,0x3f,0xfc,0x3f,0xfe,0x1f,0xfe,0x1f,
		0xff,0x0f,0xff,0x0f,0xff,0x87,0xff,0x87,
		0xff,0xc3,0xff,0xc3,0xff,0xe1,0xff,0xe1,
		0xff,0xf0,0xff,0xf0,0x7f,0xf8,0x7f,0xf8,
		0x3f,0xfc,0x3f,0xfc,0x1f,0xfe,0x1f,0xfe,
		0x0f,0xff,0x0f,0xff,0x87,0xff,0x87,0xff,
		0xc3,0xff,0xc3,0xff,0xe1,0xff,0xe1,0xff,
		0xf0,0xff,0xf0,0xff,0xf8,0x7f,0xf8,0x7f,
		0xfc,0x3f,0xfc,0x3f,0xfe,0x1f,0xfe,0x1f,
		0xff,0x0f,0xff,0x0f,0xff,0x87,0xff,0x87,
		0xff,0xc3,0xff,0xc3,0xff,0xe1,0xff,0xe1 },
	{							/* 16 */
		0x80,0x00,0x80,0x00,0x40,0x00,0x40,0x00,
		0x20,0x00,0x20,0x00,0x10,0x00,0x10,0x00,
		0x08,0x00,0x08,0x00,0x04,0x00,0x04,0x00,
		0x02,0x00,0x02,0x00,0x01,0x00,0x01,0x00,
		0x00,0x80,0x00,0x80,0x00,0x40,0x00,0x40,
		0x00,0x20,0x00,0x20,0x00,0x10,0x00,0x10,
		0x00,0x08,0x00,0x08,0x00,0x04,0x00,0x04,
		0x00,0x02,0x00,0x02,0x00,0x01,0x00,0x01,
		0x80,0x00,0x80,0x00,0x40,0x00,0x40,0x00,
		0x20,0x00,0x20,0x00,0x10,0x00,0x10,0x00,
		0x08,0x00,0x08,0x00,0x04,0x00,0x04,0x00,
		0x02,0x00,0x02,0x00,0x01,0x00,0x01,0x00,
		0x00,0x80,0x00,0x80,0x00,0x40,0x00,0x40,
		0x00,0x20,0x00,0x20,0x00,0x10,0x00,0x10,
		0x00,0x08,0x00,0x08,0x00,0x04,0x00,0x04,
		0x00,0x02,0x00,0x02,0x00,0x01,0x00,0x01 },
	{							/* 17 */
		0xff,0x00,0xff,0x00,0x7f,0x80,0x7f,0x80,
		0x3f,0xc0,0x3f,0xc0,0x1f,0xe0,0x1f,0xe0,
		0x0f,0xf0,0x0f,0xf0,0x07,0xf8,0x07,0xf8,
		0x03,0xfc,0x03,0xfc,0x01,0xfe,0x01,0xfe,
		0x00,0xff,0x00,0xff,0x80,0x7f,0x80,0x7f,
		0xc0,0x3f,0xc0,0x3f,0xe0,0x1f,0xe0,0x1f,
		0xf0,0x0f,0xf0,0x0f,0xf8,0x07,0xf8,0x07,
		0xfc,0x03,0xfc,0x03,0xfe,0x01,0xfe,0x01,
		0xff,0x00,0xff,0x00,0x7f,0x80,0x7f,0x80,
		0x3f,0xc0,0x3f,0xc0,0x1f,0xe0,0x1f,0xe0,
		0x0f,0xf0,0x0f,0xf0,0x07,0xf8,0x07,0xf8,
		0x03,0xfc,0x03,0xfc,0x01,0xfe,0x01,0xfe,
		0x00,0xff,0x00,0xff,0x80,0x7f,0x80,0x7f,
		0xc0,0x3f,0xc0,0x3f,0xe0,0x1f,0xe0,0x1f,
		0xf0,0x0f,0xf0,0x0f,0xf8,0x07,0xf8,0x07,
		0xfc,0x03,0xfc,0x03,0xfe,0x01,0xfe,0x01 },
	{							/* 18 */
		0x80,0x00,0x00,0x00,0x40,0x00,0x00,0x00,
		0x20,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
		0x08,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
		0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
		0x00,0x80,0x00,0x00,0x00,0x40,0x00,0x00,
		0x00,0x20,0x00,0x00,0x00,0x10,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x20,
		0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,
		0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,
		0x00,0x00,0x04,0x00,0x00,0x00,0x08,0x00,
		0x00,0x00,0x10,0x00,0x00,0x00,0x20,0x00,
		0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00	},
	{							/* 19 */
		0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00	},
	{							/* 20 */
		0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00	},
	{							/* 21 */
		0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0xff,0x00,0xff,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00	},
	{							/* 22 */
		0xff,0xff,0x00,0x00,0xff,0xff,0x00,0x00,
		0xff,0xff,0x00,0x00,0xff,0xff,0x00,0x00,
		0xff,0xff,0x00,0x00,0xff,0xff,0x00,0x00,
		0xff,0xff,0x00,0x00,0xff,0xff,0x00,0x00,
		0xff,0xff,0x00,0x00,0xff,0xff,0x00,0x00,
		0xff,0xff,0x00,0x00,0xff,0xff,0x00,0x00,
		0xff,0xff,0x00,0x00,0xff,0xff,0x00,0x00,
		0xff,0xff,0x00,0x00,0xff,0xff,0x00,0x00,
		0x00,0x00,0xff,0xff,0x00,0x00,0xff,0xff,
		0x00,0x00,0xff,0xff,0x00,0x00,0xff,0xff,
		0x00,0x00,0xff,0xff,0x00,0x00,0xff,0xff,
		0x00,0x00,0xff,0xff,0x00,0x00,0xff,0xff,
		0x00,0x00,0xff,0xff,0x00,0x00,0xff,0xff,
		0x00,0x00,0xff,0xff,0x00,0x00,0xff,0xff,
		0x00,0x00,0xff,0xff,0x00,0x00,0xff,0xff,
		0x00,0x00,0xff,0xff,0x00,0x00,0xff,0xff	},
	{							/* 23 */
		0xff,0xff,0xff,0xff,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0xff,0xff,0xff,0xff,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00	},
	{							/* 24 */
		0x00,0x01,0x00,0x01,0x80,0x02,0x80,0x02,
		0x40,0x04,0x40,0x04,0x20,0x08,0x20,0x08,
		0x10,0x10,0x10,0x10,0x08,0x20,0x08,0x20,
		0x04,0x40,0x04,0x40,0x02,0x80,0x02,0x80,
		0x01,0x00,0x01,0x00,0x02,0x80,0x02,0x80,
		0x04,0x40,0x04,0x40,0x08,0x20,0x08,0x20,
		0x10,0x10,0x10,0x10,0x20,0x08,0x20,0x08,
		0x40,0x04,0x40,0x04,0x80,0x02,0x80,0x02,
		0x00,0x01,0x00,0x01,0x80,0x02,0x80,0x02,
		0x40,0x04,0x40,0x04,0x20,0x08,0x20,0x08,
		0x10,0x10,0x10,0x10,0x08,0x20,0x08,0x20,
		0x04,0x40,0x04,0x40,0x02,0x80,0x02,0x80,
		0x01,0x00,0x01,0x00,0x02,0x80,0x02,0x80,
		0x04,0x40,0x04,0x40,0x08,0x20,0x08,0x20,
		0x10,0x10,0x10,0x10,0x20,0x08,0x20,0x08,
		0x40,0x04,0x40,0x04,0x80,0x02,0x80,0x02 },
	{							/* 25 */
		0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,
		0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x08,
		0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x20,
		0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,
		0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,
		0x00,0x00,0x04,0x00,0x00,0x00,0x08,0x00,
		0x00,0x00,0x10,0x00,0x00,0x00,0x20,0x00,
		0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x00,
		0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,
		0x00,0x04,0x00,0x00,0x00,0x08,0x00,0x00,
		0x00,0x10,0x00,0x00,0x00,0x20,0x00,0x00,
		0x00,0x40,0x00,0x00,0x00,0x80,0x00,0x00,
		0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
		0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
		0x10,0x00,0x00,0x00,0x20,0x00,0x00,0x00,
		0x40,0x00,0x00,0x00,0x80,0x00,0x00,0x00	},
	{							/* 26 */
		0x00,0x00,0x0f,0xff,0x00,0x00,0x1f,0xfe,
		0x00,0x00,0x3f,0xfc,0x00,0x00,0x7f,0xf8,
		0x00,0x00,0xff,0xf0,0x00,0x01,0xff,0xe0,
		0x00,0x03,0xff,0xc0,0x00,0x07,0xff,0x80,
		0x00,0x0f,0xff,0x00,0x00,0x1f,0xfe,0x00,
		0x00,0x3f,0xfc,0x00,0x00,0x7f,0xf8,0x00,
		0x00,0xff,0xf0,0x00,0x01,0xff,0xe0,0x00,
		0x03,0xff,0xc0,0x00,0x07,0xff,0x80,0x00,
		0x0f,0xff,0x00,0x00,0x1f,0xfe,0x00,0x00,
		0x3f,0xfc,0x00,0x00,0x7f,0xf8,0x00,0x00,
		0xff,0xf0,0x00,0x00,0xff,0xe0,0x00,0x01,
		0xff,0xc0,0x00,0x03,0xff,0x80,0x00,0x07,
		0xff,0x00,0x00,0x0f,0xfe,0x00,0x00,0x1f,
		0xfc,0x00,0x00,0x3f,0xf8,0x00,0x00,0x7f,
		0xf0,0x00,0x00,0xff,0xe0,0x00,0x01,0xff,
		0xc0,0x00,0x03,0xff,0x80,0x00,0x07,0xff	},
	{							/* 27 */
		0x0f,0xff,0x0f,0xff,0x1f,0xfe,0x1f,0xfe,
		0x3f,0xfc,0x3f,0xfc,0x7f,0xf8,0x7f,0xf8,
		0xff,0xf0,0xff,0xf0,0xff,0xe1,0xff,0xe1,
		0xff,0xc3,0xff,0xc3,0xff,0x87,0xff,0x87,
		0xff,0x0f,0xff,0x0f,0xfe,0x1f,0xfe,0x1f,
		0xfc,0x3f,0xfc,0x3f,0xf8,0x7f,0xf8,0x7f,
		0xf0,0xff,0xf0,0xff,0xe1,0xff,0xe1,0xff,
		0xc3,0xff,0xc3,0xff,0x87,0xff,0x87,0xff,
		0x0f,0xff,0x0f,0xff,0x1f,0xfe,0x1f,0xfe,
		0x3f,0xfc,0x3f,0xfc,0x7f,0xf8,0x7f,0xf8,
		0xff,0xf0,0xff,0xf0,0xff,0xe1,0xff,0xe1,
		0xff,0xc3,0xff,0xc3,0xff,0x87,0xff,0x87,
		0xff,0x0f,0xff,0x0f,0xfe,0x1f,0xfe,0x1f,
		0xfc,0x3f,0xfc,0x3f,0xf8,0x7f,0xf8,0x7f,
		0xf0,0xff,0xf0,0xff,0xe1,0xff,0xe1,0xff,
		0xc3,0xff,0xc3,0xff,0x87,0xff,0x87,0xff },
	{							/* 28 */
		0x00,0x01,0x00,0x01,0x00,0x02,0x00,0x02,
		0x00,0x04,0x00,0x04,0x00,0x08,0x00,0x08,
		0x00,0x10,0x00,0x10,0x00,0x20,0x00,0x20,
		0x00,0x40,0x00,0x40,0x00,0x80,0x00,0x80,
		0x01,0x00,0x01,0x00,0x02,0x00,0x02,0x00,
		0x04,0x00,0x04,0x00,0x08,0x00,0x08,0x00,
		0x10,0x00,0x10,0x00,0x20,0x00,0x20,0x00,
		0x40,0x00,0x40,0x00,0x80,0x00,0x80,0x00,
		0x00,0x01,0x00,0x01,0x00,0x02,0x00,0x02,
		0x00,0x04,0x00,0x04,0x00,0x08,0x00,0x08,
		0x00,0x10,0x00,0x10,0x00,0x20,0x00,0x20,
		0x00,0x40,0x00,0x40,0x00,0x80,0x00,0x80,
		0x01,0x00,0x01,0x00,0x02,0x00,0x02,0x00,
		0x04,0x00,0x04,0x00,0x08,0x00,0x08,0x00,
		0x10,0x00,0x10,0x00,0x20,0x00,0x20,0x00,
		0x40,0x00,0x40,0x00,0x80,0x00,0x80,0x00 },
	{							/* 29 */
		0x00,0xff,0x00,0xff,0x01,0xfe,0x01,0xfe,
		0x03,0xfc,0x03,0xfc,0x07,0xf8,0x07,0xf8,
		0x0f,0xf0,0x0f,0xf0,0x1f,0xe0,0x1f,0xe0,
		0x3f,0xc0,0x3f,0xc0,0x7f,0x80,0x7f,0x80,
		0xff,0x00,0xff,0x00,0xfe,0x01,0xfe,0x01,
		0xfc,0x03,0xfc,0x03,0xf8,0x07,0xf8,0x07,
		0xf0,0x0f,0xf0,0x0f,0xe0,0x1f,0xe0,0x1f,
		0xc0,0x3f,0xc0,0x3f,0x80,0x7f,0x80,0x7f,
		0x00,0xff,0x00,0xff,0x01,0xfe,0x01,0xfe,
		0x03,0xfc,0x03,0xfc,0x07,0xf8,0x07,0xf8,
		0x0f,0xf0,0x0f,0xf0,0x1f,0xe0,0x1f,0xe0,
		0x3f,0xc0,0x3f,0xc0,0x7f,0x80,0x7f,0x80,
		0xff,0x00,0xff,0x00,0xfe,0x01,0xfe,0x01,
		0xfc,0x03,0xfc,0x03,0xf8,0x07,0xf8,0x07,
		0xf0,0x0f,0xf0,0x0f,0xe0,0x1f,0xe0,0x1f,
		0xc0,0x3f,0xc0,0x3f,0x80,0x7f,0x80,0x7f },
	{							/* 30 */
		0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
		0x05,0x00,0x00,0x00,0x08,0x80,0x00,0x00,
		0x10,0x40,0x00,0x00,0x20,0x20,0x00,0x00,
		0x40,0x10,0x00,0x00,0x80,0x08,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,
		0x00,0x00,0x05,0x00,0x00,0x00,0x08,0x80,
		0x00,0x00,0x10,0x40,0x00,0x00,0x20,0x20,
		0x00,0x00,0x40,0x10,0x00,0x00,0x80,0x08,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
	{							/* 31 */
		0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
		0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
		0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
		0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
		0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
		0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
		0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
		0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
		0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
		0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
		0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
		0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
		0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
		0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
		0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
		0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80	},
	{							/* 32 */
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
		0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00	},
	{							/* 33 */
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,
		0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,
		0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,
		0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,
		0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,
		0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,
		0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00	},
	{							/* 34 */
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		0x00,0x00,0x80,0x00,0x00,0x00,0x20,0x00,
		0x00,0x00,0x80,0x00,0x00,0x02,0x20,0x00,
		0x00,0x08,0x88,0x00,0x00,0x02,0x22,0x00,
		0x00,0x08,0x88,0x00,0x00,0x22,0x22,0x00,
		0x00,0x88,0x88,0x80,0x00,0x22,0x22,0x20,
		0x00,0x88,0x88,0x80,0x02,0x22,0x22,0x20,
		0x08,0x88,0x88,0x88,0x02,0x22,0x22,0x22,
		0x08,0x88,0x88,0x88,0x02,0x22,0x22,0x22,
		0x00,0x88,0x88,0x88,0x00,0x22,0x22,0x20,
		0x00,0x88,0x88,0x80,0x00,0x22,0x22,0x20,
		0x00,0x08,0x88,0x80,0x00,0x02,0x22,0x00,
		0x00,0x08,0x88,0x00,0x00,0x02,0x22,0x00,
		0x00,0x00,0x88,0x00,0x00,0x00,0x20,0x00,
		0x00,0x00,0x80,0x00,0x00,0x00,0x20,0x00	},
	{							/* 35 */
		0xff,0xff,0xff,0xff,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
		0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00	},
	{							/* 36 */
		0x00,0x00,0x80,0x00,0x00,0x01,0x40,0x00,
		0x00,0x02,0x20,0x00,0x00,0x04,0x10,0x00,
		0x00,0x08,0x08,0x00,0x00,0x10,0x04,0x00,
		0x00,0x20,0x02,0x00,0x00,0x40,0x01,0x00,
		0x00,0x80,0x00,0x80,0x01,0x00,0x00,0x40,
		0x02,0x00,0x00,0x20,0x04,0x00,0x00,0x10,
		0x08,0x00,0x00,0x08,0x10,0x00,0x00,0x04,
		0x20,0x00,0x00,0x02,0x40,0x00,0x00,0x01,
		0x80,0x00,0x00,0x00,0x40,0x00,0x00,0x01,
		0x20,0x00,0x00,0x02,0x10,0x00,0x00,0x04,
		0x08,0x00,0x00,0x08,0x04,0x00,0x00,0x10,
		0x02,0x00,0x00,0x20,0x01,0x00,0x00,0x40,
		0x00,0x80,0x00,0x80,0x00,0x40,0x01,0x00,
		0x00,0x20,0x02,0x00,0x00,0x10,0x04,0x00,
		0x00,0x08,0x08,0x00,0x00,0x04,0x10,0x00,
		0x00,0x02,0x20,0x00,0x00,0x01,0x40,0x00	}
};
SHAR_EOF
fi # end of overwriting check
if test -f 'pxl.h'
then
	echo shar: will not over-write existing file "'pxl.h'"
else
cat << \SHAR_EOF > 'pxl.h'
/* PXL file format */

/* Note:  PXL files are stored in the opposite of VAX byte order, which
   means each group of 4 bytes must be reversed before using the info. */

#define PXLID 1001		/* PXL file ID number */

#ifndef PXLPATH
#define PXLPATH "/usr/lib/tex/fonts"
				/* path to PXL font files.  The shell's
				   convention of colon-separated names
				   is honoured. */
#endif  PXLPATH

#define FONT_SLOP 5		/* how much "slop" from the given
				   magnification is permitted when looking
				   for a font (e.g., if the computed size
				   is 999, will try up to 999 +- FONT_SLOP,
				   until something is found) */

/* chinfo is called the "font directory" by the PXL file description, but I
   think that "character info" is a more accurate description.  Each group of
   4 "words" is one of these things, and there are 128 such groups, one for
   each character.

   Note that for empty characters ch_un.un_rastoff will be zero.

   The "#if vax" is for vax-dependent byte order stuff (I know, it's ugly).
 */
struct chinfo {
#if vax || ns32000		/* little-endian order */
    short   ch_height;
    short   ch_width;
    short   ch_yoffset;
    short   ch_xoffset;
#else				/* big-endian order */
    short   ch_width;		/* character width */
    short   ch_height;		/* character height */
    short   ch_xoffset;		/* X offset of ref point */
    short   ch_yoffset;		/* Y offset of ref point */
#endif
    union {
	int     un_rastoff;	/* raster offset from word 0 */
	char   *un_raster;	/* pointer to actual raster */
    }               ch_un;
    int     ch_TFMwidth;	/* TFM width (in FIXes) */
};
/* shorthand */
#define ch_rastoff ch_un.un_rastoff
#define ch_raster  ch_un.un_raster

/* The end of the PXL file looks like this */
struct pxltail {
    struct chinfo px_info[128];	/* "font directory" info */
    int     px_checksum;	/* checksum */
    int     px_magnification;	/* magnification factor */
    int     px_designsize;	/* font design size (FIXes) */
    int     px_dirpointer;	/* directory pointer */
    int     px_pxlid;		/* pxlid, should be == PXLID */
};

/* Function types */
double DMagFactor ();
char  *GenPXLFileName ();
struct pxltail *ReadPXLFile ();
SHAR_EOF
fi # end of overwriting check
if test -f 'scaletfm.c'
then
	echo shar: will not over-write existing file "'scaletfm.c'"
else
cat << \SHAR_EOF > 'scaletfm.c'
#ifndef lint
static char rcsid[] = "$Header: scaletfm.c,v 1.3 85/09/12 08:51:10 chris Exp $";
#endif

#include "types.h"
#include "pxl.h"

/* From DVITYPE.WEB:

 ``The most important part of in_TFM is the width computation, which
   involvles multiplying the relative widths in the TFM file by the scaling
   factor in the DVI file.  This fixed-point multiplication must be done with
   precisely the same accuracy by all DVI-reading programs, in order to
   validate the assumptions made by DVI-writing programs like \TeX 82.

   Let us therefore summarize what needs to be done.  Each width in a TFM
   file appears as a four-byte quantity called a fix_word.  A fix_word whose
   respective bytes are (a,b,c,d) represents the number

	   {{ b * 2^{-4} + c * 2^{-12} + d * 2^{-20},        if a = 0;
      x = {{
	   {{ -16 + b * 2^{-4} + c * 2^{-12} + d * 2^{-20},  if a = 255.

   (No other choices of a are allowed, since the magnitude of a TFM dimension
   must be less than 16.)  We want to multiply this quantity by the integer
   z, which is known to be less than 2^{27}.  Let \alpha = 16z.  If z <
   2^{23}, the individual multiplications b * z, c * z, d * z cannot
   overflow; otherwise we will divide z by 2, 4, 8, or 16, to obtain a
   multiplier less than 2^{23}, and we can compensate for this later.  If z
   has thereby been replaced by z' = z/2^e, let \beta = 2^{4-e}; we shall
   compute

	\lfloor (b + c * 2^{-8} + d * 2^{-16})z' / \beta \rfloor

   if a = 0, or the same quantity minus \alpha if a = 255.  This calculation
   must be done exactly, for the reasons stated above; the following program
   does the job in a system-independent way, assuming that arithmetic is
   exact on numbers less than 2^{31} in magnitude.'' */

/* In other words, we are assuming 32-bit (minimum) arithmetic, and take
   pains to ensure that each intermediate result fits within 32 bits.
   This routine converts the TFM widths in the px_info part of a pxltail
   pointer 'px' given the scale factor 'z'. */
ScaleTFMWidths (px, z)
struct pxltail *px;
register i32 z;
{
    register i32    alpha,
		    log2beta,
		    t;
    register struct chinfo *ch;
    register int    i;

 /* First compute \alpha, \beta, and z': */
    alpha = 16 * z;
    log2beta = 4;
    while (z >= (1 << 23)) {
	z >>= 1;
	log2beta--;
    }

 /* The four values 'a', 'b', 'c', and 'd' are fields within t: */
#define a (UnSign8 (t >> 24))
#define b (UnSign8 (t >> 16))
#define c (UnSign8 (t >> 8))
#define d (UnSign8 (t))

    ch = px -> px_info;
    for (i = 0; i < 128; i++) {
	if (t = ch -> ch_TFMwidth) {
	    t = (((((d * z) >> 8) + c * z) >> 8) + b * z) >> log2beta;
	    if (a) {
		if (a != 255)
		    error (0, 0, "bad TFM width!");
		t -= alpha;
	    }
	    ch -> ch_TFMwidth = t;
	}
	ch++;
    }
}

/* Provided in case anyone is not using the standard PXL file formats:
   scale the single TFM width 't' by 'z' */
i32
ScaleOneWidth (t, z)
register i32 t, z;
{
    register i32    alpha,
		    log2beta;

    alpha = 16 * z;
    log2beta = 4;
    while (z >= (1 << 23)) {
	z >>= 1;
	log2beta--;
    }

    if (t) {
	t = (((((d * z) >> 8) + c * z) >> 8) + b * z) >> log2beta;
	if (a) {
	    if (a != 255)
		error (0, 0, "bad TFM width! [ScaleOneWidth]");
	    t -= alpha;
	}
    }

    return t;
}
SHAR_EOF
fi # end of overwriting check
if test -f 'textimp.c'
then
	echo shar: will not over-write existing file "'textimp.c'"
else
cat << \SHAR_EOF > 'textimp.c'
/* #define DEBUG */
/* #define DEBUG2 */

#include "types.h"
#include "pxl.h"
#include <stdio.h>
#include "drawimp.h"

#define NFONTS		128	/* max number of fonts */

extern int   errno;

/* Globals */

struct fontinfo {
    struct pxltail *px;		/* pxl file info */
    int     family;		/* Imagen family number (we pick one) */
    int     cwidth[128];	/* width (in DEVs) of each char */
    char    cload[128];		/* flag for ``char loaded into Imagen'' */
};

struct fontinfo FontInfo[NFONTS];/* the fonts themselves */
struct fontinfo *CurrentFont;	/* the current font (if any) */
int     NextFamilyNumber = FONT_FAMILY_TOP;
				/* next available Imagen glyph-family index */
int	numfonts;		/* number of fonts read in so far */

char   *TeXfonts;		/* getenv("TEXFONTS") */

int     hh;			/* current horizontal position, in DEVs */
int     vv;			/* current vertical position, in DEVs */

int	ImHH;			/* Imagen horizontal position */
int	ImVV;			/* Imagen vertical position */
int	ImFamily;		/* Imagen current-font number */

double	UserMag;		/* user specified magnification */
double	GlobalMag;		/* overall magnification (UserMag*DVIMag) */
int	IntGlobalMag;		/* ROUND (GlobalMag * 1000.0) */
double	conv;			/* conversion factor for magnified DVI units */

double	OneHalf = 0.5;		/* .5, so compiler can generate constant only
				   once */

char *getenv (), *malloc ();

/* Round a floating point number to integer */
#define ROUND(f) ((int) ((f) + OneHalf))

/* Convert a value in sp's to dev's, and vice versa */
#define SPtoDEV(sp)  (ROUND ((sp)  * conv))
#define DEVtoSP(dev) (ROUND ((dev) / conv))

static int text_init, sp_size_set, il_size_set;
extern int resolution;
extern int sp_size, tab_size, il_size;
extern FILE *fontfp, *impout();

/***********************************************************************/

textimp(s,startv,starth,setpos)
char *s;
int startv,starth,setpos;
{
	char ch;
	if (text_init == 0)
		initialize();
	if (setpos) {	/* setpos != 0 to set h,v position and mark BOL */
		hh = starth;
		vv = startv;
		imP_set_bol(hh);
	}
	while ((ch = *s++) != '\0') {
		if (ch & 0x80) {	/* something special */
			ch &= 0x7f;
			if (ch == '\r') {
				if (il_size != il_size_set)
					imP_set_il(il_size_set = il_size);
				imP_crlf();
				ImVV += il_size;
				vv += il_size;
			}
			else if (ch == ' ') {
				if (sp_size != sp_size_set)
					imP_set_sp(sp_size_set = sp_size);
				imP_sp();
				ImHH += sp_size;
				hh += sp_size;
			}
			else if (ch == '\t') {
				if (tab_size != sp_size_set)
					imP_set_sp(sp_size_set = tab_size);
				imP_sp();
				ImHH += sp_size;
				hh += sp_size;
			}
		}
		else {
			DoChar(ch, 1);
		}
	}
}

static initialize()
{
	reset_text();
	TeXfonts = getenv ("TEXFONTS");
	if (TeXfonts == 0)
		TeXfonts = "";
	UserMag = ((double) resolution) / 200;
	GlobalMag = UserMag;
	IntGlobalMag = ROUND (GlobalMag * 1000.0);
	conv = (100.0) * (200.0 / 473628672) * GlobalMag;
#ifdef DEBUG
	fprintf(stderr,"TeXfonts=%s\n",TeXfonts);
	fprintf(stderr,"UserMag=%g, GlobalMag=%g, IntGlobalMag=%d\n",
		UserMag, GlobalMag, IntGlobalMag);
	fprintf(stderr,"conv=%g\n",conv);
#endif
	text_init = 1;
}

/* This should be called after each output file is complete to make sure
things get set right for the next file.
*/
reset_text()
{
	sp_size_set = 0;
	il_size_set = 0;
	ImHH = ImVV = ImFamily = -1;
}

/* Resets all fonts to show as not downloaded yet. */
reset_fonts()
{
	int i, j;
	char *cl;
	for (i = 0; i < numfonts; i++) {
		cl = FontInfo[i].cload;
		for (j = 128; j > 0; j--)
			*cl++ = 0;
	}
}

/* Given a font file name, find the font table entry for it.  If 'define'
   is nonzero, make an entry for it. */
selectfont(name,at_size,design_size)
char *name;
int at_size, design_size;
{
	char *font;
	struct finder {
		char *name;		/* the font file name */
		struct fontinfo *f;	/* the font info defined for it */
	};
	register struct finder *f, *f1, *f2;
	static struct finder    finder[NFONTS];

	if (text_init == 0)
		initialize();
	font = GenPXLFileName(name, at_size, design_size, IntGlobalMag,
		TeXfonts);
#ifdef DEBUG
	fprintf(stderr,"\nLooking for font \"%s\", numfonts=%d\n",
		font,numfonts);
#endif
	 /* If there are fonts defined, look around for the given font */
	if (numfonts) {
		register int h, l, m, x;
		h = numfonts - 1;
		l = 0;
#ifdef DEBUG
		for (x = 0; x < numfonts; x++) {
			fprintf(stderr,"%d: id=%d, \"%s\"\n",x,
				(finder[x].f)->family, finder[x].name);
		}
#endif		
		while (l <= h) {
			f = &finder[m = (l + h) >> 1];
			if ((x = strcmp(f->name, font)) > 0)
				h = m - 1;
			else if (x < 0)
				l = m + 1;
			else {
				CurrentFont = f->f;
#ifdef  DEBUG
				fprintf(stderr,"Found it, id=%d\n",
					CurrentFont->family);
#endif
				return(CurrentFont->family);
			}
		}
		if (l == numfonts)
			f = &finder[numfonts];
	}
	else
		f = finder;

 /* f is now where the font should have been found, if anywhere */

	f1 = &finder[numfonts];
	if (numfonts > NFONTS)
		error (1, 0, "too many fonts used (%d)", numfonts);
	while (f1 > f) {
		*f1 = *(f2 = f1 - 1);
		f1 = f2;
	}
	f->name = malloc(strlen(font) + 1);
	strcpy(f->name, font);
	CurrentFont = f->f = &FontInfo[numfonts];
	if ((CurrentFont->px = ReadPXLFile(font, 1)) == 0)
		error(1, errno, "can't find font \"%s\"",font);
	ScaleTFMWidths(CurrentFont->px, at_size);
	ComputeCWidths(CurrentFont);
	CurrentFont->family = NextFamilyNumber--;
	numfonts++;
#ifdef DEBUG
	fprintf(stderr,"Font file now loaded, id=%d\n",CurrentFont->family);
#endif
#ifdef DEBUG2
	printwidths(CurrentFont,stderr);
#endif
	return(CurrentFont->family);
}

/* Compute the DEV widths of the characters in the given font */
static ComputeCWidths (fi)
struct fontinfo *fi;
{
	register int    i;
	register struct chinfo *ch;
	register int   *cw;

	ch = fi -> px -> px_info;
	cw = fi -> cwidth;
	i = 128;
	while (--i >= 0) {
		*cw++ = SPtoDEV (ch -> ch_TFMwidth);
		ch++;
	}
}

static DoChar(c, advance)
char c;
int advance;
{
	register struct chinfo *ch;
	register struct fontinfo *cf;

	cf = CurrentFont;
	ch = &cf -> px -> px_info[c];
	if (ch -> ch_width != 0) {
		if (!cf -> cload[c])
			DownLoadGlyph (c, ch, cf);
		ImSetPosition(hh, vv);
		if (ImFamily != cf->family) {
			ImFamily = cf->family;
			imP_set_family(ImFamily);
		}
		imP_member(c);
		ImHH += cf -> cwidth[c];  /* where the Imagen thinks we are */
	}

	if (advance) {
		hh += cf -> cwidth[c];	/* where we want to be */
	}
}

#define RoundUp(n,r) (((n) + ((r) - 1)) & ~((r) - 1))

/* Download the character c/ch/cf (also, do rotation if needed) */
static DownLoadGlyph (c, ch, cf)
int c;				/* ordinal value */
register struct chinfo *ch;	/* chinfo for c */
register struct fontinfo *cf;	/* advance amount */
{
    register char  *p;
    register int    i,
                    j,
                    o,
                    w;
    FILE *fp;
/*
    if (!LFlag)
	w = 0;
    else {
	PerformRotation (ch, -90);
	w = 1;
    } */
    w = 0;

    fp = impout(fontfp);	/* switch to font file */
 /* Define the character */
    imP_bgly(w,  cf->family, c, cf->cwidth[c],
	ch->ch_width, ch->ch_xoffset,
	ch->ch_height, ch->ch_yoffset, NULL);

 /* Now put out the bitmap.  We have to drop any extra ``all blank'' bytes
    that are implied by the definition of the PXL fonts, since the Imagen
    doesn't need (nor want) them. */
    w = (RoundUp (ch -> ch_width, 8) >> 3);
    o = (RoundUp (ch -> ch_width, 32) >> 3) - w;
    p = ch -> ch_raster;
    for (i = ch -> ch_height; --i >= 0;) {
	for (j = w; --j >= 0;)
	    imP_member(*p++);
	p += o;
    }
    cf -> cload[c] = 1;		/* it's now loaded */
    impout(fp);
}

/* Set the Imagen's h & v positions.  (It's currently at ImHH, ImVV.) */
static ImSetPosition (h, v)
register int h, v;
{
	if (ImHH != h) {
		if (ImHH == h - 1)
			imP_mplus();
		else if (ImHH == h + 1)
			imP_mminus();
		else
			imP_set_abs_h(h);
		ImHH = h;
	}
	if (ImVV != v) {
		imP_set_abs_v(v);
		ImVV = v;
	}
}

#ifdef DEBUG2
/* Print out the DEV widths of the characters in the given font */
static printwidths (fi, fp)
struct fontinfo *fi;
FILE *fp;
{
	register int    i, j, k;
	register struct chinfo *ch;
	register int   *cw;

	ch = fi -> px -> px_info;
	cw = fi -> cwidth;
	i = 0;
	k = 32;
	while (--k >= 0) {
		j = 4;
		while (--j >= 0) {
			fprintf(fp,"%d: %d %d   ",i++,ch->ch_TFMwidth,*cw);
			cw++;
			ch++;
		}
		fprintf(fp,"\n");
	}
}
#endif
SHAR_EOF
fi # end of overwriting check
if test -f 'types.h'
then
	echo shar: will not over-write existing file "'types.h'"
else
cat << \SHAR_EOF > 'types.h'
/* a 32 (or more) bit integer (signed) */
typedef int i32;

/* macros to sign extend quantities that are less than 32 bits long */
/* Sun mishandles (int)(char)(constant) */
#ifndef sun
#define Sign8(n)	((int)(char)(n))
#else
#define Sign8(n)	(((n) << 24) >> 24)
#endif
#define Sign16(n)	((int)(short)(n))
/* #define Sign24(n)	((n) & (1<<23) ? ((n)|0xff000000) : (n)) */
#define Sign24(n)	(((n) << 8) >> 8)

/* macros to truncate quantites that are signed but shouldn't be */
#define UnSign8(n)	((n) & 0xff)
#define UnSign16(n)	((n) & 0xffff)
#define UnSign24(n)	((n) & 0xffffff)

/* note that we never have unsigned 32 bit integers */
SHAR_EOF
fi # end of overwriting check
#	End of shell archive
exit 0