From 4bd0f4278fe360cd323d0fdd4702a2f24cbedd9b Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sat, 12 Jul 2014 01:58:59 -0400 Subject: bdf2fbcon: Add -n option to override font name --- diff --git a/bin/bdf2fbcon b/bin/bdf2fbcon index 23bbb15..21172cd 100755 --- a/bin/bdf2fbcon +++ b/bin/bdf2fbcon @@ -32,6 +32,7 @@ sub main "no_getopt_compat"); if (not GetOptions(\%opts, "o=s", + "n=s", "s=s", "p=s", "h|help", @@ -49,6 +50,9 @@ sub main version(*STDOUT); exit(0); } + if (exists($opts{'n'})) { + $convert_opts{'n'} = $opts{'n'}; + } if (exists($opts{'s'})) { $convert_opts{'w'} = $convert_opts{'h'} = $opts{'s'}; $convert_opts{'w'} =~ s/x.*//; @@ -90,6 +94,7 @@ sub help 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"); @@ -187,6 +192,7 @@ sub init_font 'pref' => 0, }; + $font->{'name'} = $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'})); @@ -254,10 +260,12 @@ sub parse_bdf_2_1 } } elsif ($section == BDF_2_1_SECTION_PROPERTIES) { if ($stmt eq 'FONT_NAME') { - $font->{'idx'} = uc($arg); - $font->{'idx'} =~ s/[^A-Z0-9_]//g; - $font->{'name'} = lc($arg); - $font->{'name'} =~ s/[^a-z0-9_]/_/g; + unless ($font->{'name'}) { + $font->{'idx'} = uc($arg); + $font->{'idx'} =~ s/[^A-Z0-9_]//g; + $font->{'name'} = lc($arg); + $font->{'name'} =~ s/[^a-z0-9_]/_/g; + } } elsif ($stmt eq 'FIGURE_WIDTH') { $figure_margin = int(($font->{'width'} - $arg) / 2); @@ -374,6 +382,10 @@ fonts. Place the output into I. +=item B<-n> I + +Set the font name to I. + =item B<-s> IxI Override the font size. -- cgit v0.9.1