From 8b38f44cd3e9059c7f7bdcf79b3f2ade4682e346 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sat, 29 Jun 2019 19:56:55 -0400 Subject: Replace indirect object notation --- diff --git a/bin/bdf2fbcon b/bin/bdf2fbcon index 0e8e42a..b06d22a 100755 --- a/bin/bdf2fbcon +++ b/bin/bdf2fbcon @@ -8,6 +8,7 @@ bdf2fbcon - Convert Glyph Bitmap Distribution Format fonts to Linux fbcon fonts use strict; use warnings; +no indirect; use Getopt::Long; @@ -25,7 +26,7 @@ sub warning { my ($fmt, @args) = @_; - printf(STDERR "bdf2fbcon: Warning: " . $fmt . "\n", @args); + STDERR->printf("bdf2fbcon: Warning: " . $fmt . "\n", @args); return; } @@ -34,7 +35,7 @@ sub error { my ($fmt, @args) = @_; - printf(STDERR "bdf2fbcon: Error: " . $fmt . "\n", @args); + STDERR->printf("bdf2fbcon: Error: " . $fmt . "\n", @args); return; } @@ -202,45 +203,45 @@ sub write_fbcon } foreach (@{$font->{'comments'}}) { - printf($output_fh "/* %s */\n", $_); + $output_fh->printf("/* %s */\n", $_); } - printf($output_fh "/* Generated by bdf2fbcon */\n\n"); - printf($output_fh "#include \n\n"); - printf($output_fh "#define FONTDATAMAX %d\n\n", + $output_fh->printf("/* Generated by bdf2fbcon */\n\n"); + $output_fh->printf("#include \n\n"); + $output_fh->printf("#define FONTDATAMAX %d\n\n", $bytes_x * $font->{'height'} * 256); - printf($output_fh "static const unsigned char" . + $output_fh->printf("static const unsigned char" . " fontdata_%s[FONTDATAMAX] = {\n", $font->{'id'}); foreach my $i (0 .. 255) { $char = $font->{'chars'}[$i]; - printf($output_fh "\n\t/* %3d 0x%02x '%s' */\n", + $output_fh->printf("\n\t/* %3d 0x%02x '%s' */\n", $i, $i, $char->{'name'}); foreach my $j (0 .. ($font->{'height'} - 1)) { $bitmap = $char->{'bitmap'}[$j]; $bitmap = 0 unless ($bitmap); - printf($output_fh "\t"); + $output_fh->printf("\t"); $shifted_bitmap = $bitmap; $shifted_bitmap <<= $bytes_x * 8 - $font->{'width'}; foreach my $k (reverse(0 .. ($bytes_x - 1))) { - printf($output_fh "0x%02x, ", + $output_fh->printf("0x%02x, ", ($shifted_bitmap >> ($k * 8)) & 0xFF); } - printf($output_fh "/* %0" . $font->{'width'} . "b */\n", + $output_fh->printf("/* %0" . $font->{'width'} . "b */\n", $bitmap); } } - printf($output_fh "\n};\n\n"); - printf($output_fh "const struct font_desc font_%s = {\n", + $output_fh->printf("\n};\n\n"); + $output_fh->printf("const struct font_desc font_%s = {\n", $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->{'id'}); - printf($output_fh "\t.pref\t= %d,\n", $font->{'pref'}); - printf($output_fh "};\n"); + $output_fh->printf("\t.idx\t= %s_IDX,\n", $font->{'idx'}); + $output_fh->printf("\t.name\t= \"%s\",\n", $font->{'idx'}); + $output_fh->printf("\t.width\t= %d,\n", $font->{'width'}); + $output_fh->printf("\t.height\t= %d,\n", $font->{'height'}); + $output_fh->printf("\t.data\t= fontdata_%s,\n", $font->{'id'}); + $output_fh->printf("\t.pref\t= %d,\n", $font->{'pref'}); + $output_fh->printf("};\n"); if ($output ne "-") { close($output_fh); @@ -297,7 +298,7 @@ sub usage { my ($fh) = @_; - printf($fh "Usage: %s [-o ] ...\n", $0); + $fh->printf("Usage: %s [-o ] ...\n", $0); return; } @@ -307,13 +308,13 @@ sub help my ($fh) = @_; usage($fh); - print($fh "Options:\n"); - print($fh " -o Place the output into \n"); - print($fh " -n Set the font name to \n"); - print($fh " -s x Override the font size\n"); - print($fh " -p Set the font's preference to \n"); - print($fh " -h, --help Display this information\n"); - print($fh " -V, --version Display version information\n"); + $fh->print("Options:\n"); + $fh->print(" -o Place the output into \n"); + $fh->print(" -n Set the font name to \n"); + $fh->print(" -s x Override the font size\n"); + $fh->print(" -p Set the font's preference to \n"); + $fh->print(" -h, --help Display this information\n"); + $fh->print(" -V, --version Display version information\n"); return; } @@ -322,13 +323,13 @@ sub version { my ($fh) = @_; - printf($fh "bdf2fbcon %s\n", $VERSION); - print($fh "Copyright (C) 2013, 2014 Patrick \"P. J.\" McDermott\n"); - print($fh "License GPLv3+: GNU GPL version 3 or later " . + $fh->printf("bdf2fbcon %s\n", $VERSION); + $fh->print("Copyright (C) 2013, 2014 Patrick \"P. J.\" McDermott\n"); + $fh->print("License GPLv3+: GNU GPL version 3 or later " . ".\n"); - print($fh "This is free software: you are free to change and " . + $fh->print("This is free software: you are free to change and " . "redistribute it.\n"); - print($fh "There is NO WARRANTY, to the extent permitted by law.\n"); + $fh->print("There is NO WARRANTY, to the extent permitted by law.\n"); return; } -- cgit v0.9.1