summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2014-07-12 01:58:59 (EDT)
committer P. J. McDermott <pj@pehjota.net>2014-07-12 01:58:59 (EDT)
commit4bd0f4278fe360cd323d0fdd4702a2f24cbedd9b (patch)
tree1ecc2dfc4a956fdfc321f3d512b6a0b0df12b66e
parent55dcc7f60e78d99417dc256e69c6566d36309771 (diff)
bdf2fbcon: Add -n option to override font name
-rwxr-xr-xbin/bdf2fbcon20
1 files changed, 16 insertions, 4 deletions
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 <output> Place the output into <output>\n");
+ print($fh " -n <name> Set the font name to <name>\n");
print($fh " -s <w>x<h> Override the font size\n");
print($fh " -p <pref> Set the font's preference to <pref>\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<output>.
+=item B<-n> I<name>
+
+Set the font name to I<name>.
+
=item B<-s> I<w>xI<h>
Override the font size.