diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/bdf2c | 19 | ||||
-rw-r--r-- | tools/writerbf.c | 5 |
2 files changed, 16 insertions, 8 deletions
diff --git a/tools/bdf2c b/tools/bdf2c index e6b8ee7df7..6832e5ce8f 100755 --- a/tools/bdf2c +++ b/tools/bdf2c | |||
@@ -5,6 +5,7 @@ | |||
5 | # | 5 | # |
6 | # from The Microwindows Project (http://microwindows.org) | 6 | # from The Microwindows Project (http://microwindows.org) |
7 | # | 7 | # |
8 | # modified 09/13/02 correct output when no DEFAULT_CHAR, allow numeric font name | ||
8 | # modified 09/12/02 added -limit <max_encode_hex_value> option | 9 | # modified 09/12/02 added -limit <max_encode_hex_value> option |
9 | # modified on 09/10/02 by G Haerr | 10 | # modified on 09/10/02 by G Haerr |
10 | # - fixed DWIDTH 0 parsing | 11 | # - fixed DWIDTH 0 parsing |
@@ -79,7 +80,7 @@ print " descent: $font_descent\n"; | |||
79 | print "*/\n\n"; | 80 | print "*/\n\n"; |
80 | 81 | ||
81 | print "/* Font character bitmap data. */\n"; | 82 | print "/* Font character bitmap data. */\n"; |
82 | print "static MWIMAGEBITS ${font}_bits[] = {\n"; | 83 | print "static MWIMAGEBITS _${font}_bits[] = {\n"; |
83 | 84 | ||
84 | $ch_height = $font_ascent + $font_descent; | 85 | $ch_height = $font_ascent + $font_descent; |
85 | $ofs = 0; | 86 | $ofs = 0; |
@@ -162,8 +163,10 @@ print "};\n\n"; | |||
162 | 163 | ||
163 | ##print STDERR "Maximum character width=$maxwidth\n"; | 164 | ##print STDERR "Maximum character width=$maxwidth\n"; |
164 | 165 | ||
166 | $default_char = $firstchar if !defined $default_char; | ||
167 | |||
165 | print "/* Character->glyph mapping. */\n"; | 168 | print "/* Character->glyph mapping. */\n"; |
166 | print "static unsigned long ${font}_offset[] = {\n"; | 169 | print "static unsigned long _${font}_offset[] = {\n"; |
167 | for (my $i = $firstchar; $i <= $lastchar; $i++) { | 170 | for (my $i = $firstchar; $i <= $lastchar; $i++) { |
168 | my $char = $i; | 171 | my $char = $i; |
169 | my $ofs = $encoding_tab[$i]; | 172 | my $ofs = $encoding_tab[$i]; |
@@ -177,13 +180,13 @@ $gen_width_table = 0; | |||
177 | for (my $i = $firstchar; $i <= $lastchar; $i++) { | 180 | for (my $i = $firstchar; $i <= $lastchar; $i++) { |
178 | my $char = $i; | 181 | my $char = $i; |
179 | my $width = $width[$i]; | 182 | my $width = $width[$i]; |
180 | $width = $width[$default_char], $char = $default_char if !defined $encoding_tab[$i]; | 183 | $width = $width[$default_char] if !defined $encoding_tab[$i]; |
181 | $gen_width_table = 1 if $width != $maxwidth | 184 | $gen_width_table = 1 if $width != $maxwidth |
182 | } | 185 | } |
183 | 186 | ||
184 | if ($gen_width_table) { | 187 | if ($gen_width_table) { |
185 | print "/* Character width data. */\n"; | 188 | print "/* Character width data. */\n"; |
186 | print "static unsigned char ${font}_width[] = {\n"; | 189 | print "static unsigned char _${font}_width[] = {\n"; |
187 | for (my $i = $firstchar; $i <= $lastchar; $i++) { | 190 | for (my $i = $firstchar; $i <= $lastchar; $i++) { |
188 | my $char = $i; | 191 | my $char = $i; |
189 | my $width = $width[$i]; | 192 | my $width = $width[$i]; |
@@ -204,11 +207,11 @@ print " $ch_height,\n"; | |||
204 | print " $font_ascent,\n"; | 207 | print " $font_ascent,\n"; |
205 | print " $firstchar,\n"; | 208 | print " $firstchar,\n"; |
206 | print " $size,\n"; | 209 | print " $size,\n"; |
207 | print " ${font}_bits,\n"; | 210 | print " _${font}_bits,\n"; |
208 | print " ${font}_offset,\n"; | 211 | print " _${font}_offset,\n"; |
209 | if ($gen_width_table) { | 212 | if ($gen_width_table) { |
210 | print " ${font}_width,\n"; | 213 | print " _${font}_width,\n"; |
211 | } else { print " 0, /* fixed width*/\n"; } | 214 | } else { print " 0, /* fixed width*/\n"; } |
212 | print " $default_char,\n"; | 215 | print " $default_char,\n"; |
213 | print " sizeof(${font}_bits)/sizeof(MWIMAGEBITS),\n"; | 216 | print " sizeof(_${font}_bits)/sizeof(MWIMAGEBITS),\n"; |
214 | print "};\n"; | 217 | print "};\n"; |
diff --git a/tools/writerbf.c b/tools/writerbf.c index b3ba8649ac..3bd55a7c80 100644 --- a/tools/writerbf.c +++ b/tools/writerbf.c | |||
@@ -80,6 +80,7 @@ rbf_write_font(PMWCFONT pf) | |||
80 | WRITESHORT(ofp, pf->maxwidth); | 80 | WRITESHORT(ofp, pf->maxwidth); |
81 | WRITESHORT(ofp, pf->height); | 81 | WRITESHORT(ofp, pf->height); |
82 | WRITESHORT(ofp, pf->ascent); | 82 | WRITESHORT(ofp, pf->ascent); |
83 | WRITESHORT(ofp, 0); | ||
83 | WRITELONG(ofp, pf->firstchar); | 84 | WRITELONG(ofp, pf->firstchar); |
84 | WRITELONG(ofp, pf->defaultchar); | 85 | WRITELONG(ofp, pf->defaultchar); |
85 | WRITELONG(ofp, pf->size); | 86 | WRITELONG(ofp, pf->size); |
@@ -92,9 +93,13 @@ rbf_write_font(PMWCFONT pf) | |||
92 | /* variable font data*/ | 93 | /* variable font data*/ |
93 | for (i=0; i<pf->bits_size; ++i) | 94 | for (i=0; i<pf->bits_size; ++i) |
94 | WRITESHORT(ofp, pf->bits[i]); | 95 | WRITESHORT(ofp, pf->bits[i]); |
96 | if (ftell(ofp) & 2) | ||
97 | WRITESHORT(ofp, 0); /* pad to 32-bit boundary*/ | ||
98 | |||
95 | if (pf->offset) | 99 | if (pf->offset) |
96 | for (i=0; i<pf->size; ++i) | 100 | for (i=0; i<pf->size; ++i) |
97 | WRITELONG(ofp, pf->offset[i]); | 101 | WRITELONG(ofp, pf->offset[i]); |
102 | |||
98 | if (pf->width) | 103 | if (pf->width) |
99 | for (i=0; i<pf->size; ++i) | 104 | for (i=0; i<pf->size; ++i) |
100 | WRITEBYTE(ofp, pf->width[i]); | 105 | WRITEBYTE(ofp, pf->width[i]); |