const char * (UsageLines [] ) = {
       "p4label28: Reads text from standard input,",
       "writes P4 pbm to standard output using fixed-width.",
       "Usage: p4label28 (output image width) (output image height)",
       "Only ASCII characters are recognized.",
       "",
       "January 4, 2023.   Latest at gopher://sdf.org/1/users/julianbr",
       };
const int NumUsageLines = sizeof (UsageLines)/sizeof (UsageLines [0] );


#define NUM_ROWS 28
#define LETTER_SPACING 2
#define LINE_SPACING 2
#define MARGIN 10
int MaxNumColumns;


int (Outlines [] ) [NUM_ROWS] = {
       {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 2, 0, 0, 0, 0, 0, 0, 0, 0, }, /* ! */
       {27, 27, 27, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, /* " */
       {0, 0, 0, 0, 0, 0, 50, 50, 50, 127, 127, 127, 54, 127, 127, 127, 38, 38, 38, 36, 0, 0, 0, 0, 0, 0, 0, 0, }, /* # */
       {28, 28, 28, 28, 62, 127, 127, 124, 124, 124, 60, 62, 31, 31, 31, 63, 127, 62, 62, 28, 28, 28, 0, 0, 0, 0, 0, 0, }, /* $ */
       {99, 243, 243, 247, 246, 254, 110, 12, 28, 24, 56, 56, 48, 126, 111, 239, 239, 207, 206, 132, 0, 0, 0, 0, 0, 0, 0, 0, }, /* % */
       {24, 56, 60, 60, 44, 60, 60, 120, 120, 248, 248, 220, 220, 207, 239, 239, 102, 126, 62, 26, 0, 0, 0, 0, 0, 0, 0, 0, }, /* & */
       {7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, /* ' */
       {3, 7, 14, 12, 28, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 28, 12, 14, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, }, /* ( */
       {24, 28, 14, 6, 7, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 6, 14, 28, 24, 0, 0, 0, 0, 0, 0, 0, 0, }, /* ) */
       {51, 51, 63, 30, 63, 63, 63, 30, 63, 51, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, /* * */
       {0, 0, 0, 0, 0, 0, 12, 12, 12, 63, 63, 12, 12, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, /* + */
       {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 6, 6, 12, 0, 0, 0, 0, }, /* , */
       {0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, /* - */
       {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 2, 0, 0, 0, 0, 0, 0, 0, 0, }, /* . */
       {1, 3, 3, 3, 7, 7, 6, 14, 14, 12, 12, 28, 24, 24, 56, 56, 48, 48, 48, 32, 0, 0, 0, 0, 0, 0, 0, 0, }, /* / */
       {120, 252, 204, 462, 903, 771, 771, 771, 819, 819, 819, 771, 771, 771, 771, 903, 462, 204, 252, 120, 0, 0, 0, 0, 0, 0, 0, 0, }, /* 0 */
       {6, 14, 14, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, }, /* 1 */
       {120, 508, 910, 775, 771, 3, 3, 3, 3, 3, 3, 3, 7, 14, 28, 56, 112, 224, 1023, 1023, 0, 0, 0, 0, 0, 0, 0, 0, }, /* 2 */
       {120, 252, 462, 903, 903, 3, 7, 7, 14, 60, 62, 14, 7, 3, 771, 903, 390, 510, 252, 48, 0, 0, 0, 0, 0, 0, 0, 0, }, /* 3 */
       {12, 28, 28, 60, 124, 236, 236, 460, 1023, 1023, 1023, 12, 12, 12, 12, 12, 12, 12, 12, 12, 0, 0, 0, 0, 0, 0, 0, 0, }, /* 4 */
       {1023, 1023, 768, 768, 768, 768, 768, 1016, 1020, 14, 7, 3, 3, 3, 3, 7, 14, 796, 1016, 1008, 0, 0, 0, 0, 0, 0, 0, 0, }, /* 5 */
       {7, 31, 126, 240, 448, 448, 896, 896, 816, 1020, 1022, 902, 903, 771, 771, 903, 390, 510, 252, 48, 0, 0, 0, 0, 0, 0, 0, 0, }, /* 6 */
       {1023, 1023, 7, 7, 14, 14, 28, 28, 56, 56, 112, 96, 224, 192, 448, 384, 896, 768, 768, 512, 0, 0, 0, 0, 0, 0, 0, 0, }, /* 7 */
       {120, 252, 462, 903, 903, 771, 903, 903, 462, 252, 510, 462, 903, 771, 771, 903, 390, 510, 252, 48, 0, 0, 0, 0, 0, 0, 0, 0, }, /* 8 */
       {120, 252, 462, 903, 903, 771, 903, 903, 463, 511, 123, 3, 7, 6, 14, 28, 124, 1008, 992, 512, 0, 0, 0, 0, 0, 0, 0, 0, }, /* 9 */
       {0, 0, 0, 0, 0, 0, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 2, 0, 0, 0, 0, 0, 0, 0, 0, }, /* : */
       {0, 0, 0, 0, 0, 0, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, }, /* ; */
       {3, 3, 7, 14, 14, 28, 24, 56, 48, 48, 48, 48, 56, 28, 28, 14, 7, 7, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, }, /* < */
       {0, 0, 0, 0, 0, 0, 0, 63, 63, 0, 0, 63, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, /* = */
       {0, 0, 0, 48, 56, 28, 14, 15, 7, 3, 3, 7, 14, 28, 60, 56, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, /* > */
       {28, 62, 54, 119, 99, 99, 3, 7, 6, 14, 12, 28, 28, 28, 0, 0, 28, 28, 28, 8, 0, 0, 0, 0, 0, 0, 0, 0, }, /* ? */
       {0, 0, 0, 0, 0, 0, 0, 0, 16, 120, 124, 248, 220, 252, 252, 220, 248, 126, 127, 19, 0, 0, 0, 0, 0, 0, 0, 0, }, /* @ */
       {48, 120, 120, 120, 252, 204, 204, 462, 462, 390, 1023, 1023, 771, 771, 771, 771, 771, 771, 771, 771, 0, 0, 0, 0, 0, 0, 0, 0, }, /* A */
       {1008, 1020, 830, 783, 775, 771, 775, 783, 830, 1020, 1020, 798, 775, 771, 771, 775, 782, 1020, 1016, 960, 0, 0, 0, 0, 0, 0, 0, 0, }, /* B */
       {120, 252, 462, 903, 771, 771, 768, 768, 768, 768, 768, 768, 768, 768, 771, 771, 903, 462, 252, 120, 0, 0, 0, 0, 0, 0, 0, 0, }, /* C */
       {960, 1008, 1016, 796, 782, 782, 775, 775, 771, 771, 771, 775, 775, 774, 782, 796, 828, 1016, 992, 896, 0, 0, 0, 0, 0, 0, 0, 0, }, /* D */
       {1023, 1023, 768, 768, 768, 768, 768, 768, 1020, 1020, 768, 768, 768, 768, 768, 768, 768, 768, 1023, 1023, 0, 0, 0, 0, 0, 0, 0, 0, }, /* E */
       {1023, 1023, 768, 768, 768, 768, 768, 768, 1020, 1020, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 0, 0, 0, 0, 0, 0, 0, 0, }, /* F */
       {120, 252, 252, 462, 390, 388, 896, 896, 768, 768, 768, 783, 911, 911, 391, 391, 463, 252, 120, 48, 0, 0, 0, 0, 0, 0, 0, 0, }, /* G */
       {771, 771, 771, 771, 771, 771, 771, 771, 1023, 1023, 771, 771, 771, 771, 771, 771, 771, 771, 771, 771, 0, 0, 0, 0, 0, 0, 0, 0, }, /* H */
       {15, 15, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, }, /* I */
       {15, 15, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 390, 390, 462, 252, 120, 0, 0, 0, 0, 0, 0, 0, 0, }, /* J */
       {771, 771, 775, 782, 796, 824, 880, 992, 960, 896, 896, 960, 992, 880, 824, 796, 782, 775, 771, 771, 0, 0, 0, 0, 0, 0, 0, 0, }, /* K */
       {768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 1023, 1023, 0, 0, 0, 0, 0, 0, 0, 0, }, /* L */
       {3075, 3075, 3075, 3591, 3591, 3855, 3855, 3999, 3999, 3483, 3579, 3315, 3315, 3171, 3075, 3075, 3075, 3075, 3075, 3075, 0, 0, 0, 0, 0, 0, 0, 0, }, /* M */
       {771, 771, 899, 899, 963, 963, 995, 995, 883, 883, 827, 795, 799, 783, 783, 775, 775, 771, 771, 771, 0, 0, 0, 0, 0, 0, 0, 0, }, /* N */
       {120, 252, 252, 462, 390, 390, 903, 903, 771, 771, 771, 771, 903, 903, 390, 390, 462, 252, 120, 48, 0, 0, 0, 0, 0, 0, 0, 0, }, /* O */
       {1008, 1020, 830, 775, 771, 775, 783, 1022, 1020, 992, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 0, 0, 0, 0, 0, 0, 0, 0, }, /* P */
       {120, 252, 462, 903, 775, 771, 771, 771, 771, 771, 771, 771, 771, 771, 775, 782, 924, 508, 508, 236, 14, 14, 6, 6, 6, 0, 0, 0, }, /* Q */
       {1008, 1020, 830, 775, 771, 775, 783, 1022, 1020, 992, 864, 880, 824, 824, 796, 782, 782, 775, 771, 771, 0, 0, 0, 0, 0, 0, 0, 0, }, /* R */
       {124, 254, 455, 899, 771, 768, 768, 896, 448, 252, 126, 15, 7, 3, 3, 771, 775, 910, 508, 248, 0, 0, 0, 0, 0, 0, 0, 0, }, /* S */
       {1023, 1023, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, }, /* T */
       {771, 771, 771, 771, 771, 771, 771, 771, 771, 771, 771, 771, 771, 771, 771, 771, 903, 510, 252, 48, 0, 0, 0, 0, 0, 0, 0, 0, }, /* U */
       {771, 771, 771, 771, 771, 903, 903, 390, 390, 462, 462, 204, 204, 204, 204, 252, 120, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, }, /* V */
       {3075, 3075, 3075, 3075, 3075, 3075, 3075, 3075, 3075, 3075, 3171, 3171, 3171, 3315, 3315, 3483, 3999, 1806, 1806, 1806, 0, 0, 0, 0, 0, 0, 0, 0, }, /* W */
       {771, 771, 903, 903, 462, 462, 204, 204, 252, 120, 120, 252, 204, 204, 462, 390, 903, 771, 771, 771, 0, 0, 0, 0, 0, 0, 0, 0, }, /* X */
       {771, 771, 903, 390, 462, 204, 252, 120, 120, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, }, /* Y */
       {1023, 1023, 3, 7, 6, 12, 12, 24, 24, 48, 48, 96, 96, 192, 192, 384, 896, 768, 1023, 1023, 0, 0, 0, 0, 0, 0, 0, 0, }, /* Z */
       {15, 15, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, }, /* [ */
       {32, 48, 48, 48, 56, 56, 24, 28, 28, 12, 12, 14, 6, 6, 7, 7, 3, 3, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, }, /* \ */
       {15, 15, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, }, /* ] */
       {12, 30, 30, 63, 63, 51, 51, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, /* ^ */
       {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, }, /* _ */
       {4, 6, 6, 7, 7, 3, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, /* ` */
       {0, 0, 0, 0, 0, 0, 0, 0, 62, 63, 7, 3, 3, 63, 127, 99, 99, 99, 127, 59, 0, 0, 0, 0, 0, 0, 0, 0, }, /* a */
       {96, 96, 96, 96, 96, 96, 96, 96, 110, 127, 127, 115, 99, 99, 99, 99, 115, 127, 127, 110, 0, 0, 0, 0, 0, 0, 0, 0, }, /* b */
       {0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 63, 51, 112, 96, 96, 96, 112, 51, 63, 28, 0, 0, 0, 0, 0, 0, 0, 0, }, /* c */
       {3, 3, 3, 3, 3, 3, 3, 3, 27, 63, 63, 119, 99, 99, 99, 99, 119, 127, 63, 27, 0, 0, 0, 0, 0, 0, 0, 0, }, /* d */
       {0, 0, 0, 0, 0, 0, 0, 0, 28, 62, 127, 99, 99, 127, 127, 96, 96, 115, 63, 30, 0, 0, 0, 0, 0, 0, 0, 0, }, /* e */
       {14, 31, 59, 48, 48, 48, 48, 48, 63, 63, 63, 48, 48, 48, 48, 48, 48, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, }, /* f */
       {0, 0, 0, 0, 0, 0, 0, 0, 27, 63, 127, 103, 99, 99, 99, 99, 103, 127, 63, 27, 3, 3, 3, 3, 3, 103, 126, 60, }, /* g */
       {96, 96, 96, 96, 96, 96, 96, 96, 96, 126, 127, 99, 99, 99, 99, 99, 99, 99, 99, 99, 0, 0, 0, 0, 0, 0, 0, 0, }, /* h */
       {0, 0, 0, 7, 7, 7, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, }, /* i */
       {0, 0, 0, 7, 7, 7, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 102, 102, 102, 126, 60, }, /* j */
       {96, 96, 96, 96, 96, 96, 96, 96, 99, 103, 126, 124, 120, 112, 112, 120, 124, 126, 103, 99, 0, 0, 0, 0, 0, 0, 0, 0, }, /* k */
       {7, 7, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, }, /* l */
       {0, 0, 0, 0, 0, 0, 0, 0, 972, 1022, 1023, 819, 819, 819, 819, 819, 819, 819, 819, 819, 0, 0, 0, 0, 0, 0, 0, 0, }, /* m */
       {0, 0, 0, 0, 0, 0, 0, 0, 102, 127, 127, 99, 99, 99, 99, 99, 99, 99, 99, 99, 0, 0, 0, 0, 0, 0, 0, 0, }, /* n */
       {0, 0, 0, 0, 0, 0, 0, 0, 28, 62, 62, 119, 99, 99, 99, 99, 119, 62, 62, 28, 0, 0, 0, 0, 0, 0, 0, 0, }, /* o */
       {0, 0, 0, 0, 0, 0, 0, 0, 108, 126, 119, 99, 99, 99, 99, 99, 99, 119, 126, 108, 96, 96, 96, 96, 96, 96, 96, 96, }, /* p */
       {0, 0, 0, 0, 0, 0, 0, 0, 59, 127, 103, 99, 99, 99, 99, 99, 99, 103, 127, 59, 3, 3, 3, 3, 3, 3, 3, 3, }, /* q */
       {0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 99, 99, 96, 96, 96, 96, 96, 96, 96, 96, 0, 0, 0, 0, 0, 0, 0, 0, }, /* r */
       {0, 0, 0, 0, 0, 0, 0, 0, 30, 63, 115, 96, 112, 126, 63, 7, 3, 103, 126, 60, 0, 0, 0, 0, 0, 0, 0, 0, }, /* s */
       {0, 0, 0, 0, 0, 0, 24, 24, 126, 126, 24, 24, 24, 24, 24, 24, 24, 24, 31, 15, 0, 0, 0, 0, 0, 0, 0, 0, }, /* t */
       {0, 0, 0, 0, 0, 0, 0, 0, 99, 99, 99, 99, 99, 99, 99, 99, 99, 103, 127, 59, 0, 0, 0, 0, 0, 0, 0, 0, }, /* u */
       {0, 0, 0, 0, 0, 0, 0, 0, 99, 99, 99, 99, 119, 119, 54, 54, 62, 28, 28, 28, 0, 0, 0, 0, 0, 0, 0, 0, }, /* v */
       {0, 0, 0, 0, 0, 0, 0, 0, 819, 819, 819, 819, 891, 891, 1023, 1023, 462, 462, 390, 390, 0, 0, 0, 0, 0, 0, 0, 0, }, /* w */
       {0, 0, 0, 0, 0, 0, 0, 0, 99, 99, 99, 119, 62, 28, 28, 62, 119, 99, 99, 99, 0, 0, 0, 0, 0, 0, 0, 0, }, /* x */
       {0, 0, 0, 0, 0, 0, 0, 0, 99, 99, 99, 99, 51, 51, 59, 27, 31, 15, 14, 6, 6, 14, 12, 12, 28, 24, 56, 48, }, /* y */
       {0, 0, 0, 0, 0, 0, 0, 0, 127, 127, 7, 6, 14, 28, 24, 56, 48, 112, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, }, /* z */
       {2, 6, 6, 6, 6, 6, 4, 12, 12, 8, 12, 12, 12, 4, 6, 6, 6, 6, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, }, /* { */
       {7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, }, /* | */
       {4, 6, 6, 6, 6, 6, 2, 3, 3, 1, 3, 3, 3, 2, 6, 6, 6, 6, 4, 8, 0, 0, 0, 0, 0, 0, 0, 0, }, /* } */
       {30, 51, 51, 51, 51, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
       {0, 0, 0, 0, 0, 0, 56, 124, 31, 31, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, /* ~ */
       };
int NumOutlines = sizeof (Outlines) / sizeof (Outlines [0] );


#include <stdlib.h>
#include <stdio.h>


void WriteLabel (unsigned char (* TextLine) [NUM_ROWS] , int width, int height)
       {
       int * Outline;
       int c, i, j, byte, NumTextLines, NumImageLines, NumChars, MaxNumChars, PowerOf2;
       int row, position, NumColumns;

       NumImageLines = 0;
       printf ("P4\n");
       printf ("%d %d\n", width, height);
       for (i = 0; i < MARGIN; i++) {
               if (NumImageLines < height) {
                       for (byte = 0; byte < (width + 7)/8; byte++)
                               putchar (0);
                       }
               NumImageLines++;
               }
       NumTextLines = 0;
       MaxNumChars = 0;
       c = getchar ();
       while (c != EOF) {
               NumChars = 0;
               for (i = 0; i < NUM_ROWS; i++) {
                       for (byte = 0; byte < (width + 7)/8; byte++)
                               TextLine [byte] [i] = 0;
                       }
               while (c != '\n' && c != EOF) {
                       if (c - '!' >= 0 && c - '!' < NumOutlines) {
                               PowerOf2 = 1;
                               NumColumns = 0;
                               Outline = Outlines [c - '!'];
                               for (i = 0; i < NUM_ROWS; i++) {
                                       row = Outline [i];
                                       while (PowerOf2 <= row) {
                                               PowerOf2 *= 2;
                                               NumColumns++;
                                               }
                                       }
                               if (NumColumns > MaxNumColumns)
                                       NumColumns = MaxNumColumns;
                               for (i = 0; i < NumColumns; i++) {
                                       position = MARGIN + NumChars*(MaxNumColumns + LETTER_SPACING)
                                               + (MaxNumColumns - NumColumns)/2 + i;
                                       if (position < width) {
                                               byte = position/8;
                                               for (j = 0; j < NUM_ROWS; j++) {
                                                       row = Outline [j];
                                                       if (row & (1 << (NumColumns - i - 1) ) )
                                                               TextLine [byte] [j] += (1 << (7 - position%8) );
                                                       }
                                               }
                                       }
                               }
                       NumChars++;
                       c = getchar ();
                       }
               for (i = 0; i < NUM_ROWS; i++) {
                       if (NumImageLines < height) {
                               for (byte = 0; byte < (width + 7)/8; byte++)
                                       putchar (TextLine [byte] [i] );
                               }
                       NumImageLines++;
                       }
               for (i = 0; i < LINE_SPACING; i++) {
                       if (NumImageLines < height) {
                               for (byte = 0; byte < (width + 7)/8; byte++)
                                       putchar (0);
                               }
                       NumImageLines++;
                       }
               if (MaxNumChars < NumChars)
                       MaxNumChars = NumChars;
               NumTextLines++;
               if (c != EOF)
                       c = getchar ();
               }
       while (NumImageLines < height) {
               for (byte = 0; byte < (width + 7)/8; byte++)
                       putchar (0);
               NumImageLines++;
               }
       fprintf (stderr, "p4label28: Fits");
       fprintf (stderr, " %d", 2*MARGIN + MaxNumChars*MaxNumColumns + LETTER_SPACING*(MaxNumChars - 1) );
       fprintf (stderr, "x%d,", 2*MARGIN + (NumTextLines - 1)*LINE_SPACING + NumTextLines*NUM_ROWS);
       fprintf (stderr, " writing %dx%d.\n", width, height);
       }


int main (int argc, char * * argv)
       {
       unsigned char (* TextLine) [NUM_ROWS];
       int i, j, width, height, PowerOf2, row;
       char c;

       PowerOf2 = 1;
       MaxNumColumns = 0;
       for (i = 0; i < NumOutlines; i++) {
               for (j = 0; j < NUM_ROWS; j++) {
                       row = Outlines [i] [j];
                       while (PowerOf2 <= row) {
                               PowerOf2 *= 2;
                               MaxNumColumns++;
                               }
                       }
               }
       if (argc == 1) {
               for (i = 0; i < NumUsageLines; i++)
                       printf ("%s\n", UsageLines [i] );
               printf ("Each character %dx%d,", MaxNumColumns, NUM_ROWS);
               printf (" letter spacing %d, line spacing %d,", LETTER_SPACING, LINE_SPACING);
               printf (" margin %d.\n", MARGIN);
               }
       else if (argc == 3) {
               if (
                               sscanf (argv [1], "%d%c", & width, & c) != 1
                               || sscanf (argv [2], "%d%c", & height, & c) != 1
                               || width <= 0
                               || height <= 0) {
                       fprintf (stderr, "p4label2828: Improper \"%s\" \"%s\",", argv [1], argv [2] );
                       fprintf (stderr, " expecting width and height.\n");
                       }
               else {
                       TextLine = malloc (NUM_ROWS*((width + 7)/8) );
                       if (TextLine == NULL)
                               fprintf (stderr, "***p4label28: Not enough memory.\n");
                       else {
                               WriteLabel (TextLine, width, height);
                               free (TextLine);
                               }
                       }
               }
       else
               printf ("Usage: %s: (width) (height)\n", argv [0] );
       return 0;
       }