gbranden pushed a commit to branch master
in repository groff.
commit 645a371a568b2e2cd518ba5505eb69259af3d065
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Jul 7 10:54:20 2022 -0500
[devpdf]: Check for errors more.
* font/devpdf/util/BuildFoundries.pl: Add Boolean-value scalar
`beStrict` (defaults false) and new command-line option `--strict` to
make it true.
(LoadFoundry): Check return value of subroutine `LocateAF`. Emit
diagnostic if it is null, as a warning if not "strict", and fatal if
so.
---
ChangeLog | 9 +++++++++
font/devpdf/util/BuildFoundries.pl | 15 ++++++++++++---
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a9b244fc..a8ad7e85 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-07-07 G. Branden Robinson <[email protected]>
+
+ * font/devpdf/util/BuildFoundries.pl: Add Boolean-value scalar
+ `beStrict` (defaults false) and new command-line option
+ `--strict` to make it true.
+ (LoadFoundry): Check return value of subroutine `LocateAF`.
+ Emit diagnostic if it is null, as a warning if not "strict", and
+ fatal if so.
+
2022-07-07 G. Branden Robinson <[email protected]>
* font/devpdf/devpdf.am (font/devpdf/util/BuildFoundries): Add
diff --git a/font/devpdf/util/BuildFoundries.pl
b/font/devpdf/util/BuildFoundries.pl
index 76c1bef8..a0e498e6 100644
--- a/font/devpdf/util/BuildFoundries.pl
+++ b/font/devpdf/util/BuildFoundries.pl
@@ -28,8 +28,10 @@ my $pathsep='@PATH_SEPARATOR@';
my $check=0;
my $dirURW='';
+my $beStrict=0;
-GetOptions("check" => \$check, "dirURW=s" => \$dirURW);
+GetOptions("check" => \$check, "dirURW=s" => \$dirURW,
+ "strict" => \$beStrict);
(my $progname = $0) =~s @.*/@@;
my $where=shift||'';
@@ -142,8 +144,15 @@ sub LoadFoundry
}
else
{
- # We need to run afmtodit to create this groff font
- my
$psfont=RunAfmtodit($gfont,LocateAF($foundrypath,$r[5]),$r[2],$r[3],$r[4]);
+ # Use afmtodit to create a groff font description file.
+ my $afmfile=LocateAF($foundrypath,$r[5]);
+ if (!$afmfile) {
+ my $sub=\&Warn;
+ $sub=\&Die if ($beStrict);
+ &$sub("cannot locate AFM file for font '$gfont'");
+ next;
+ }
+ my $psfont=RunAfmtodit($gfont,$afmfile,$r[2],$r[3],$r[4]);
if ($psfont)
{
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit