Added script to generate src/zm_bigfont.h

Also added a line to the header of src/zm_bigfont.h on how it is
generated.
pull/1278/head
Robin Daermann 2016-02-10 11:28:56 +01:00
parent cb1514193f
commit 226b77bb63
2 changed files with 41 additions and 0 deletions

View File

@ -2,6 +2,7 @@
/* */
/* Font file generated by schrorg */
/* based on the font file generated by rthelen */
/* using utils/mk_bigfont.pl */
/* */
/***********************************************************/

40
utils/mk_bigfont.pl Executable file
View File

@ -0,0 +1,40 @@
#!/usr/bin/env perl
use strict;
use warnings;
my $in_head = 1;
open F, '<', '../src/zm_font.h';
print <<EOHEAD;
/***********************************************************/
/* */
/* Font file generated by schrorg */
/* based on the font file generated by rthelen */
/* using utils/mk_bigfont.pl */
/* */
/***********************************************************/
EOHEAD
while (my $line = <F>) {
$in_head-- if $line =~ /^$/ and $in_head;
next while $in_head;
unless ($line =~ /^\s+(0x..), \/\* (........)/) {
$line =~ s/static unsigned char fontdata/static unsigned int bigfontdata/;
print $line;
next;
}
my $code = $1;
my $bincode = $2;
$bincode = "$1$1$2$2$3$3$4$4$5$5$6$6$7$7$8$8" if $bincode =~ /(.)(.)(.)(.)(.)(.)(.)(.)$/;
$bincode =~ s/ /1/g;
my $intcode = unpack("N", pack("B32", substr("0" x 32 . $bincode, -32)));
my $hexcode = sprintf("%#x", $intcode);
$hexcode =~ s/^0$/0x0/;
$bincode =~ s/1/ /g;
print sprintf("\t%10s, /* %s */\n", $hexcode, $bincode);
print sprintf("\t%10s, /* %s */\n", $hexcode, $bincode);
}
close F;