diff options
author | P. J. McDermott <pj@pehjota.net> | 2014-07-12 02:12:00 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2014-07-12 02:12:00 (EDT) |
commit | ba30561bf216ff20b2f0eb05f5914d40c3601494 (patch) | |
tree | 320243c48e32f43a5ed37b4bdf659bcc4f42af39 | |
parent | 628c955c5700f7ec8f9ece9706683c7e5c8eafdd (diff) |
bdf2fbcon: Adjust font id and idx/name keys
-rwxr-xr-x | bin/bdf2fbcon | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/bin/bdf2fbcon b/bin/bdf2fbcon index d3e96ab..268f882 100755 --- a/bin/bdf2fbcon +++ b/bin/bdf2fbcon @@ -184,6 +184,7 @@ sub init_font $font = { 'comments' => [], + 'id' => undef, 'idx' => undef, 'name' => undef, 'width' => undef, @@ -192,7 +193,7 @@ sub init_font 'pref' => 0, }; - $font->{'name'} = $opts{'n'} if (exists($opts{'n'})); + $font->{'id'} = $opts{'n'} if (exists($opts{'n'})); $font->{'width'} = $opts{'w'} if (exists($opts{'w'})); $font->{'height'} = $opts{'h'} if (exists($opts{'h'})); $font->{'pref'} = $opts{'p'} if (exists($opts{'p'})); @@ -260,7 +261,7 @@ sub parse_bdf_2_1 } } elsif ($section == BDF_2_1_SECTION_PROPERTIES) { if ($stmt eq 'FONT_NAME') { - $font->{'name'} = $arg unless ($font->{'name'}); + $font->{'id'} = $arg unless ($font->{'id'}); } elsif ($stmt eq 'FIGURE_WIDTH') { $figure_margin = int(($font->{'width'} - $arg) / 2); @@ -312,10 +313,11 @@ sub write_fbcon $bytes_x = int(($font->{'width'} + 7) / 8); - $font->{'idx'} = uc($font->{'name'}); + $font->{'idx'} = uc($font->{'id'}); $font->{'idx'} =~ s/[^A-Z0-9_]/_/g; - $font->{'name'} = lc($font->{'name'}); - $font->{'name'} =~ s/[^a-z0-9_]/_/g; + $font->{'name'} = $font->{'idx'}; + $font->{'id'} = lc($font->{'id'}); + $font->{'id'} =~ s/[^a-z0-9_]/_/g; for (@{$font->{'comments'}}) { printf($output_fh "/* %s */\n", $_); @@ -326,7 +328,7 @@ sub write_fbcon $bytes_x * $font->{'height'} * 256); printf($output_fh "static const unsigned char" . " fontdata_%s[FONTDATAMAX] = {\n", - $font->{'name'}); + $font->{'id'}); for ($i = 0; $i < 256; ++$i) { $char = $font->{'chars'}[$i]; @@ -349,12 +351,12 @@ sub write_fbcon printf($output_fh "\n};\n\n"); printf($output_fh "const struct font_desc font_%s = {\n", - $font->{'name'}); + $font->{'id'}); printf($output_fh "\t.idx\t= %s_IDX,\n", $font->{'idx'}); printf($output_fh "\t.name\t= \"%s\",\n", $font->{'idx'}); printf($output_fh "\t.width\t= %d,\n", $font->{'width'}); printf($output_fh "\t.height\t= %d,\n", $font->{'height'}); - printf($output_fh "\t.data\t= fontdata_%s,\n", $font->{'name'}); + printf($output_fh "\t.data\t= fontdata_%s,\n", $font->{'id'}); printf($output_fh "\t.pref\t= %d,\n", $font->{'pref'}); printf($output_fh "};\n"); } |