gbranden pushed a commit to branch master
in repository groff.
commit b53278be5deb5b6bc4a290ee73ba1e9e1d326134
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Jul 4 04:14:25 2025 -0500
[gropdf]: Add `-W` option.
... to make font embedding warnings fatal.
* src/devices/gropdf/gropdf.pl: Add global scalar `makeWarningsFatal`.
Recognize option when calling `GetOptions()`.
(LoadFont): Fall over dead if embedding fails.
* src/devices/gropdf/gropdf.pl (usage):
* src/devices/gropdf/gropdf.1.man (Options): Document it.
Begins fixing Savannah #67268.
---
ChangeLog | 14 ++++++++++++++
src/devices/gropdf/gropdf.1.man | 13 +++++++++++--
src/devices/gropdf/gropdf.pl | 9 ++++++---
3 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 524ed1820..cf4430a05 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2025-07-04 G. Branden Robinson <[email protected]>
+
+ [gropdf]: Add `-W` option to make font embedding warnings fatal.
+
+ * src/devices/gropdf/gropdf.pl: Add global scalar
+ `makeWarningsFatal`. Recognize option when calling
+ `GetOptions()`.
+ (LoadFont): Fall over dead if embedding fails.
+
+ * src/devices/gropdf/gropdf.pl (usage):
+ * src/devices/gropdf/gropdf.1.man (Options): Document it.
+
+ Begins fixing Savannah #67268.
+
2025-07-01 Deri James <[email protected]>
[gropdf] More rational handling of duplicate font entries.
diff --git a/src/devices/gropdf/gropdf.1.man b/src/devices/gropdf/gropdf.1.man
index 9adc37b2b..7a343e400 100644
--- a/src/devices/gropdf/gropdf.1.man
+++ b/src/devices/gropdf/gropdf.1.man
@@ -9,7 +9,7 @@ output driver for Portable Document Format
.\" Legal Terms
.\" ====================================================================
.\"
-.\" Copyright (C) 2011-2024 Free Software Foundation, Inc.
+.\" Copyright (C) 2011-2025 Free Software Foundation, Inc.
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
@@ -64,7 +64,7 @@ output driver for Portable Document Format
.\" ====================================================================
.
.SY gropdf
-.RB [ \-dels ]
+.RB [ \-delsW ]
.RB [ \-F\~\c
.IR font-directory ]
.RB [ \-I\~\c
@@ -252,6 +252,15 @@ You can include your own CMap by specifying a
or have no CMap at all by omitting the argument.
.
.
+.TP
+.B \-W
+Exit with failure status if font embedding fails.
+.
+Normally,
+.I gropdf
+issues a warning diagnostic and proceeds.
+.
+.
.\" .TP
.\" .BI \-w n
.\" Lines should be drawn using a thickness of
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index 89deb83c1..2a7066a53 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -449,7 +449,7 @@ sub usage
my $had_error = shift;
$stream = *STDERR if $had_error;
print $stream
-"usage: $prog [-dels] [-F font-directory] [-I inclusion-directory]" .
+"usage: $prog [-delsW] [-F font-directory] [-I inclusion-directory]" .
" [-p paper-format] [-u [cmap-file]] [-y foundry] [file ...]\n" .
"usage: $prog {-v | --version}\n" .
"usage: $prog --help\n";
@@ -489,12 +489,13 @@ my %seac;
my $thisfnt;
my $parcln=qr/\[[^\]]*?\]|(.)((?!\1).)*\1/;
my $parclntyp=qr/(?:[\d\w]|\([+-]?[\S]{2}|$parcln)/;
+my $makeWarningsFatal=0;
if (!GetOptions('F=s' => \@fdlist, 'I=s' => \@idirs, 'l' => \$frot,
'p=s' => \$fpsz, 'd!' => \$debug, 'help' => \$want_help, 'pdfver=f' =>
\$PDFver,
'v' => \$version, 'version' => \$version, 'opt=s' => \$options,
'e' => \$embedall, 'y=s' => \$Foundry, 's' => \$stats,
- 'u:s' => \$unicodemap))
+ 'u:s' => \$unicodemap, 'W' => \$makeWarningsFatal))
{
&usage(1);
}
@@ -3533,7 +3534,9 @@ sub LoadFont
}
else
{
- Warn("unable to embed font file for '$fnt{internalname}'"
+ my $sub=\&Warn;
+ $sub=\&Die if ($makeWarningsFatal);
+ &$sub("unable to embed font file for '$fnt{internalname}'"
. " ($ofontnm) (missing entry in 'download' file?)")
if $embedall;
}
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit