Follow-up Comment #64, bug #63808 (project groff): With the changes discussed in comment #63...
$ git show --reverse origin..HEAD commit 5b1d47e4fe4f15fc2b7249b34d1e94d190a1539f Author: G. Branden Robinson <g.branden.robin...@gmail.com> Date: Fri Feb 24 06:37:19 2023 -0600 m4/groff.m4: Improve URW font check. * m4/groff.m4 (GROFF_URW_FONTS_CHECK): When looking for a characteristic URW font by its file name, also check for "URWGothic-Book" with no file extension. Avoids false negatives in URW Type 1 font detection when using Ghostscript 9.53.3. Thanks to Deri James for suggesting the test procedure that uncovered this flaw. diff --git a/ChangeLog b/ChangeLog index 931717f64..fce638f5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2023-02-24 G. Branden Robinson <g.branden.robin...@gmail.com> + + * m4/groff.m4 (GROFF_URW_FONTS_CHECK): When looking for a + characteristic URW font by its file name, also check for + "URWGothic-Book" with no file extension. Avoids false negatives + in URW Type 1 font detection when using Ghostscript 9.53.3. + Thanks to Deri James for suggesting the test procedure that + uncovered this flaw. + 2023-02-22 G. Branden Robinson <g.branden.robin...@gmail.com> * Makefile.am (uninstall_groffdirs): Remove "html.mono" and diff --git a/m4/groff.m4 b/m4/groff.m4 index b6c5535be..294817544 100644 --- a/m4/groff.m4 +++ b/m4/groff.m4 @@ -382,6 +382,7 @@ dnl Keep this list in sync with font/devpdf/Foundry.in. for k in $_list_paths do for _font_file in \ + URWGothic-Book \ URWGothic-Book.t1 \ URWGothic-Book.pfb \ URWGothicL-Book.pfb \ commit 763f3ae170a01b9c1c03d86552b98c0dc59cefe2 Author: G. Branden Robinson <g.branden.robin...@gmail.com> Date: Fri Feb 24 06:49:07 2023 -0600 configure.ac: Drop now-redundant explicit check. * configure.ac: Drop now-redundant explicit `GROFF_URW_FONTS_CHECK`. `GROFF_GROPDF_DEPENDENCIES_CHECK` `AC_REQUIRE`s it as of commit ec001d2a23, 18 February. diff --git a/ChangeLog b/ChangeLog index fce638f5a..c387e885b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2023-02-24 G. Branden Robinson <g.branden.robin...@gmail.com> + + * configure.ac: Drop now-redundant explicit + `GROFF_URW_FONTS_CHECK`. `GROFF_GROPDF_DEPENDENCIES_CHECK` + `AC_REQUIRE`s it as of commit ec001d2a23, 18 February. + 2023-02-24 G. Branden Robinson <g.branden.robin...@gmail.com> * m4/groff.m4 (GROFF_URW_FONTS_CHECK): When looking for a diff --git a/configure.ac b/configure.ac index b4e992162..fa38baba9 100644 --- a/configure.ac +++ b/configure.ac @@ -179,10 +179,6 @@ GROFF_GHOSTSCRIPT_VERSION_CHECK gl_GLIBC21 gl_LOCALCHARSET -# Check for presence of URW fonts (these require Ghostscript, which is -# checked for by GROFF_CHECK_GROHTML_PROGRAMS). -GROFF_URW_FONTS_CHECK - AM_CONDITIONAL([BUILD_WINSCRIPTS], [test -n "$make_winscripts"]) # If X11 is not available, don't build: commit 4b6710a750012b6ffcc7ae6fef30013354583307 Author: G. Branden Robinson <g.branden.robin...@gmail.com> Date: Fri Feb 24 08:42:46 2023 -0600 [build]: Don't treat Ghostscript fonts as URW. [build]: Stop scraping output of Ghostscript executable with "-h" option to attempt to find URW fonts. Fonts that ship with Ghostscript are regarded as the "default" foundry, not the URW foundry (though they often ultimately originate with URW fonts). They are often missing Adobe Font Metric (AFM) files, so it is impossible for groff to generate font description files for them at build time. * m4/groff.m4 (GROFF_URW_FONTS_CHECK): Drop `AC_REQUIRE` on `GROFF_AWK_PATH`. Drop awk-based scraping of Ghostscript "-h" output. Annotate need for sync between this list of characteristic font file names and the one in BuildFoundries. Thanks to Deri James for the ongoing discussions. diff --git a/ChangeLog b/ChangeLog index c387e885b..9b8ecccc3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2023-02-24 G. Branden Robinson <g.branden.robin...@gmail.com> + + [build]: Stop scraping output of Ghostscript executable with + "-h" option to attempt to find URW fonts. Fonts that ship with + Ghostscript are regarded as the "default" foundry, not the URW + foundry (though they often ultimately originate with URW fonts). + They are often missing Adobe Font Metric (AFM) files, so it is + impossible for groff to generate font description files for them + at build time. + + * m4/groff.m4 (GROFF_URW_FONTS_CHECK): Drop `AC_REQUIRE` on + `GROFF_AWK_PATH`. Drop awk-based scraping of Ghostscript "-h" + output. Annotate need for sync between this list of + characteristic font file names and the one in BuildFoundries. + + Thanks to Deri James for the ongoing discussions. + 2023-02-24 G. Branden Robinson <g.branden.robin...@gmail.com> * configure.ac: Drop now-redundant explicit diff --git a/m4/groff.m4 b/m4/groff.m4 index 294817544..06b32e159 100644 --- a/m4/groff.m4 +++ b/m4/groff.m4 @@ -348,25 +348,21 @@ AC_DEFUN([GROFF_URW_FONTS_PATH], [ ]) # Check for availability of URW fonts in the directory specified by the -# user (see GROFF_URW_FONTS_PATH above); alternatively, use the search -# path given by 'gs -h' (if possible) supplemented with the paths where -# font/devpdf/Foundry.in expects them. +# user (see GROFF_URW_FONTS_PATH above). We do NOT search the path of +# directories built into Ghostscript because those fonts lack the +# corresponding AFM files we need to generate groff font description +# files; see afmtodit(1). Ghostscript's own fonts are treated as the +# "default foundry" and we already provide descriptions of them in +# font/devpdf (along with groff's EURO font). AC_DEFUN([GROFF_URW_FONTS_CHECK], [ AC_REQUIRE([GROFF_URW_FONTS_PATH]) - AC_REQUIRE([GROFF_AWK_PATH]) AC_REQUIRE([GROFF_GHOSTSCRIPT_PATH]) groff_have_urw_fonts=no AC_MSG_CHECKING([for URW fonts in Type 1/PFB format]) - _list_paths= - - if test "$AWK" != missing && test "$GHOSTSCRIPT" != missing - then - _list_paths=`$GHOSTSCRIPT -h | $AWK 'BEGIN { found = 0 } /Search path:/ { found = 1 } /^[ ]*\// { print $'0' }'| tr : ' '` - fi dnl Keep this list in sync with font/devpdf/Foundry.in. - _list_paths="$_list_paths \ + _list_paths="\ /usr/share/fonts/type1/gsfonts/ \ /usr/share/fonts/default/Type1/ \ /usr/share/fonts/default/Type1/adobestd35/ \ @@ -379,6 +375,8 @@ dnl Keep this list in sync with font/devpdf/Foundry.in. _list_paths="$urwfontsdir" fi +dnl Keep this list of font file names in sync with the corresponding +dnl entry in font/devpdf/util/BuildFoundries.pl. for k in $_list_paths do for _font_file in \ commit 335b911faaafae94f1a8f5f68e2784a86cfc0ced Author: G. Branden Robinson <g.branden.robin...@gmail.com> Date: Fri Feb 24 09:30:43 2023 -0600 [devpdf]: Trivially refactor. Rename sed-substitutum [Lat.] from "@GROFF_GHOSTSCRIPT_INTERPRETERS@" to "@GHOSTSCRIPT@" for clarity and brevity; this is a scalar value containing the Autoconf-determined name of the Ghostscript interpreter. It is not the same as the replacement that occurs in contrib/pdfmark. * font/devpdf/devpdf.am: * font/devpdf/util/BuildFoundries.pl: Do it. diff --git a/ChangeLog b/ChangeLog index 9b8ecccc3..a02f60d73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2023-02-24 G. Branden Robinson <g.branden.robin...@gmail.com> + + [devpdf]: Trivially refactor. Rename sed-substitutum [Lat.] + from "@GROFF_GHOSTSCRIPT_INTERPRETERS@" to "@GHOSTSCRIPT@" for + clarity and brevity; this is a scalar value containing the + Autoconf-determined name of the Ghostscript interpreter. It is + not the same as the replacement that occurs in contrib/pdfmark. + + * font/devpdf/devpdf.am: + * font/devpdf/util/BuildFoundries.pl: Do it. + 2023-02-24 G. Branden Robinson <g.branden.robin...@gmail.com> [build]: Stop scraping output of Ghostscript executable with diff --git a/font/devpdf/devpdf.am b/font/devpdf/devpdf.am index 4b872182d..4f9923a9f 100644 --- a/font/devpdf/devpdf.am +++ b/font/devpdf/devpdf.am @@ -71,7 +71,7 @@ font/devpdf/util/BuildFoundries: \ && if test -n "$(PERL)"; then \ sed -f $(SH_DEPS_SED_SCRIPT) \ -e "s|/usr/bin/perl|$(PERL)|" \ - -e "s|[@]GROFF_GHOSTSCRIPT_INTERPRETERS[@]|$(GHOSTSCRIPT)|" \ + -e "s|[@]GHOSTSCRIPT[@]|$(GHOSTSCRIPT)|" \ -e "s|[@]PATH_SEPARATOR[@]|$(PATH_SEPARATOR)|" \ -e "s|[@]VERSION[@]|$(VERSION)|" \ -e "s|[@]GROFF_FONT_DIR[@]|$(fontdir)|" \ diff --git a/font/devpdf/util/BuildFoundries.pl b/font/devpdf/util/BuildFoundries.pl index b22925a89..2815c379e 100644 --- a/font/devpdf/util/BuildFoundries.pl +++ b/font/devpdf/util/BuildFoundries.pl @@ -331,7 +331,7 @@ sub LocateFile sub FindGSpath { - my (@res)=`@GROFF_GHOSTSCRIPT_INTERPRETERS@ -h 2>/dev/null`; + my (@res)=`@GHOSTSCRIPT@ -h 2>/dev/null`; return [] if $?; my $buildpath=[]; my $stg=1; commit 3c4b49e0043eaa6df23d711c0256dd8dbf529d0d Author: G. Branden Robinson <g.branden.robin...@gmail.com> Date: Fri Feb 24 09:46:51 2023 -0600 [devpdf]: Generate tests from template files. [devpdf]: Generate tests from template files, so we can populate the test scripts with information determined at configuration. The default foundry test depends on $GHOSTSCRIPT, and the URW foundry test on $urwfontsdir. * font/devpdf/tests/check-default-foundry.sh: * font/devpdf/tests/check-urw-foundry.sh: Rename these... * font/devpdf/tests/check-default-foundry.sh.in: * font/devpdf/tests/check-urw-foundry.sh.in: ...to these. * font/devpdf/devpdf.am (font_devpdf_default_test) (font_devpdf_urw_test): New variables store names of generated test scripts. (font/devpdf/tests/check-default-foundry.sh): (font/devpdf/tests/check-urw-foundry.sh): New targets produce test scripts from corresponding .in files. diff --git a/ChangeLog b/ChangeLog index a02f60d73..0323d7c99 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2023-02-24 G. Branden Robinson <g.branden.robin...@gmail.com> + + [devpdf]: Generate tests from template files, so we can populate + the test scripts with information determined at configuration. + The default foundry test depends on $GHOSTSCRIPT, and the URW + foundry test on $urwfontsdir. + + * font/devpdf/tests/check-default-foundry.sh: + * font/devpdf/tests/check-urw-foundry.sh: Rename these... + * font/devpdf/tests/check-default-foundry.sh.in: + * font/devpdf/tests/check-urw-foundry.sh.in: ...to these. + + * font/devpdf/devpdf.am (font_devpdf_default_test) + (font_devpdf_urw_test): New variables store names of generated + test scripts. + (font/devpdf/tests/check-default-foundry.sh): + (font/devpdf/tests/check-urw-foundry.sh): New targets produce + test scripts from corresponding .in files. + 2023-02-24 G. Branden Robinson <g.branden.robin...@gmail.com> [devpdf]: Trivially refactor. Rename sed-substitutum [Lat.] diff --git a/font/devpdf/devpdf.am b/font/devpdf/devpdf.am index 4f9923a9f..edce36575 100644 --- a/font/devpdf/devpdf.am +++ b/font/devpdf/devpdf.am @@ -178,12 +178,30 @@ uninstall_devpdf: rmdir $(DESTDIR)$(devpdffontdir); \ fi +font_devpdf_default_test=\ + $(devpdf_srcdir)/tests/check-default-foundry.sh.in +font_devpdf_urw_test=$(devpdf_srcdir)/tests/check-urw-foundry.sh.in + +font/devpdf/tests/check-default-foundry.sh: $(font_devpdf_default_test) + $(AM_V_GEN)$(MKDIR_P) `dirname $@` \ + && sed -e "s|[@]GHOSTSCRIPT[@]|$(GHOSTSCRIPT)|g" \ + $(font_devpdf_default_test) > $@ \ + && chmod +x $@ + +font/devpdf/tests/check-urw-foundry.sh: $(font_devpdf_urw_test) + $(AM_V_GEN)$(MKDIR_P) `dirname $@` \ + && sed -e "s|[@]urwfontsdir[@]|$(urwfontsdir)|g" \ + $(font_devpdf_urw_test) > $@ \ + && chmod +x $@ + font_devpdf_TESTS = \ font/devpdf/tests/check-default-foundry.sh \ font/devpdf/tests/check-urw-foundry.sh TESTS += $(font_devpdf_TESTS) -EXTRA_DIST += $(font_devpdf_TESTS) +MOSTLYCLEANFILES += $(font_devpdf_TESTS) +EXTRA_DIST += $(font_devpdf_default_test) $(font_devpdf_urw_test) + # Local Variables: # mode: makefile-automake diff --git a/font/devpdf/tests/check-default-foundry.sh b/font/devpdf/tests/check-default-foundry.sh.in similarity index 100% rename from font/devpdf/tests/check-default-foundry.sh rename to font/devpdf/tests/check-default-foundry.sh.in diff --git a/font/devpdf/tests/check-urw-foundry.sh b/font/devpdf/tests/check-urw-foundry.sh.in similarity index 100% rename from font/devpdf/tests/check-urw-foundry.sh rename to font/devpdf/tests/check-urw-foundry.sh.in commit 34dd527e49e08209286438573b7cf4dcc1241c79 (HEAD -> master) Author: G. Branden Robinson <g.branden.robin...@gmail.com> Date: Fri Feb 24 18:07:45 2023 -0600 XXX devpdf test rejigger diff --git a/font/devpdf/tests/check-default-foundry.sh.in b/font/devpdf/tests/check-default-foundry.sh.in index 1ddd83d0b..d5e401df9 100755 --- a/font/devpdf/tests/check-default-foundry.sh.in +++ b/font/devpdf/tests/check-default-foundry.sh.in @@ -18,19 +18,42 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # -# Ensure that groff's PDF device has font description files for the -# default (unnamed) foundry's PostScript Level 2 base 35 fonts, plus -# groff's EURO. -# -# These font descriptions should be available in any gropdf -# configuration because they can be copied from the devps font -# descriptions even if the URW fonts are not available. -# -# Another test script checks the "U" (URW) foundry. - devpdf_fontbuilddir="${abs_top_builddir:-.}"/font/devpdf +ghostscript=@GHOSTSCRIPT@ + +wail () { + echo ...FAILED >&2 + fail=yes +} + +fail= + +# The are the base 14 fonts required by the PDF standard. They should +# _always_ be present and supported. If their corresponding Type 1 font +# files are available, they too can be embedded in a PDF using gropdf's +# "-e" option. groff's "EURO" font is always available; we ship it. +mandatory_fonts='CB +CBI +CI +CR +HB +HBI +HI +HR +S +TB +TBI +TI +TR +ZD' -fonts='AB +# These fonts are commonly, but not universally, available; if used, +# their corresponding Type 1 font files must be embedded in a document. +# +# Their groff font descriptions will always be available: we ship them. +# But they are not usable with gropdf(1) if the Type 1 files are absent. +# We thus will not test them if they are not expected to work. +supplementary_fonts='AB ABI AI AR @@ -38,19 +61,10 @@ BMB BMBI BMI BMR -CB -CBI -CI -CR -EURO -HB -HBI -HI HNB HNBI HNI HNR -HR NB NBI NI @@ -59,24 +73,25 @@ PB PBI PI PR -S -TB -TBI -TI -TR -ZCMI -ZD' +ZCMI' -fail= +for f in $mandatory_fonts +do + printf "checking for font description %s...\n" "$f" >&2 + test -f "$devpdf_fontbuilddir"/"$f" || wail +done + +if [ "$ghostscript" != no ] && [ "$ghostscript" != missing ] +then + echo "Ghostscript not available; skipping check for any further" \ + "fonts in the default foundry" >&2 + exit 77 # skip +fi -for f in $fonts +for f in $supplementary_fonts do printf "checking for font description %s...\n" "$f" >&2 - if ! [ -f "$devpdf_fontbuilddir"/"$f" ] - then - echo FAILED >&2 - fail=yes - fi + test -f "$devpdf_fontbuilddir"/"$f" || wail done test -z "$fail" diff --git a/font/devpdf/tests/check-urw-foundry.sh.in b/font/devpdf/tests/check-urw-foundry.sh.in index 9d4e514bf..d31b3aa3e 100755 --- a/font/devpdf/tests/check-urw-foundry.sh.in +++ b/font/devpdf/tests/check-urw-foundry.sh.in @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2022 Free Software Foundation, Inc. +# Copyright (C) 2022-2023 Free Software Foundation, Inc. # # This file is part of groff. # @@ -19,8 +19,17 @@ # # Ensure that groff's PDF device has URW font descriptions it expects. +# These are generated at build time by afmtodit(1) if a URW font +# directory was discovered at configuration time. devpdf_fontbuilddir="${abs_top_builddir:-.}"/font/devpdf devpdf_fontbuilddir="${abs_top_builddir:-.}"/font/devpdf +urwfontsdir=@urwfontsdir@ + +if [ -z "$urwfontsdir" ] +then + echo "URW fonts not found at configuration time; skipping" >&2 + exit 77 # skip +fi fonts='AB ABI @@ -67,7 +76,7 @@ do if ! test -f "$devpdf_fontbuilddir"/$f then echo test -f "$devpdf_fontbuilddir"/$f - echo FAILED >&2 + echo ...FAILED >&2 fail=yes fi done diff --git a/m4/groff.m4 b/m4/groff.m4 index 06b32e159..617e16394 100644 --- a/m4/groff.m4 +++ b/m4/groff.m4 @@ -332,8 +332,6 @@ AC_DEFUN([GROFF_GROPDF_PROGRAM_NOTICE], [ base 14 fonts, plus the 'EURO' font groff supplies, and font embedding with its '-e' option (accessed via the 'groff' command with the option '-P -e') will not be possible. - - If you run "make check", an automated test for 'gropdf' will fail. ]) fi ]) @@ -416,8 +414,6 @@ AC_DEFUN([GROFF_URW_FONTS_NOTICE], [ the 'U' foundry in PDF documents generated by groff will not be possible. - If you run "make check", an automated test for 'gropdf' will fail. - You can obtain the URW base 35 fonts from their GitHub project. As of this writing (2023-02-15), you can find them in the 'fonts' directory of the following archives (choose one). ...things look much better in the contrived "scenario 01" (gs present, urw absent). $ ./configure --prefix=$HOME checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out ... checking for gs... gs checking for pnmcrop... found checking for pnmcut... found checking for pnmtopng... found checking for pnmtops... found checking for psselect... missing checking for URW fonts in Type 1/PFB format... none found checking whether pnmtops accepts the '-nosetpage' option... yes checking whether make defines 'RM'... yes checking for a diff program that supports option -D... yes checking whether test supports option -ef... yes checking for bash... /usr/bin/bash checking for gs version with good left sidebearing handling... got 9.53.3 (buggy) checking whether we are using the GNU C Library >= 2.1 or uClibc... (cached) yes checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating test-groff config.status: creating src/include/config.h config.status: executing depfiles commands GNU roff version 1.23.0.rc3.29-34dd52 ---------------------------------------------------------------------- installation directory prefix : /home/branden C++ compiler and options : g++ -g -O2 use libgroff's memory allocator : no C compiler and options : gcc -g -O2 Perl interpreter version : 5.32.1 X11 support : disabled 'groff -l' uses print spooler : no use URW fonts for PDF output : no preconv can use uchardet library : no can build groff.dvi, groff.pdf : no tests can use poppler PDF tools : no ---------------------------------------------------------------------- configure: Buggy version of Ghostscript detected. Ghostscript versions 9.00 <= x < 9.54 suffer from a rendering glitch that affects the AT&T troff (and groff) special character '\(lh'; see <https://bugs.ghostscript.com/show_bug.cgi?id=703187>. If your version of Ghostscript has not been patched to fix this problem, you may need to work around it in groff documents you render for the PostScript (and, for tbl(1) tables, HTML) output devices. configure: URW fonts in Type 1/PFB format were not found. groff font description files for the URW fonts, used by the 'gropdf' output driver, will not be available. Use and embedding of fonts from the 'U' foundry in PDF documents generated by groff will not be possible. You can obtain the URW base 35 fonts from their GitHub project. As of this writing (2023-02-15), you can find them in the 'fonts' directory of the following archives (choose one). https://github.com/ArtifexSoftware/urw-base35-fonts/archive/refs/ tags/20200910.zip https://github.com/ArtifexSoftware/urw-base35-fonts/archive/refs/ tags/20200910.tar.gz You may wish to check for a newer release. https://github.com/ArtifexSoftware/urw-base35-fonts/releases By default, groff will look for these fonts in the search path shown by the 'gs -h' command (if available) and in several directories specified in font/devpdf/Foundry.in). You will need to 'make distclean' and re-run the 'configure' script after installing these fonts. Alternatively, you can pass the option '--with-urw-fonts-dir=DIR' to 'configure' to look for them in the directory DIR you specify. If found, the 'U' foundry will be available via the '-y' option to 'gropdf' (accessed via the 'groff' command with the option '-P -y'). configure: The uchardet library was not found. The 'preconv' preprocessor program will be unable to attempt automatic inference of an input file's character encoding. See the preconv(1) man page. configure: The program 'psselect' was not found in $PATH. Consequently, groff's HTML output driver, 'grohtml', will not work properly. It will not be possible to prepare or install groff-generated documentation in HTML format. $ make check GEN lib/alloca.h GEN lib/inttypes.h GEN lib/limits.h ... PASS: contrib/rfc1345/tests/rfc1345-smoke-test.sh GEN font/devpdf/tests/check-default-foundry.sh SKIP: font/devpdf/tests/check-default-foundry.sh GEN font/devpdf/tests/check-urw-foundry.sh SKIP: font/devpdf/tests/check-urw-foundry.sh SKIP: src/devices/grotty/tests/basic_latin_glyphs_map_correctly.sh PASS: src/devices/grotty/tests/osc8_works.sh ... ============================================================================ Testsuite summary for GNU roff 1.23.0.rc3.29-34dd52 ============================================================================ # TOTAL: 163 # PASS: 153 # SKIP: 8 # XFAIL: 2 # FAIL: 0 # XPASS: 0 # ERROR: 0 ============================================================================ I'll check out the other 3 configurations in my Debian bullseye chroot, then do builds on macOS, Solaris 10, and Solaris 11. If all that works out, I'll write a proper commit message for that last commit, and push. _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?63808> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/