diff options
Diffstat (limited to 'lib/libpbmfont.c')
-rw-r--r-- | lib/libpbmfont.c | 926 |
1 files changed, 122 insertions, 804 deletions
diff --git a/lib/libpbmfont.c b/lib/libpbmfont.c index 5a604293..5193cd35 100644 --- a/lib/libpbmfont.c +++ b/lib/libpbmfont.c @@ -1,4 +1,4 @@ -/* libpbmfont.c - pbm utility library part 5 +/* ** ** Font routines. ** @@ -32,13 +32,6 @@ #include "pbmfont.h" #include "pbm.h" -/* Constants for the built-in fixed font and fonts loaded by - pbm_loadpbmfont(). - - These values are ignored when using the built-in BDF font, - or fonts loaded from files in BDF format by pbm_loadbdffont() . - For fonts loaded from BDF files code points between 0 and 255 are valid. -*/ static unsigned int const firstCodePoint = 32; /* This is the code point of the first character in a pbmfont font. In ASCII, it is a space. @@ -49,627 +42,6 @@ static unsigned int const nCharsInFont = 96; characters at position 32 (ASCII space) through 127, so that's 96. */ -/* The default font, packed in hex so this source file doesn't get huge. -** You can replace this with your own font using pbm_dumpfont(). -*/ -#define DEFAULTFONT_ROWS 155 -#define DEFAULTFONT_COLS 112 -static unsigned long int const -defaultfont_bits[DEFAULTFONT_ROWS][(DEFAULTFONT_COLS+31)/32] = { - {0x00000000L,0x20000c00L,0x10000000L,0x00000000L}, - {0xc600a000L,0x42000810L,0x00000002L,0x00000063L}, - {0x6c00a000L,0x45000810L,0x00000002L,0x00000036L}, - {0x6c00a000L,0x88800808L,0xf2e1dee2L,0x00000036L}, - {0x54000000L,0x80000800L,0x11122442L,0x0000002aL}, - {0x54000001L,0x00000800L,0x11122442L,0x0000002aL}, - {0x54000001L,0x00000800L,0x11122282L,0x0000002aL}, - {0x44000102L,0x00000800L,0x11122382L,0x00000022L}, - {0xee000102L,0x00000800L,0x11e1e102L,0x00000077L}, - {0x00000204L,0x00000800L,0x11002102L,0x00000000L}, - {0x00000000L,0x00000c00L,0x11002102L,0x00000000L}, - {0x00000000L,0x003f8000L,0xe3807600L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x02000080L,0x00040000L,0x00120000L,0x00000001L}, - {0x04000082L,0x828e1838L,0x20210100L,0x00000002L}, - {0x04000082L,0x82912448L,0x20210100L,0x00000002L}, - {0x08000082L,0x8fd01940L,0x404087c2L,0x00000004L}, - {0x08000080L,0x050c0622L,0x00408102L,0x00000004L}, - {0x10000080L,0x05061874L,0x0040828fL,0x00008008L}, - {0x10000080L,0x1f912688L,0x00408002L,0x00000008L}, - {0x20000000L,0x0a11098cL,0x00408002L,0x00000010L}, - {0x20000080L,0x0a0e0672L,0x00210000L,0x00000010L}, - {0x40000000L,0x00040000L,0x00210000L,0x00000020L}, - {0x00000000L,0x00000000L,0x00120000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x004e0838L,0x7023e1cfL,0x00008000L}, - {0x00000000L,0x00913844L,0x88620208L,0x00008000L}, - {0x08000000L,0x00910844L,0x08a20401L,0x00000004L}, - {0x10000000L,0x01110844L,0x08a20401L,0x00000008L}, - {0x20000000L,0x01110808L,0x3123c781L,0x00000010L}, - {0x400003e0L,0x02110810L,0x0a202441L,0x00000020L}, - {0x20000000L,0x02110820L,0x0bf02442L,0x00000010L}, - {0x10008000L,0x04110844L,0x88242442L,0x00000008L}, - {0x08008002L,0x040e3e7cL,0x7073c382L,0x00000004L}, - {0x00010000L,0x08000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x0000e1c0L,0x00000000L,0x00000000L,0x00000000L}, - {0x00011220L,0x00000000L,0x70e38f87L,0x00000000L}, - {0x20011220L,0x00020020L,0x89108448L,0x00008010L}, - {0x10011220L,0x00040010L,0x09314448L,0x00008008L}, - {0x0800e221L,0x02083e08L,0x11514788L,0x00000004L}, - {0x040111e0L,0x00100004L,0x2153e448L,0x00000002L}, - {0x08011020L,0x00083e08L,0x213a2448L,0x00008004L}, - {0x10011040L,0x02040010L,0x01022448L,0x00008008L}, - {0x2000e381L,0x02020020L,0x20e77f87L,0x00000010L}, - {0x00000000L,0x04000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x3803e7efL,0xc73bbe3dL,0xdb863ce7L,0x0000001cL}, - {0x44011224L,0x48910808L,0x91036648L,0x00008022L}, - {0x4c011285L,0x48910808L,0xa1036648L,0x00008026L}, - {0x54011387L,0x081f0808L,0xc102a548L,0x0000802aL}, - {0x54011285L,0x09910808L,0xe102a548L,0x0000802aL}, - {0x4e011204L,0x08910848L,0x9112a4c8L,0x00008027L}, - {0x40011224L,0x08910848L,0x891224c8L,0x00008020L}, - {0x3803e7efL,0x073bbe31L,0xcff77e47L,0x0000001cL}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000003L,0x00000000L}, - {0x0003e1cfL,0x87bff7efL,0xdfbf77c2L,0x00000000L}, - {0x00013224L,0x48a4a244L,0x89122442L,0x00000000L}, - {0x00011224L,0x4824a244L,0xa8a14482L,0x00000000L}, - {0x00013227L,0x8e04226cL,0xa8414102L,0x00000000L}, - {0x0001e224L,0x83842228L,0xa8a08102L,0x00000000L}, - {0x00010224L,0x40842228L,0xd8a08242L,0x00000000L}, - {0x00010224L,0x48843638L,0x51108442L,0x00000000L}, - {0x0003c1ceL,0x6f1f1c10L,0x53b9c7c2L,0x00000000L}, - {0x00000060L,0x00000000L,0x00000002L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000003L,0x00000000L}, - {0xfe000000L,0x00000000L,0x00000000L,0x0000007fL}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00010180L,0x000000c0L,0x003001c0L,0x00000000L}, - {0x08008081L,0x00040040L,0x00100200L,0x00000004L}, - {0x10008082L,0x80040040L,0x00100200L,0x00000008L}, - {0x10004084L,0x40023c78L,0x70f1c7c7L,0x00004008L}, - {0x10004080L,0x00000244L,0x89122208L,0x00008008L}, - {0x20002080L,0x00001e44L,0x8113e208L,0x00008010L}, - {0x10002080L,0x00002244L,0x81120208L,0x00008008L}, - {0x10001080L,0x00002244L,0x89122208L,0x00008008L}, - {0x10001080L,0x00001db8L,0x70e9c787L,0x00008008L}, - {0x10000880L,0x00000000L,0x00000000L,0x00008008L}, - {0x08000180L,0x00000000L,0x00000000L,0x00008004L}, - {0x00000000L,0x1fc00000L,0x00000007L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00030080L,0x981c0000L,0x00000000L,0x00000000L}, - {0x20010000L,0x08040000L,0x00000000L,0x00000010L}, - {0x10010000L,0x08040000L,0x00000000L,0x00000008L}, - {0x10016387L,0x898474b8L,0x72e1d5c7L,0x00000008L}, - {0x10019080L,0x8a042a64L,0x89122208L,0x00008008L}, - {0x08011080L,0x8c042a44L,0x89122207L,0x00000004L}, - {0x10011080L,0x8a042a44L,0x89122200L,0x00008008L}, - {0x10011080L,0x89042a44L,0x89122208L,0x00008008L}, - {0x1003bbe0L,0x98dfebe6L,0x71e1e787L,0x00000008L}, - {0x10000000L,0x80000000L,0x01002000L,0x00000008L}, - {0x20000000L,0x80000000L,0x01002000L,0x00000010L}, - {0x00000007L,0x00000000L,0x03807000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00008000L,0x00000000L,0x10410000L,0x00000000L}, - {0x00008000L,0x00000000L,0x20408000L,0x00000000L}, - {0x0001f66eL,0xfdfbf77cL,0x20408000L,0x00000000L}, - {0x24008224L,0x488a2248L,0x20408240L,0x00000012L}, - {0x54008224L,0x4a842210L,0x40404540L,0x0000002aL}, - {0x48008222L,0x8a8a1420L,0x20408480L,0x00000024L}, - {0x00008a23L,0x85111c44L,0x20408000L,0x00000000L}, - {0x000071d1L,0x0531887cL,0x20408000L,0x00000000L}, - {0x00000000L,0x00000800L,0x20408000L,0x00000000L}, - {0x00000000L,0x00000800L,0x10410000L,0x00000000L}, - {0x00000000L,0x00003000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x00000000L,0x00000000L,0x00000000L}, - {0x00000000L,0x20000c00L,0x10000000L,0x00000000L}, - {0xc600a000L,0x42000810L,0x00000002L,0x00000063L}, - {0x6c00a000L,0x45000810L,0x00000002L,0x00000036L}, - {0x6c00a000L,0x88800808L,0xf2e1dee2L,0x00000036L}, - {0x54000000L,0x80000800L,0x11122442L,0x0000002aL}, - {0x54000001L,0x00000800L,0x11122442L,0x0000002aL}, - {0x54000001L,0x00000800L,0x11122282L,0x0000002aL}, - {0x44000102L,0x00000800L,0x11122382L,0x00000022L}, - {0xee000102L,0x00000800L,0x11e1e102L,0x00000077L}, - {0x00000204L,0x00000800L,0x11002102L,0x00000000L}, - {0x00000000L,0x00000c00L,0x11002102L,0x00000000L}, - {0x00000000L,0x003f8000L,0xe3807600L,0x00000000L} - }; - -/* A default BDF font */ -/* Not as nicely compacted as the PBM font, oh well. */ - -static struct glyph _g[190] = { - { 1, 1, 0, 0, 3, "\0" }, - { 1, 9, 1, 0, 3, "\1\1\1\1\1\1\1\0\1" }, - { 3, 3, 1, 6, 5, "\1\0\1\1\0\1\1\0\1" }, - { 5, 8, 0, 0, 6, "\0\1\0\1\0\0\1\0\1\0\1\1\1\1\1\0\1\0\1\0\0\1\0\1\0\1\1\1\1\1\0\1\0\1\0\0\1\0\1\0" }, - { 5, 11, 0, -1, 6, "\0\0\1\0\0\0\1\1\1\0\1\0\1\0\1\1\0\1\0\0\0\1\1\0\0\0\0\1\1\0\0\0\1\0\1\0\0\1\0\1\1\0\1\0\1\0\1\1\1\0\0\0\1\0\0" }, - { 8, 9, 0, 0, 9, "\0\1\1\0\0\0\1\1\1\0\0\1\1\1\1\0\1\0\0\1\0\1\0\0\0\1\1\0\1\0\0\0\0\0\0\1\0\0\0\0\0\0\1\1\0\1\1\0\0\0\1\0\1\0\0\1\0\1\0\0\1\0\0\1\0\1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\1\1\0\0\1\0\1\0\0\0\0\1\1\0\0\0\0\1\0\0\0\0\0\1\0\0\0\0\1\0\0\0\0\1\1\0\0\0\0" }, - { 5, 12, 0, -3, 6, "\1\1\0\0\0\0\1\0\0\0\0\1\0\0\0\0\1\1\1\0\0\1\0\0\1\0\1\0\0\1\0\1\0\0\1\0\1\0\0\1\0\1\1\1\0\0\1\0\0\0\0\1\0\0\0\1\1\1\0\0" }, - { 6, 11, 0, -3, 6, "\0\1\0\0\1\0\0\0\0\0\0\0\1\1\0\0\1\1\0\1\0\0\1\0\0\1\0\1\1\0\0\1\0\1\0\0\0\0\1\1\0\0\0\0\1\0\0\0\0\0\1\0\0\0\0\1\0\0\0\0\1\1\0\0\0\0" } -}; - -static struct font default_bdffont = { 14, 15, -1, -3, { - 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, - _g + 0, - _g + 1, - _g + 2, - _g + 3, - _g + 4, - _g + 5, - _g + 6, - _g + 7, - _g + 8, - _g + 9, - _g + 10, - _g + 11, - _g + 12, - _g + 13, - _g + 14, - _g + 15, - _g + 16, - _g + 17, - _g + 18, - _g + 19, - _g + 20, - _g + 21, - _g + 22, - _g + 23, - _g + 24, - _g + 25, - _g + 26, - _g + 27, - _g + 28, - _g + 29, - _g + 30, - _g + 31, - _g + 32, - _g + 33, - _g + 34, - _g + 35, - _g + 36, - _g + 37, - _g + 38, - _g + 39, - _g + 40, - _g + 41, - _g + 42, - _g + 43, - _g + 44, - _g + 45, - _g + 46, - _g + 47, - _g + 48, - _g + 49, - _g + 50, - _g + 51, - _g + 52, - _g + 53, - _g + 54, - _g + 55, - _g + 56, - _g + 57, - _g + 58, - _g + 59, - _g + 60, - _g + 61, - _g + 62, - _g + 63, - _g + 64, - _g + 65, - _g + 66, - _g + 67, - _g + 68, - _g + 69, - _g + 70, - _g + 71, - _g + 72, - _g + 73, - _g + 74, - _g + 75, - _g + 76, - _g + 77, - _g + 78, - _g + 79, - _g + 80, - _g + 81, - _g + 82, - _g + 83, - _g + 84, - _g + 85, - _g + 86, - _g + 87, - _g + 88, - _g + 89, - _g + 90, - _g + 91, - _g + 92, - _g + 93, - _g + 94, - 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, - _g + 95, - _g + 96, - _g + 97, - _g + 98, - _g + 99, - _g + 100, - _g + 101, - _g + 102, - _g + 103, - _g + 104, - _g + 105, - _g + 106, - _g + 107, - _g + 108, - _g + 109, - _g + 110, - _g + 111, - _g + 112, - _g + 113, - _g + 114, - _g + 115, - _g + 116, - _g + 117, - _g + 118, - _g + 119, - _g + 120, - _g + 121, - _g + 122, - _g + 123, - _g + 124, - _g + 125, - _g + 126, - _g + 127, - _g + 128, - _g + 129, - _g + 130, - _g + 131, - _g + 132, - _g + 133, - _g + 134, - _g + 135, - _g + 136, - _g + 137, - _g + 138, - _g + 139, - _g + 140, - _g + 141, - _g + 142, - _g + 143, - _g + 144, - _g + 145, - _g + 146, - _g + 147, - _g + 148, - _g + 149, - _g + 150, - _g + 151, - _g + 152, - _g + 153, - _g + 154, - _g + 155, - _g + 156, - _g + 157, - _g + 158, - _g + 159, - _g + 160, - _g + 161, - _g + 162, - _g + 163, - _g + 164, - _g + 165, - _g + 166, - _g + 167, - _g + 168, - _g + 169, - _g + 170, - _g + 171, - _g + 172, - _g + 173, - _g + 174, - _g + 175, - _g + 176, - _g + 177, - _g + 178, - _g + 179, - _g + 180, - _g + 181, - _g + 182, - _g + 183, - _g + 184, - _g + 185, - _g + 186, - _g + 187, - _g + 188, - _g + 189 - } -}; - - struct font * pbm_defaultfont(const char * const name) { @@ -678,39 +50,13 @@ pbm_defaultfont(const char * const name) { -----------------------------------------------------------------------------*/ struct font * retval; - if (strcmp(name, "bdf") == 0) - retval = &default_bdffont; - else { - bit** defaultfont; - unsigned int row; + if (streq(name, "bdf")) + retval = &pbm_defaultBdffont; + else if (streq(name, "fixed")) + retval = &pbm_defaultFixedfont; + else + pm_error( "built-in font name unknown, try 'bdf' or 'fixed'"); - if (strcmp(name, "fixed") != 0) - pm_error( "built-in font name unknown, try 'bdf' or 'fixed'"); - - defaultfont = pbm_allocarray(DEFAULTFONT_COLS, DEFAULTFONT_ROWS); - for (row = 0; row < DEFAULTFONT_ROWS; ++row) { - unsigned int col; - for (col = 0; col < DEFAULTFONT_COLS; col += 32) { - int scol; - unsigned long l; - - l = defaultfont_bits[row][col / 32]; /* initial value */ - - for (scol = MIN( col + 32, DEFAULTFONT_COLS) - 1; - scol >= (int)col; - --scol) { - if (l & 0x01) - defaultfont[row][scol] = 1; - else - defaultfont[row][scol] = 0; - l >>= 1; - } - } - } - retval = - pbm_dissectfont((const bit **)defaultfont, - DEFAULTFONT_ROWS, DEFAULTFONT_COLS); - } return retval; } @@ -956,38 +302,31 @@ pbm_dissectfont(const bit ** const font, -struct font* +struct font * pbm_loadfont(const char * const filename) { -/*---------------------------------------------------------------------------- -Read the head of the designated font file, determine its type and load -the font. -Note that fgets() writes nothing to the line buffer when the file exists -but is empty. -----------------------------------------------------------------------------*/ - FILE* fp; - struct font * fn; - char * line; - - MALLOCARRAY_NOFAIL(line, 10); + FILE * fileP; + struct font * fontP; + char line[256]; - line[0] = '\0'; - fp = pm_openr( filename ); - fgets(line, 10, fp); - pm_close( fp ); + fileP = pm_openr(filename); + fgets(line, 256, fileP); + pm_close(fileP); if (line[0] == PBM_MAGIC1 && (line[1] == PBM_MAGIC2 || line[1] == RPBM_MAGIC2)) { - fn = pbm_loadpbmfont( filename ); + fontP = pbm_loadpbmfont(filename); } else if (!strncmp(line, "STARTFONT", 9)) { - if (!(fn = pbm_loadbdffont( filename ))) - pm_error( "could not load BDF font file" ); + fontP = pbm_loadbdffont(filename); + if (!fontP) + pm_error("could not load BDF font file"); } else { - pm_error( "font file not in a recognized format "); - fn = NULL; /* Supress compiler error. This line never reached. */ - } - free(line); - return (fn); + pm_error("font file not in a recognized format. Does not start " + "with the signature of a PBM file or BDF font file"); + assert(false); + fontP = NULL; /* defeat compiler warning */ + } + return fontP; } @@ -1008,100 +347,73 @@ pbm_loadpbmfont(const char * const filename) { void -pbm_dumpfont( fn ) - struct font* fn; -{ - /* Dump out font as C source code. */ - int row, col, scol, lperrow; - unsigned long l; - - if (fn->oldfont) { - printf( "#define DEFAULTFONT_ROWS %d\n", fn->frows ); - printf( "#define DEFAULTFONT_COLS %d\n", fn->fcols ); - printf( "static unsigned long defaultfont_bits[DEFAULTFONT_ROWS][(DEFAULTFONT_COLS+31)/32] = {\n" ); - for ( row = 0; row < fn->frows; ++row ) - { - lperrow = 0; - for ( col = 0; col < fn->fcols; col += 32 ) - { - if ( lperrow == 0 ) - printf( " {" ); - else if ( lperrow % 6 == 0 ) - { - printf( ",\n " ); - lperrow = 0; - } - else - printf( "," ); - l = 0; - for ( scol = col; scol < MIN( col + 32, fn->fcols ); ++scol ) - { - l <<= 1; - if ( fn->oldfont[row][scol] ) - l |= 1; - } - printf( "0x%08lxL", l ); - ++lperrow; - } - printf( "}%s\n", row == fn->frows - 1 ? "" : "," ); - } - printf( " };\n" ); - } - else { - struct glyph* glyph; - int i, j, ng; +pbm_dumpfont(struct font * const fontP, + FILE * const ofP) { +/*---------------------------------------------------------------------------- + Dump out font as C source code. +-----------------------------------------------------------------------------*/ + unsigned int i; + unsigned int ng; - ng = 0; - for (i = 0; i < 256; i++) - if (fn->glyph[i]) - ng++; + if (fontP->oldfont) + pm_message("Netpbm no longer has the capability to generate " + "a font in long hexadecimal data format"); - printf("static struct glyph _g[%d] = {\n", ng); - for (i = 0; i < 256; i++) { - if (!(glyph = fn->glyph[i])) - continue; + for (i = 0, ng = 0; i < 256; ++i) { + if (fontP->glyph[i]) + ++ng; + } - printf(" { %d, %d, %d, %d, %d, \"", glyph->width, glyph->height, - glyph->x, glyph->y, glyph->xadd); + printf("static struct glyph _g[%d] = {\n", ng); - for (j = 0; j < glyph->width * glyph->height; j++) - if (glyph->bmap[j]) - printf("\\1"); - else - printf("\\0"); - - ng--; - printf("\" }%s\n", ng ? "," : ""); + for (i = 0; i < 256; ++i) { + struct glyph * const glyphP = fontP->glyph[i]; + if (glyphP) { + unsigned int j; + printf(" { %d, %d, %d, %d, %d, \"", glyphP->width, glyphP->height, + glyphP->x, glyphP->y, glyphP->xadd); + + for (j = 0; j < glyphP->width * glyphP->height; ++j) { + if (glyphP->bmap[j]) + printf("\\1"); + else + printf("\\0"); + } + --ng; + printf("\" }%s\n", ng ? "," : ""); + } } printf("};\n"); - printf("static struct font default_bdffont = { %d, %d, %d, %d, {\n", - fn->maxwidth, fn->maxheight, fn->x, fn->y); + printf("struct font XXX_font = { %d, %d, %d, %d, {\n", + fontP->maxwidth, fontP->maxheight, fontP->x, fontP->y); - for (i = 0; i < 256; i++) { - if (fn->glyph[i]) - printf(" _g + %d", ng++); - else - printf(" 0"); + { + unsigned int i; + + for (i = 0; i < 256; ++i) { + if (fontP->glyph[i]) + printf(" _g + %d", ng++); + else + printf(" NULL"); - if (i != 255) printf(","); - printf("\n"); + if (i != 255) printf(","); + printf("\n"); + } } printf(" }\n};\n"); - exit(0); - - } - } + /* Routines for loading a BDF font file */ #define MAXBDFLINE 1024 /* Official Adobe document says max length of string is 65535 characters. - However the value 1024 is sufficient for practical uses. */ + However the value 1024 is sufficient for practical uses. +*/ typedef struct { /*---------------------------------------------------------------------------- @@ -1118,12 +430,12 @@ typedef struct { */ const char * arg[32]; /* These are the words; each entry is a pointer into line[] (above) */ -} readline; +} Readline; static void -readline_init(readline * const readlineP, +readline_init(Readline * const readlineP, FILE * const ifP) { readlineP->ifP = ifP; @@ -1167,7 +479,7 @@ tokenize(char * const s, static void -readline_read(readline * const readlineP, +readline_read(Readline * const readlineP, bool * const eofP) { /*---------------------------------------------------------------------------- Read a nonblank line from the file. Make its contents available @@ -1260,7 +572,7 @@ parseBitmapRow(const char * const hex, static void -readBitmap(readline * const readlineP, +readBitmap(Readline * const readlineP, unsigned int const glyphWidth, unsigned int const glyphHeight, const char * const charName, @@ -1301,7 +613,7 @@ readBitmap(readline * const readlineP, static void createBmap(unsigned int const glyphWidth, unsigned int const glyphHeight, - readline * const readlineP, + Readline * const readlineP, const char * const charName, const char ** const bmapP) { @@ -1343,7 +655,7 @@ createBmap(unsigned int const glyphWidth, static void -readExpectedStatement(readline * const readlineP, +readExpectedStatement(Readline * const readlineP, const char * const expected) { /*---------------------------------------------------------------------------- Have the readline object *readlineP read the next line from the file, but @@ -1365,7 +677,7 @@ readExpectedStatement(readline * const readlineP, static void -skipCharacter(readline * const readlineP) { +skipCharacter(Readline * const readlineP) { /*---------------------------------------------------------------------------- In the BDF font file being read by readline object *readlineP, skip through the end of the character we are presently in. @@ -1428,7 +740,7 @@ interpEncoding(const char ** const arg, static void -readEncoding(readline * const readlineP, +readEncoding(Readline * const readlineP, unsigned int * const codepointP, bool * const badCodepointP) { @@ -1438,53 +750,56 @@ readEncoding(readline * const readlineP, } + static void validateFontLimits(const struct font * const fontP) { assert( pbm_maxfontheight() > 0 && pbm_maxfontwidth() > 0 ); - if ( fontP->maxwidth <= 0 || - fontP->maxheight <= 0 || - fontP->maxwidth > pbm_maxfontwidth() || - fontP->maxheight > pbm_maxfontheight() || - fontP->x < - fontP->maxwidth +1 || - fontP->y < - fontP->maxheight +1 || - fontP->x > fontP->maxwidth || - fontP->y > fontP->maxheight || - fontP->x + fontP->maxwidth > pbm_maxfontwidth() || + if (fontP->maxwidth <= 0 || + fontP->maxheight <= 0 || + fontP->maxwidth > pbm_maxfontwidth() || + fontP->maxheight > pbm_maxfontheight() || + fontP->x < - fontP->maxwidth +1 || + fontP->y < - fontP->maxheight +1 || + fontP->x > fontP->maxwidth || + fontP->y > fontP->maxheight || + fontP->x + fontP->maxwidth > pbm_maxfontwidth() || fontP->y + fontP->maxheight > pbm_maxfontheight() - ) + ) { - pm_error("Global font metric(s) out of bounds.\n"); + pm_error("Global font metric(s) out of bounds.\n"); + } } static void validateGlyphLimits(const struct font * const fontP, - const struct glyph * const glyphP, - const char * const charName) { - - if ( glyphP->width == 0 || - glyphP->height == 0 || - glyphP->width > fontP->maxwidth || - glyphP->height > fontP->maxheight || - glyphP->width > fontP->maxwidth || - glyphP->height > fontP->maxheight || - glyphP->x < fontP->x || - glyphP->y < fontP->y || - glyphP->x + (int) glyphP->width > fontP->x + fontP->maxwidth || - glyphP->y + (int) glyphP->height > fontP->y + fontP->maxheight || - glyphP->xadd > pbm_maxfontwidth() || - glyphP->xadd + MAX(glyphP->x,0) + (int) glyphP->width > - pbm_maxfontwidth() - ) - pm_error("Font metric(s) for char '%s' out of bounds.\n", charName); + const struct glyph * const glyphP, + const char * const charName) { + + if (glyphP->width == 0 || + glyphP->height == 0 || + glyphP->width > fontP->maxwidth || + glyphP->height > fontP->maxheight || + glyphP->x < fontP->x || + glyphP->y < fontP->y || + glyphP->x + (int) glyphP->width > fontP->x + fontP->maxwidth || + glyphP->y + (int) glyphP->height > fontP->y + fontP->maxheight || + glyphP->xadd > pbm_maxfontwidth() || + glyphP->xadd + MAX(glyphP->x,0) + (int) glyphP->width > + pbm_maxfontwidth() + ) { + + pm_error("Font metric(s) for char '%s' out of bounds.\n", charName); + } } + static void -processChars(readline * const readlineP, +processChars(Readline * const readlineP, struct font * const fontP) { /*---------------------------------------------------------------------------- Process the CHARS block in a BDF font file, assuming the file is positioned @@ -1527,9 +842,9 @@ processChars(readline * const readlineP, if (badCodepoint) skipCharacter(readlineP); - else if (fontP->glyph[codepoint] != NULL) - pm_error("Multiple definition of code point %d " - "in font file", (unsigned int) codepoint); + else if (fontP->glyph[codepoint] != NULL) + pm_error("Multiple definition of code point %d " + "in font file", (unsigned int) codepoint); else { readExpectedStatement(readlineP, "SWIDTH"); @@ -1563,7 +878,7 @@ processChars(readline * const readlineP, static void -processBdfFontLine(readline * const readlineP, +processBdfFontLine(Readline * const readlineP, struct font * const fontP, bool * const endOfFontP) { /*---------------------------------------------------------------------------- @@ -1598,13 +913,13 @@ processBdfFontLine(readline * const readlineP, validateFontLimits(fontP); } else if (streq(readlineP->arg[0], "ENDPROPERTIES")) { if (fontP->maxwidth ==0) - pm_error("Encountered ENDPROPERTIES before FONTBOUNDINGBOX " + pm_error("Encountered ENDPROPERTIES before FONTBOUNDINGBOX " "in BDF font file"); } else if (streq(readlineP->arg[0], "ENDFONT")) { *endOfFontP = true; } else if (streq(readlineP->arg[0], "CHARS")) { if (fontP->maxwidth ==0) - pm_error("Encountered CHARS before FONTBOUNDINGBOX " + pm_error("Encountered CHARS before FONTBOUNDINGBOX " "in BDF font file"); else processChars(readlineP, fontP); @@ -1619,7 +934,7 @@ struct font * pbm_loadbdffont(const char * const name) { FILE * ifP; - readline readline; + Readline readline; struct font * fontP; bool endOfFont; @@ -1660,3 +975,6 @@ pbm_loadbdffont(const char * const name) { } return fontP; } + + + |