groff-commit
[Top][All Lists]
Advanced

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

[groff] 03/03: Changes to allow configure to check for URW fonts


From: Deri James
Subject: [groff] 03/03: Changes to allow configure to check for URW fonts
Date: Sat, 21 Sep 2019 11:32:27 -0400 (EDT)

deri pushed a commit to branch master
in repository groff.

commit f61c6ca5b84b488cbd324f2d23285fff1d807f04
Author: Deri James <address@hidden>
Date:   Sat Sep 21 16:27:05 2019 +0100

    Changes to allow configure to check for URW fonts
    
    * font/devpdf/util/BuildFoundries.pl: Call the program with
    --dirURW with path provided to ./configure, and --check to do
    a dry-run just checking if the fonts are available. (bug #56748)
---
 ChangeLog                          |  20 +++++++
 font/devpdf/util/BuildFoundries.pl | 117 ++++++++++++++++++++++++++++++++-----
 2 files changed, 123 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e8f377c..857264a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2019-09-21  Deri James  <address@hidden>
+
+       Changes to allow configure to check for URW fonts
+
+       * font/devpdf/util/BuildFoundries.pl: Call the program with
+       --dirURW with path provided to ./configure, and --check to do
+       a dry-run just checking if the fonts are available. (bug #56748)
+
+2019-09-21  Deri James  <address@hidden>
+
+       Add new ghostscript font names (bug #56748)
+
+       * font/devpdf/Foundry.in: Add changed font names
+
+2019-09-21  Deri James  <address@hidden>
+
+       Prevent gropdf executing arbitrary commands
+
+       * src/devices/gropdf/gropdf.pl: See bug #55557
+
 2019-09-15  G. Branden Robinson <address@hidden>
 
        * tmac/an-old.tmac: Move test for definitions of CS and CT
diff --git a/font/devpdf/util/BuildFoundries.pl 
b/font/devpdf/util/BuildFoundries.pl
index f8af826..e4b657d 100644
--- a/font/devpdf/util/BuildFoundries.pl
+++ b/font/devpdf/util/BuildFoundries.pl
@@ -22,6 +22,12 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 use strict;
+use Getopt::Long;
+
+my $check=0;
+my $dirURW='';
+
+GetOptions("check" => \$check, "dirURW=s" => \$dirURW);
 
 (my $progname = $0) =~s @.*/@@;
 my $where=shift||'';
@@ -32,11 +38,19 @@ my $GSpath=FindGSpath();
 my $warn=0;
 my $lct=0;
 my $foundry='';        # the default foundry
+my $notFoundFont=0;
 
-LoadDownload("download");
-LoadFoundry("Foundry");
-WriteDownload("download");
-
+if ($check)
+{
+    CheckFoundry("Foundry.in");
+    exit $notFoundFont;
+}
+else
+{
+    LoadDownload("download");
+    LoadFoundry("Foundry");
+    WriteDownload("download");
+}
 exit 0;
 
 
@@ -45,7 +59,7 @@ sub LoadFoundry
 {
     my $fn=shift;
     my $foundrypath='';
-    my $notFoundFont=0;
+    $notFoundFont=0;
 
     open(F,"<$fn") or Die("No $fn file found");
 
@@ -72,7 +86,9 @@ sub LoadFoundry
        {
            Warn("\nThe path(s) used for searching:\n$foundrypath\n") if 
$notFoundFont;
            $foundry=uc($r[1]);
-           $foundrypath=$r[2].' : '.$devps;
+            $foundrypath='';
+            $foundrypath.="$dirURW : " if $dirURW;
+           $foundrypath.=$r[2].' : '.$devps;
            $foundrypath=~s/\(gs\)/$GSpath /;
            $notFoundFont=0;
        }
@@ -84,13 +100,6 @@ sub LoadFoundry
            # 3=map file
            # 4=encoding file
            # 5=font file
-           # 6=afm file
-
-           if (!defined($r[6]) or $r[6] eq '')
-           {
-               # if no afm file, have a guess!
-               $r[6]=substr($r[5],0,-3)."afm";
-           }
 
            my $gfont=($foundry eq '')?$r[0]:"$foundry-$r[0]";
 
@@ -126,7 +135,7 @@ sub LoadFoundry
            else
            {
                # We need to run afmtodit to create this groff font
-               my 
$psfont=RunAfmtodit($gfont,LocateAF($foundrypath,$r[6]),$r[2],$r[3],$r[4]);
+               my 
$psfont=RunAfmtodit($gfont,LocateAF($foundrypath,$r[5]),$r[2],$r[3],$r[4]);
 
                if ($psfont)
                {
@@ -230,6 +239,15 @@ sub LocateFile
 
     foreach my $file (split('!',$files))
     {
+        if ($tryafm)
+        {
+            if (!($file=~s/\..+$/.afm/))
+            {
+                # no extenaion
+                $file.='.afm';
+            }
+        }
+
     if ($file=~m'/')
     {
        # path given with file name so no need to search the paths
@@ -458,3 +476,74 @@ sub Msg {
     my $msg=shift;
     print STDERR "$progname: $msg\n";
 }
+
+sub CheckFoundry
+{
+    my $fn=shift;
+    my $foundrypath='';
+    $notFoundFont=0;
+
+    open(F,"<$fn") or Die("No $fn file found");
+
+    while (<F>)
+    {
+       chomp;
+       s/\r$//;        # in case edited in windows
+
+       s/\s*#.*?$//;   # remove comments
+
+       next if $_ eq '';
+
+       if (m/^[A-Za-z]=/)
+       {
+           next;
+       }
+
+       my (@r)=split('\|');
+
+       if (lc($r[0]) eq 'foundry')
+       {
+           $foundry=uc($r[1]);
+            $foundrypath='';
+            $foundrypath.="$dirURW : " if $dirURW;
+           $foundrypath.=$r[2].' : '.$devps;
+           $foundrypath=~s/\(gs\)/$GSpath /;
+       }
+       else
+       {
+           # 0=groff font name
+           # 1=IsBase Y/N (one of PDFs 14 base fonts)
+           # 2=afmtodit flag
+           # 3=map file
+           # 4=encoding file
+           # 5=font file
+
+           my $gfont=($foundry eq '')?$r[0]:"$foundry-$r[0]";
+
+           if ($r[2] eq '')
+           {
+               # Don't run afmtodit, just copy the grops font file
+
+               my $gotf=1;
+               my $gropsfnt=LocateFile($devps,$r[0],0);
+
+               if ($gropsfnt ne '' and -r "$gropsfnt")
+               {
+
+               }
+               else
+               {
+                    $notFoundFont|=1;
+               }
+           }
+           else
+           {
+               # We need to run afmtodit to create this groff font
+               $notFoundFont|=2 if !LocateAF($foundrypath,$r[5]);
+               $notFoundFont|=1 if !LocatePF($foundrypath,$r[5]);
+           }
+       }
+    }
+
+    close();
+}



reply via email to

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