Commit f4798cde authored by deuce's avatar deuce
Browse files

Start of unicode support... perl script to translate unifont to a C table.

parent b3c90233
my @sources = (
my %font;
foreach my $source (@sources) {
open IN,'<',$source;
while (<IN>) {
my ($code, $data) = split(':');
$code = hex($code);
$data =~ s/([0-9A-F]{2})/\\x$1/g;
if (defined $font{$code} && $font{$code} ne $data) {
if ($source ne './font/plane00/alt/codepage-437.hex') {
die "Item $code already exists ($source)!";
$font{$code} = $data;
close IN;
print "#include <stdint.h>\n";
print "#include <stdbool.h>\n\n";
print "struct unifont_entry {\n";
print " const uint32_t cp;\n";
print " const bool wide;\n";
print " const char * const data;\n";
print "};\n\n";
print "const struct unifont_entry unifont[",(scalar keys %font),"] = {\n";
foreach my $cp (sort {$a <=> $b} keys %font) {
my $wide = length($font{$cp}) > 64 ? 1 : 0;
printf(" {0x%05x, %d, \"%s\"},\n", $cp, $wide, $font{$cp});
print "};\n";
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment