diff options
Diffstat (limited to 'tools/bdf2c')
-rwxr-xr-x | tools/bdf2c | 19 |
1 files changed, 11 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"; |