groff
[Top][All Lists]
Advanced

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

Re: wrong URW font directory used by gropdf (was: installed 'gropdf' inc


From: G. Branden Robinson
Subject: Re: wrong URW font directory used by gropdf (was: installed 'gropdf' incorrectly used for compilation)
Date: Fri, 7 Oct 2022 04:35:55 -0500

At 2022-10-07T03:25:05-0500, G. Branden Robinson wrote:
> I don't have enough information to solve this, but I do have two ideas
> that I think may help flush it out.
> 
> 1.  Add the purportedly successful URW font location path to the
>     configuration report.
> 2.  Have gropdf report more context when croaking as shown above.  I
>     _assume_ the failure was due to an embedding failure.  But it
>     would be good to be sure.

Here's what I've worked up.  Biggest change first.

diff --git a/m4/groff.m4 b/m4/groff.m4
index b9ead007d..d48016503 100644
--- a/m4/groff.m4
+++ b/m4/groff.m4
@@ -284,12 +284,13 @@ AC_DEFUN([GROFF_URW_FONTS_PATH], [
     [AS_HELP_STRING([--with-urw-fonts-dir=DIR],
       [search for URW PostScript Type 1 fonts in DIR])],
     [urwfontsdir="$withval"])
-  AC_SUBST(urwfontsdir)])
 ])
 
 # Check availability of URW fonts in the search path given by 'gs -h'
 # supplemented with the paths where font/devpdf/Foundry.in expects them,
 # or in the custom directory passed to 'configure'.
+#
+# If the user specified a URW font directory, look _only_ there.
 
 AC_DEFUN([GROFF_URW_FONTS_CHECK], [
   AC_REQUIRE([GROFF_AWK_PATH])
@@ -313,7 +314,7 @@ AC_DEFUN([GROFF_URW_FONTS_CHECK], [
 
   if test -n "$urwfontsdir"
   then
-    _list_paths="$ _list_paths $urwfontsdir"
+    _list_paths="$urwfontsdir"
   fi
 
   for k in $_list_paths
@@ -328,6 +329,7 @@ AC_DEFUN([GROFF_URW_FONTS_CHECK], [
       then
         AC_MSG_RESULT([found in $k])
         groff_have_urw_fonts=yes
+        urwfontsdir=$k
         break 2
       fi
     done
@@ -336,9 +338,11 @@ AC_DEFUN([GROFF_URW_FONTS_CHECK], [
   if test $groff_have_urw_fonts = no
   then
     AC_MSG_RESULT([none found])
+    urwfontsdir=
   fi
 
   AC_SUBST([groff_have_urw_fonts])
+  AC_SUBST(urwfontsdir)
 ])
 
 AC_DEFUN([GROFF_URW_FONTS_NOTICE], [

I hope the above is self-explanatory, with the comments.  If the user
gives our configure script  an explicit --with-urw-fonts-dir argument,
then we will search there and ONLY there for them.  This seems to me to
honor user intentions better.  No one forces you to pass such an
argument, and if you have the URW fonts in a conventional place, you
won't need to.  And if no URW fonts are found at all, the
Autoconf-substituted variable (which exposes it to Make) gets blanked
out so that it doesn't screw up the Foundry.in file that consumes it.

diff --git a/configure.ac b/configure.ac
index 350b32005..915fba9ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -243,7 +243,13 @@ else
 fi
 echo "\
  'groff -l' uses print spooler    : $groff_have_spooler
- use URW fonts for PDF output     : $groff_have_urw_fonts
+ use URW fonts for PDF output     : $groff_have_urw_fonts"
+if test "$groff_have_urw_fonts" = yes
+then
+ echo "\
+ URW fonts directory              : $urwfontsdir"
+fi
+echo "\
  preconv can use uchardet library : $groff_have_uchardet
  can build groff.dvi, groff.pdf   : $groff_use_tex
  tests can use poppler PDF tools  : $groff_have_pdftools

The above is item #1 from my earlier mail.  This way if people email us
just the juiciest part of the configuration report, we can still see
where it _thinks_ the URW fonts are.

diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index 4b6b1c009..50d07ca27 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -2366,7 +2366,7 @@ sub LoadFont
         OpenFile(\$f,$fontdir,$fontnm);
     }
 
-    Die("failed to open font '$ofontnm'") if !defined($f);
+    Die("unable to open font '$ofontnm' for mounting") if !defined($f);
 
     my $foundry='';
     $foundry=$1 if $fontnm=~m/^(.*?)-/;

This is item #2.  I was wrong about what gropdf wanted to open the font
file for; this is straight up ordinary handling of the
device-independent "x f" command.  Nothing to with embedding.

Here's something I didn't change:

font/devpdf/Foundry.in:foundry||@urwfontsdir@:(gs):/usr/share/fonts/type1/gsfonts:/usr/share/fonts/default/Type1:/usr/share/fonts/default/Type1/adobestd35:/usr/share/fonts/type1/urw-base35:/opt/local/share/fonts/urw-fonts:/usr/local/share/fonts/ghostscript
font/devpdf/Foundry.in:foundry|U|@urwfontsdir@:/usr/share/fonts/type1/gsfonts:/usr/share/fonts/default/Type1:/usr/share/fonts/default/Type1/adobestd35:/usr/share/fonts/type1/urw-base35:/opt/local/share/fonts/urw-fonts:/usr/local/share/fonts/ghostscript:(gs)

This how the detection of the URW fonts directory actually influences
the build.  The directory they are found in, if any, is used by gropdf's
Foundry file to locate them.

One thing I don't understand is why "(gs)" (which, IIRC, means,
"whatever Ghostscript's font search path reported in 'gs -h' is) comes
right after the URW fonts directory when searching for Adobe or generic
fonts but all the way at the end of the search path for fonts using the
'U' (URW) foundry.

Deri may well have explained this to me before and I have forgotten.  If
the distinct placement is deliberate, we should add an explanatory
comment.

Comments?  Unless someone convinces me that I've gone round the bend,
something like this will probably be in my next push.

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


reply via email to

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