[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 21/40: [afmtodit]: Implement "-w" command-line option.
From: |
G. Branden Robinson |
Subject: |
[groff] 21/40: [afmtodit]: Implement "-w" command-line option. |
Date: |
Sat, 12 Nov 2022 14:43:37 -0500 (EST) |
gbranden pushed a commit to branch master
in repository groff.
commit 5a5a447b2a834f92112609a67821c1a37fdc66cd
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Nov 11 15:49:24 2022 -0600
[afmtodit]: Implement "-w" command-line option.
* src/utils/afmtodit/afmtodit.pl: Add new command-line option to specify
the generated font description's "spacewidth" parameter; in commit
bf7f6862c3, 2021-09-24, I made libgroff complain if this directive is
missing (since any font, even a "special" one, can be selected as
current and the formatter's behavior when encountering an input space
should be well-defined under that circumstance). Adding this option
enables a well-formed font description to be produced.
* src/utils/afmtodit/afmtodit.pl (usage):
* src/utils/afmtodit/afmtodit.1.man (Synopsis, Options): Document it.
* NEWS: Add item.
---
ChangeLog | 15 +++++++++++++++
NEWS | 7 +++++++
src/utils/afmtodit/afmtodit.1.man | 9 +++++++++
src/utils/afmtodit/afmtodit.pl | 13 ++++++++++---
4 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e2a74725f..5095d3a16 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2022-11-09 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * src/utils/afmtodit/afmtodit.pl: Add new command-line option to
+ specify the generated font description's "spacewidth" parameter;
+ in commit bf7f6862c3, 2021-09-24, I made libgroff complain if
+ this directive is missing (since any font, even a "special" one,
+ can be selected as current and the formatter's behavior when
+ encountering an input space should be well-defined under that
+ circumstance). Adding this option enables a well-formed font
+ description to be produced.
+ * src/utils/afmtodit/afmtodit.pl (usage):
+ * src/utils/afmtodit/afmtodit.1.man (Synopsis, Options):
+ Document it.
+ * NEWS: Add item.
+
2022-11-09 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/utils/afmtodit/afmtodit.pl: Use our own fatal exit
diff --git a/NEWS b/NEWS
index 58839e233..040a9cc35 100644
--- a/NEWS
+++ b/NEWS
@@ -606,6 +606,13 @@ o afmtodit no longer writes file names with directory
information in
o afmtodit now exits with status 2 (not 1) upon usage errors.
+o afmtodit now recognizes a '-w' option to specify the generated font
+ description's "spacewidth" parameter (see groff_font(5)). The
+ internal library "libgroff" now emits a diagnostic if a font
+ description file is missing such a directive. Adding this option
+ enables a well-formed font description to be produced by the tool
+ (without requiring editing by hand).
+
o pfbtops now exits with status 2 upon usage errors and the standard C
library's `EXIT_FAILURE` status (usually 1) on operational failures
instead of vice versa.
diff --git a/src/utils/afmtodit/afmtodit.1.man
b/src/utils/afmtodit/afmtodit.1.man
index daf73b95b..162fca5a0 100644
--- a/src/utils/afmtodit/afmtodit.1.man
+++ b/src/utils/afmtodit/afmtodit.1.man
@@ -50,6 +50,8 @@ PostScript and PDF output
.IR italic-correction-factor ]
.RB [ \-o\~\c
.IR output-file ]
+.RB [ \-w\~\c
+.IR space-width ]
.I afm-file
.I map-file
.I font-description-file
@@ -441,6 +443,13 @@ directive to the font description file.
.
.
.TP
+.BI \-w\~ space-width
+Use
+.I space-width
+as the with of inter-word spaces.
+.
+.
+.TP
.B \-x
Don't use the built-in Adobe Glyph List.
.
diff --git a/src/utils/afmtodit/afmtodit.pl b/src/utils/afmtodit/afmtodit.pl
index 3c40f1597..c6b67cc45 100644
--- a/src/utils/afmtodit/afmtodit.pl
+++ b/src/utils/afmtodit/afmtodit.pl
@@ -25,13 +25,15 @@ use strict;
my $prog = $0;
my $groff_sys_fontdir = "@FONTDIR@";
my $want_help;
+my $space_width = 0;
our ($opt_a, $opt_c, $opt_d, $opt_e, $opt_f, $opt_i, $opt_k,
$opt_m, $opt_n, $opt_o, $opt_s, $opt_v, $opt_x);
use Getopt::Long qw(:config gnu_getopt);
GetOptions( "a=s", "c", "d=s", "e=s", "f=s", "i=s", "k", "m", "n",
- "o=s", "s", "v", "x", "version" => \$opt_v, "help" => \$want_help
+ "o=s", "s", "v", "w=i" => \$space_width, "x", "version" => \$opt_v,
+ "help" => \$want_help
);
my $afmtodit_version = "GNU afmtodit (groff) version @VERSION@";
@@ -54,7 +56,8 @@ sub usage {
print $stream "usage: $prog [-ckmnsx] [-a slant]" .
" [-d device-description-file] [-e encoding-file]" .
" [-f internal-name] [-i italic-correction-factor]" .
- " [-o output-file] afm-file map-file font-description-file\n" .
+ " [-o output-file] [-w space-width] afm-file map-file" .
+ " font-description-file\n" .
"usage: $prog {-v | --version}\n" .
"usage: $prog --help\n";
unless ($had_error) {
@@ -479,11 +482,15 @@ print("\n");
my $name = $fontfile;
$name =~ s@.*/@@;
+my $sw = 0;
+$sw = conv($width{"space"}) if defined $width{"space"};
+$sw = $space_width if ($space_width);
+
print("name $name\n");
print("internalname $psname\n") if $psname;
print("special\n") if $opt_s;
printf("slant %g\n", $italic_angle) if $italic_angle != 0;
-printf("spacewidth %d\n", conv($width{"space"})) if defined $width{"space"};
+printf("spacewidth %d\n", $sw) if $sw;
if ($opt_e) {
my $e = $opt_e;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 21/40: [afmtodit]: Implement "-w" command-line option.,
G. Branden Robinson <=