summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2014-07-11 20:10:31 (EDT)
committer P. J. McDermott <pj@pehjota.net>2014-07-11 20:10:31 (EDT)
commit98174cb391042ba9201423aeb2766300f473f61a (patch)
tree1795a1a1f0193adffc1e072e8c8e917135a7c5e6
parentc9aa4b7de6aa0ceaeca628c2b30a913781d5c758 (diff)
write_fbcon(): Write bitmaps
-rwxr-xr-xbin/bdf2fbcon18
1 files changed, 17 insertions, 1 deletions
diff --git a/bin/bdf2fbcon b/bin/bdf2fbcon
index f7501b1..85e469e 100755
--- a/bin/bdf2fbcon
+++ b/bin/bdf2fbcon
@@ -283,8 +283,14 @@ sub parse_bdf_2_1
sub write_fbcon
{
my ($output_fh, $font) = @_;
+ my $bytes_x;
my $i;
my $char;
+ my $j;
+ my $bitmap;
+ my $k;
+
+ $bytes_x = int(($font->{'width'} + 7) / 8);
for (@{$font->{'comments'}}) {
printf($output_fh "/* %s */\n", $_);
@@ -292,7 +298,7 @@ sub write_fbcon
printf($output_fh "/* Generated by bdf2fbcon */\n\n");
printf($output_fh "#include <linux/font.h>\n\n");
printf($output_fh "#define FONTDATAMAX %d\n\n",
- int(($font->{'width'} + 7) / 8) * $font->{'height'} * 256);
+ $bytes_x * $font->{'height'} * 256);
printf($output_fh "static const unsigned char" .
" fontdata_%s[FONTDATAMAX] = {\n",
$font->{'name'});
@@ -301,6 +307,16 @@ sub write_fbcon
$char = $font->{'chars'}[$i];
printf($output_fh "\n\t/* %3d 0x%02x '%s' */\n",
$i, $i, $char->{'name'});
+ for ($j = 0; $j < $font->{'height'}; ++$j) {
+ $bitmap = $char->{'bitmap'}[$i];
+ printf($output_fh "\t");
+ $bitmap <<= $bytes_x * 8 - $font->{'width'};
+ for (my $k = ($bytes_x - 1) * 8; $k >= 0; $k -= 8) {
+ printf("0x%02x, ", ($bitmap >> $k) & 0xFF);
+ }
+ printf($output_fh "/* %0" . $font->{'width'} . "b */\n",
+ $bitmap);
+ }
}
printf($output_fh "\n};\n\n");