summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/bdf2fbcon19
1 files changed, 7 insertions, 12 deletions
diff --git a/bin/bdf2fbcon b/bin/bdf2fbcon
index 5511c3c..0e8e42a 100755
--- a/bin/bdf2fbcon
+++ b/bin/bdf2fbcon
@@ -43,7 +43,6 @@ sub init_font
{
my (%opts) = @_;
my $font;
- my $i;
$font = {
'comments' => [],
@@ -61,7 +60,7 @@ sub init_font
$font->{'height'} = $opts{'h'} if (exists($opts{'h'}));
$font->{'pref'} = $opts{'p'} if (exists($opts{'p'}));
- for ($i = 0; $i < 256; ++$i) {
+ foreach my $i (0 .. 255) {
$font->{'chars'}[$i] = {
'name' => '',
'encoding' => undef,
@@ -175,12 +174,9 @@ sub write_fbcon
my ($output, $font) = @_;
my $bytes_x;
my $output_fh;
- my $i;
my $char;
- my $j;
my $bitmap;
my $shifted_bitmap;
- my $k;
$bytes_x = int(($font->{'width'} + 7) / 8);
@@ -205,7 +201,7 @@ sub write_fbcon
}
}
- for (@{$font->{'comments'}}) {
+ foreach (@{$font->{'comments'}}) {
printf($output_fh "/* %s */\n", $_);
}
printf($output_fh "/* Generated by bdf2fbcon */\n\n");
@@ -216,19 +212,19 @@ sub write_fbcon
" fontdata_%s[FONTDATAMAX] = {\n",
$font->{'id'});
- for ($i = 0; $i < 256; ++$i) {
+ foreach my $i (0 .. 255) {
$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) {
+ foreach my $j (0 .. ($font->{'height'} - 1)) {
$bitmap = $char->{'bitmap'}[$j];
$bitmap = 0 unless ($bitmap);
printf($output_fh "\t");
$shifted_bitmap = $bitmap;
$shifted_bitmap <<= $bytes_x * 8 - $font->{'width'};
- for ($k = ($bytes_x - 1) * 8; $k >= 0; $k -= 8) {
+ foreach my $k (reverse(0 .. ($bytes_x - 1))) {
printf($output_fh "0x%02x, ",
- ($shifted_bitmap >> $k) & 0xFF);
+ ($shifted_bitmap >> ($k * 8)) & 0xFF);
}
printf($output_fh "/* %0" . $font->{'width'} . "b */\n",
$bitmap);
@@ -341,7 +337,6 @@ sub main
{
my %opts;
my %convert_opts;
- my $input;
Getopt::Long::Configure("no_ignore_case", "bundling", "gnu_compat",
"no_getopt_compat");
@@ -391,7 +386,7 @@ sub main
return 4;
}
} else {
- for $input (@ARGV) {
+ foreach my $input (@ARGV) {
if (not convert($input, undef, %convert_opts)) {
return 4;
}