groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 01/01: [gropdf]: Cater for invalid entries in download file.


From: Deri James
Subject: [groff] 01/01: [gropdf]: Cater for invalid entries in download file.
Date: Tue, 8 Nov 2022 16:07:26 -0500 (EST)

deri pushed a commit to branch master
in repository groff.

commit 7e5d433ba5ddc2389986a5c02f91eb57fc1de47d
Author: Deri James <deri@chuzzlewit.myzen.co.uk>
AuthorDate: Tue Nov 8 21:03:49 2022 +0000

    [gropdf]: Cater for invalid entries in download file.
    
    * src/devices/gropdf/gropdf.pl: Test if path in the download
    file points to a readable file. Also change order so that the
    first valid entry is used as the font to embed. This replaces
    previous order where last found entry is used.
    
    This change is discussed in <https://savannah.gnu.org/bugs/?62950>.
---
 ChangeLog                    | 11 +++++++++++
 src/devices/gropdf/gropdf.pl | 22 ++++++++++++++++++++--
 2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 51772ba24..d1ddb34b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2022-11-08  Deri James  <deri@chuzzlewit.myzen.co.uk>
+
+        [gropdf]: Cater for invalid entries in download file.
+
+        * src/devices/gropdf/gropdf.pl: Test if path in the download
+        file points to a readable file. Also change order so that the
+        first valid entry is used as the font to embed. This replaces
+        previous order where last found entry is used.
+
+        This change is discussed in <https://savannah.gnu.org/bugs/?62950>.
+
 2022-11-05  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [mdoc]: Set page topic in roman in "Name" section.
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index c8700f255..594a1463c 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -126,6 +126,7 @@ my $thislev=1;
 my $mark=undef;
 my $suspendmark=undef;
 my $boxmax=0;
+my %missing;    # fonts in download files which are not found/readable
 
 
 
@@ -667,7 +668,16 @@ sub LoadDownload
                $file=substr($file,1);
            }
 
-           $download{"$foundry $name"}=$file;
+            my $pth=$file;
+            $pth=$dir."/$devnm/$file" if substr($file,0,1) ne '/';
+
+            if (!-r $pth)
+            {
+                $missing{"$foundry $name"}="$dir/$devnm";
+                next;
+            }
+
+            $download{"$foundry $name"}=$file if !exists($download{"$foundry 
$name"});
        }
 
         close($f);
@@ -2538,9 +2548,17 @@ sub LoadFont
     }
     else
     {
-        Warn("unable to embed font file for '$fnt{internalname}'"
+        if (exists($missing{$fontkey}))
+        {
+            Warn("The download file in '$missing{$fontkey}' "
+            . " has erroneous entry for '$fnt{internalname} ($ofontnm)'");
+        }
+        else
+        {
+            Warn("unable to embed font file for '$fnt{internalname}'"
             . " ($ofontnm) (missing entry in 'download' file?)")
             if $embedall;
+        }
         $fno=++$objct;
         $fontlst{$fontno}->{OBJ}=BuildObj($objct,
                         {'Type' => '/Font',



reply via email to

[Prev in Thread] Current Thread [Next in Thread]