diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 19:44:05 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 19:44:05 +0000 |
commit | d318611dd6f23fcfedd50e9b9e24620b102ba96a (patch) | |
tree | 8b9eef82ca40fdd5a8deeabf07572074c236095d /font/devpdf | |
parent | Initial commit. (diff) | |
download | groff-upstream.tar.xz groff-upstream.zip |
Adding upstream version 1.23.0.upstream/1.23.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'font/devpdf')
-rw-r--r-- | font/devpdf/DESC.in | 11 | ||||
-rw-r--r-- | font/devpdf/Foundry.in | 121 | ||||
-rw-r--r-- | font/devpdf/devpdf.am | 210 | ||||
-rwxr-xr-x | font/devpdf/tests/check-default-foundry.sh.in | 99 | ||||
-rwxr-xr-x | font/devpdf/tests/check-urw-foundry.sh.in | 86 | ||||
-rw-r--r-- | font/devpdf/util/BuildFoundries.pl | 578 |
6 files changed, 1105 insertions, 0 deletions
diff --git a/font/devpdf/DESC.in b/font/devpdf/DESC.in new file mode 100644 index 0000000..5cb254f --- /dev/null +++ b/font/devpdf/DESC.in @@ -0,0 +1,11 @@ +res 72000 +hor 1 +vert 1 +sizescale 1000 +unitwidth 1000 +sizes 1000-10000000 0 +styles R I B BI +family T +fonts 8 0 0 0 0 0 0 S ZD +tcommand +postpro gropdf diff --git a/font/devpdf/Foundry.in b/font/devpdf/Foundry.in new file mode 100644 index 0000000..e5aba65 --- /dev/null +++ b/font/devpdf/Foundry.in @@ -0,0 +1,121 @@ +# Foundry file + +# Copyright (C) 2011-2020 Free Software Foundation, Inc. +# Written by Deri James <deri@chuzzlewit.myzen.co.uk> +# +# This file is part of groff. +# +# groff is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# groff is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +#======================================================================= +#Foundry|Name|Search path +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 + +# Enable the font description files for grops (generated from Adobe +# foundry font files) to be used with gropdf. afmtodit must not be +# called with any flags. URW fonts are substituted for Adobe fonts in +# the download file by default. If you have Adobe Type 1 fonts, you can +# update the foundry search path above if necessary and replace the +# contents of the file fields below with their file names. + +#Font|IsBase14|Flags|Map|Encoding|File(!file)... +AB|N||||URWGothic-Demi.t1!URWGothic-Demi!URWGothicL-Demi!a010015l.pfb +ABI|N||||URWGothic-DemiOblique.t1!URWGothic-DemiOblique!URWGothicL-DemiObli!a010035l.pfb +AI|N||||URWGothic-BookOblique.t1!URWGothic-BookOblique!URWGothicL-BookObli!a010033l.pfb +AR|N||||URWGothic-Book.t1!URWGothic-Book!URWGothicL-Book!a010013l.pfb +BMB|N||||URWBookman-Demi.t1!URWBookman-Demi!URWBookmanL-DemiBold!b018015l.pfb +BMBI|N||||URWBookman-DemiItalic.t1!URWBookman-DemiItalic!URWBookmanL-DemiBoldItal!b018035l.pfb +BMI|N||||URWBookman-LightItalic.t1!URWBookman-LightItalic!URWBookmanL-LighItal!b018032l.pfb +BMR|N||||URWBookman-Light.t1!URWBookman-Light!URWBookmanL-Ligh!b018012l.pfb +CB|Y||||NimbusMonoPS-Bold.t1!NimbusMonoPS-Bold!NimbusMonL-Bold!n022004l.pfb +CBI|Y||||NimbusMonoPS-BoldItalic.t1!NimbusMonoPS-BoldItalic!NimbusMonL-BoldObli!n022024l.pfb +CI|Y||||NimbusMonoPS-Italic.t1!NimbusMonoPS-Italic!NimbusMonL-ReguObli!n022023l.pfb +CR|Y||||NimbusMonoPS-Regular.t1!NimbusMonoPS-Regular!NimbusMonL-Regu!n022003l.pfb +HB|Y||||NimbusSans-Bold.t1!NimbusSans-Bold!NimbusSanL-Bold!n019004l.pfb +HBI|Y||||NimbusSans-BoldItalic.t1!NimbusSans-BoldItalic!NimbusSans-BoldOblique.t1!NimbusSans-BoldOblique!NimbusSanL-BoldItal!n019024l.pfb +HI|Y||||NimbusSans-Italic.t1!NimbusSans-Italic!NimbusSans-Oblique.t1!NimbusSans-Oblique!NimbusSanL-ReguItal!n019023l.pfb +HNB|N||||NimbusSansNarrow-Bold.t1!NimbusSansNarrow-Bold!NimbusSanL-BoldCond!n019044l.pfb +HNBI|N||||NimbusSansNarrow-BoldOblique.t1!NimbusSansNarrow-BoldOblique!NimbusSansNarrow-BdOblique!NimbusSanL-BoldCondItal.t1!NimbusSanL-BoldCondItal!n019064l.pfb +HNI|N||||NimbusSansNarrow-Oblique.t1!NimbusSansNarrow-Oblique!NimbusSanL-ReguCondItal!n019063l.pfb +HNR|N||||NimbusSansNarrow-Regular.t1!NimbusSansNarrow-Regular!NimbusSanL-ReguCond!n019043l.pfb +HR|Y||||NimbusSans-Regular.t1!NimbusSans-Regular!NimbusSans-Regular!NimbusSanL-Regu!n019003l.pfb +NB|N||||C059-Bold.t1!C059-Bold!CenturySchL-Bold!c059016l.pfb +NBI|N||||C059-BdIta.t1!C059-BdIta!CenturySchL-BoldItal!c059036l.pfb +NI|N||||C059-Italic.t1!C059-Italic!CenturySchL-Ital!c059033l.pfb +NR|N||||C059-Roman.t1!C059-Roman!CenturySchL-Roma!c059013l.pfb +PB|N||||P052-Bold.t1!P052-Bold!URWPalladioL-Bold!p052004l.pfb +PBI|N||||P052-BoldItalic.t1!P052-BoldItalic!URWPalladioL-BoldItal!p052024l.pfb +PI|N||||P052-Italic.t1!P052-Italic!URWPalladioL-Ital!p052023l.pfb +PR|N||||P052-Roman.t1!P052-Roman!URWPalladioL-Roma!p052003l.pfb +S|Y||||StandardSymbolsPS.t1!StandardSymbolsPS!StandardSymL!s050000l.pfb +TB|Y||||NimbusRoman-Bold.t1!NimbusRoman-Bold!NimbusRomNo9L-Medi!n021004l.pfb +TBI|Y||||NimbusRoman-BoldItalic.t1!NimbusRoman-BoldItalic!NimbusRomNo9L-MediItal!n021024l.pfb +TI|Y||||NimbusRoman-Italic.t1!NimbusRoman-Italic!NimbusRomNo9L-ReguItal!n021023l.pfb +TR|Y||||NimbusRoman-Regular.t1!NimbusRoman-Regular!NimbusRomNo9L-Regu!n021003l.pfb +ZCMI|N||||Z003-MediumItalic.t1!Z003-MediumItalic!URWChanceryL-MediItal!z003034l.pfb +ZD|Y||||D050000L!D050000L.t1!Dingbats!d050000l.pfb +EURO|N||||*../devps/freeeuro.pfa + +# BEGIN URW ============================================================ + +# URW fonts are typically shipped with Ghostscript, but can be replaced. + +#Foundry|Name|Search path +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) + +# Define flags for afmtodit. + +r=-i 0 -m +i=-i 50 +n=-n +s=-s + +#Font|IsBase14|Flags|Map|Encoding|File(!file)... +AB|N|r|text.map|text.enc|URWGothic-Demi.t1!URWGothic-Demi!URWGothicL-Demi!a010015l.pfb +ABI|N|i|text.map|text.enc|URWGothic-DemiOblique.t1!URWGothic-DemiOblique!URWGothicL-DemiObli!a010035l.pfb +AI|N|i|text.map|text.enc|URWGothic-BookOblique.t1!URWGothic-BookOblique!URWGothicL-BookObli!a010033l.pfb +AR|N|r|text.map|text.enc|URWGothic-Book.t1!URWGothic-Book!URWGothicL-Book!a010013l.pfb +BMB|N|r|text.map|text.enc|URWBookman-Demi.t1!URWBookman-Demi!URWBookmanL-DemiBold!b018015l.pfb +BMBI|N|i|text.map|text.enc|URWBookman-DemiItalic.t1!URWBookman-DemiItalic!URWBookmanL-DemiBoldItal!b018035l.pfb +BMI|N|i|text.map|text.enc|URWBookman-Light.t1!URWBookman-Light!URWBookmanL-LighItal!b018032l.pfb +BMR|N|r|text.map|text.enc|URWBookman-LightItalic.t1!URWBookman-LightItalic!URWBookmanL-Ligh!b018012l.pfb +CB|N|nr|text.map|text.enc|NimbusMonoPS-Bold.t1!NimbusMonoPS-Bold!NimbusMonL-Bold!n022004l.pfb +CBI|N|ni|text.map|text.enc|NimbusMonoPS-BoldItalic.t1!NimbusMonoPS-BoldItalic!NimbusMonL-BoldObli!n022024l.pfb +CI|N|ni|text.map|text.enc|NimbusMonoPS-Italic.t1!NimbusMonoPS-Italic!NimbusMonL-ReguObli!n022023l.pfb +CR|N|nr|text.map|text.enc|NimbusMonoPS-Regular.t1!NimbusMonoPS-Regular!NimbusMonL-Regu!n022003l.pfb +HB|N|r|text.map|text.enc|NimbusSans-Bold.t1!NimbusSans-Bold!NimbusSanL-Bold!n019004l.pfb +HBI|N|i|text.map|text.enc|NimbusSans-BoldItalic!NimbusSans-BoldItalic.t1!NimbusSans-BoldOblique!NimbusSanL-BoldItal!n019024l.pfb +HI|N|i|text.map|text.enc|NimbusSans-Italic!NimbusSans-Italic.t1!NimbusSans-Oblique!NimbusSanL-ReguItal!n019023l.pfb +HNB|N|r|text.map|text.enc|NimbusSansNarrow-Bold.t1!NimbusSansNarrow-Bold!NimbusSanL-BoldCond!n019044l.pfb +HNBI|N|i|text.map|text.enc|NimbusSansNarrow-BoldOblique.t1!NimbusSansNarrow-BoldOblique!NimbusSansNarrow-BdOblique!NimbusSanL-BoldCondItal.t1!NimbusSanL-BoldCondItal!n019064l.pfb +HNI|N|i|text.map|text.enc|NimbusSansNarrow-Oblique.t1!NimbusSansNarrow-Oblique!NimbusSanL-ReguCondItal!n019063l.pfb +HNR|N|r|text.map|text.enc|NimbusSansNarrow-Regular.t1!NimbusSansNarrow-Regular!NimbusSanL-ReguCond!n019043l.pfb +HR|N|r|text.map|text.enc|NimbusSans-Regular.t1!NimbusSans-Regular!NimbusSans-Regular!NimbusSanL-Regu!n019003l.pfb +NB|N|r|text.map|text.enc|C059-Bold.t1!C059-Bold!CenturySchL-Bold!c059016l.pfb +NBI|N|i|text.map|text.enc|C059-BdIta.t1!C059-BdIta!CenturySchL-BoldItal!c059036l.pfb +NI|N|i|text.map|text.enc|C059-Italic.t1!C059-Italic!CenturySchL-Ital!c059033l.pfb +NR|N|r|text.map|text.enc|C059-Roman.t1!C059-Roman!CenturySchL-Roma!c059013l.pfb +PB|N|r|text.map|text.enc|P052-Bold.t1!P052-Bold!URWPalladioL-Bold!p052004l.pfb +PBI|N|i|text.map|text.enc|P052-BoldItalic.t1!P052-BoldItalic!URWPalladioL-BoldItal!p052024l.pfb +PI|N|i|text.map|text.enc|P052-Italic.t1!P052-Italic!URWPalladioL-Ital!p052023l.pfb +PR|N|r|text.map|text.enc|P052-Roman.t1!P052-Roman!URWPalladioL-Roma!p052003l.pfb +S|N|sr|symbol.map||StandardSymbolsPS.t1!StandardSymbolsPS!StandardSymL!s050000l.pfb +TB|N|r|text.map|text.enc|NimbusRoman-Bold.t1!NimbusRoman-Bold!NimbusRomNo9L-Medi!n021004l.pfb +TBI|N|i|text.map|text.enc|NimbusRoman-BoldItalic.t1!NimbusRoman-BoldItalic!NimbusRomNo9L-MediItal!n021024l.pfb +TI|N|i|text.map|text.enc|NimbusRoman-Italic.t1!NimbusRoman-Italic!NimbusRomNo9L-ReguItal!n021023l.pfb +TR|N|r|text.map|text.enc|NimbusRoman-Regular.t1!NimbusRoman-Regular!NimbusRomNo9L-Regu!n021003l.pfb +ZCMI|N|i|text.map|text.enc|Z003-MediumItalic.t1!Z003-MediumItalic!URWChanceryL-MediItal!z003034l.pfb +ZD|N|sr|dingbats.map||D050000L!D050000L.t1!Dingbats!d050000l.pfb + +# END URW ============================================================== diff --git a/font/devpdf/devpdf.am b/font/devpdf/devpdf.am new file mode 100644 index 0000000..edce365 --- /dev/null +++ b/font/devpdf/devpdf.am @@ -0,0 +1,210 @@ +# Copyright (C) 2011-2020 Free Software Foundation, Inc. +# Written by Deri James <deri@chuzzlewit.myzen.co.uk> +# Automake migration by Bertrand Garrigues +# <bertrand.garrigues@laposte.net> +# +# This file is part of groff. +# +# groff is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# groff is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +devpdf_srcdir = $(top_srcdir)/font/devpdf +GROFF_FONT_FILES=`cd $(top_builddir)/font/devpdf \ + && grep -ls internalname [A-CEG-Z]*` +ENC_FILES=`cd $(top_builddir)/font/devpdf; ls enc/*` +MAP_FILES=`cd $(top_builddir)/font/devpdf; ls map/*` + +MOSTLYCLEANFILES += \ + font/devpdf/download \ + font/devpdf/DESC \ + font/devpdf/Foundry \ + font/devpdf/util/BuildFoundries + +devpdffontdir = $(fontdir)/devpdf +devpdffont_DATA = \ + font/devpdf/DESC \ + font/devpdf/Foundry + +devpdffontencdir = $(devpdffontdir)/enc +devpdffontenc_DATA = font/devpdf/enc/text.enc + +devpdffontmapdir = $(devpdffontdir)/map +devpdffontmapdata = \ + font/devpdf/map/dingbats.map \ + font/devpdf/map/symbol.map \ + font/devpdf/map/symbolchars \ + font/devpdf/map/text.map +devpdffontmap_DATA = $(devpdffontmapdata) + +EXTRA_DIST += \ + font/devpdf/DESC.in \ + font/devpdf/Foundry.in \ + font/devpdf/util/BuildFoundries.pl + +all: font/devpdf/stamp + +font/devpdf/enc/text.enc: + $(AM_V_at)$(MKDIR_P) $(top_builddir)/font/devpdf/enc + $(AM_V_at)cp -f $(top_srcdir)/font/devps/text.enc \ + $(top_builddir)/font/devpdf/enc + +$(devpdffontmapdata): + $(AM_V_at)$(MKDIR_P) $(top_builddir)/font/devpdf/map + $(AM_V_at)cp -f \ + $(top_srcdir)/font/devps/generate/`basename $@` \ + $(top_builddir)/font/devpdf/map + +MOSTLYCLEANFILES += font/devpdf/util/BuildFoundries +font/devpdf/util/BuildFoundries: \ + $(devpdf_srcdir)/util/BuildFoundries.pl $(SH_DEPS_SED_SCRIPT) afmtodit + $(AM_V_GEN)$(MKDIR_P) $(top_builddir)/font/devpdf/util \ + && if test -n "$(PERL)"; then \ + sed -f $(SH_DEPS_SED_SCRIPT) \ + -e "s|/usr/bin/perl|$(PERL)|" \ + -e "s|[@]GHOSTSCRIPT[@]|$(GHOSTSCRIPT)|" \ + -e "s|[@]PATH_SEPARATOR[@]|$(PATH_SEPARATOR)|" \ + -e "s|[@]VERSION[@]|$(VERSION)|" \ + -e "s|[@]GROFF_FONT_DIR[@]|$(fontdir)|" \ + $(devpdf_srcdir)/util/BuildFoundries.pl \ + >$(top_builddir)/font/devpdf/util/BuildFoundries; \ + else \ + sed -f $(SH_DEPS_SED_SCRIPT) \ + -e "s|[@]VERSION[@]|$(VERSION)|" \ + -e "s|[@]GROFF_FONT_DIR[@]|$(fontdir)|" \ + $(devpdf_srcdir)/util/BuildFoundries.pl \ + >$(top_builddir)/font/devpdf/util/BuildFoundries; \ + fi \ + && chmod +x $(top_builddir)/font/devpdf/util/BuildFoundries + +MOSTLYCLEANFILES += font/devpdf/DESC +font/devpdf/DESC: $(devpdf_srcdir)/DESC.in + $(AM_V_GEN)$(MKDIR_P) $(top_builddir)/font/devpdf \ + && cat $(devpdf_srcdir)/DESC.in \ + >$(top_builddir)/font/devpdf/DESC \ + && if test "$(PAGE)" = A4; then \ + echo "papersize a4" >>$(top_builddir)/font/devpdf/DESC; \ + else \ + echo "papersize letter" \ + >>$(top_builddir)/font/devpdf/DESC; \ + fi + +font/devpdf/Foundry: $(devpdf_srcdir)/Foundry.in + $(AM_V_at)$(MKDIR_P) $(top_builddir)/font/devpdf/ +if HAVE_URW_FONTS + $(AM_V_GEN)sed "s|[@]urwfontsdir[@]|$(urwfontsdir)|" \ + $(devpdf_srcdir)/Foundry.in >$@ +else + $(AM_V_GEN)sed "/BEGIN URW/,/END URW/d" \ + $(devpdf_srcdir)/Foundry.in >$@ +endif + +# This is kind of a cheat, but works because BuildFoundries produces so +# many artifacts. +$(DEFAULT_BASE35_FONTS) $(URW_BASE35_FONTS): font/devpdf/download + +MOSTLYCLEANFILES += font/devpdf/download +font/devpdf/download: $(devpdffontmapdata) font/devpdf/DESC \ + font/devpdf/Foundry font/devpdf/enc/text.enc \ + font/devpdf/util/BuildFoundries + $(AM_V_GEN)$(MKDIR_P) $(top_builddir)/font/devpdf \ + && echo "# foundry ps-font-name ps-font-file" >$@.tmp \ + && echo "# A blank foundry is the default." >>$@.tmp \ + && PATH="$(abs_top_builddir)$(GROFF_PATH_SEPARATOR)$(abs_top_builddir)/build-aux$(GROFF_PATH_SEPARATOR)$(PATH)" \ + $(abs_top_builddir)/font/devpdf/util/BuildFoundries \ + --strict $(abs_top_builddir)/font/devpdf \ + '$(abs_top_srcdir)/font/devps:$(abs_top_builddir)/font/devps' \ + >>$@.tmp \ + && mv $@.tmp $@ + +# PDFs to be produced by troff should depend on this stamp file to +# ensure that gropdf's device and font description files are available. +MOSTLYCLEANFILES += font/devpdf/stamp +font/devpdf/stamp: font/devpdf/DESC font/devpdf/download \ + $(devpdffontenc_DATA) $(devpdffontmap_DATA) $(devpdffont_DATA) + $(AM_V_at)>$@ + +mostlyclean-local: mostlyclean_devpdf_extra +mostlyclean_devpdf_extra: + @echo Cleaning font/devpdf + rm -rf $(top_builddir)/font/devpdf/enc \ + $(top_builddir)/font/devpdf/map; + if test -d $(top_builddir)/font/devpdf; then \ + for f in $(GROFF_FONT_FILES); do \ + rm -f $(top_builddir)/font/devpdf/$$f; \ + done; \ + fi + +install-data-local: install_devpdf +install_devpdf: + @echo Installing devpdf files + -@test -d $(DESTDIR)$(devpdffontdir) \ + || $(mkinstalldirs) $(DESTDIR)$(devpdffontdir) + @for f in $(GROFF_FONT_FILES); do \ + $(RM) $(DESTDIR)$(devpdffontdir)/$$f; \ + if test -f $$f; then \ + $(INSTALL_DATA) $$f $(DESTDIR)$(devpdffontdir)/$$f; \ + else \ + $(INSTALL_DATA) $(top_builddir)/font/devpdf/$$f \ + $(DESTDIR)$(devpdffontdir)/$$f; \ + fi; \ + done + $(INSTALL_DATA) $(top_builddir)/font/devpdf/download \ + $(DESTDIR)$(devpdffontdir)/ + +uninstall_groffdirs: uninstall_devpdf +uninstall_devpdf: + @echo Uninstalling devpdf files + if test -d $(DESTDIR)$(devpdffontdir); then \ + for f in $(GROFF_FONT_FILES); do \ + rm -f $(DESTDIR)$(devpdffontdir)/$$f; \ + done; \ + if test -d $(DESTDIR)$(devpdffontencdir); then \ + rmdir $(DESTDIR)$(devpdffontencdir); \ + fi; \ + if test -d $(DESTDIR)$(devpdffontmapdir); then \ + rmdir $(DESTDIR)$(devpdffontmapdir); \ + fi; \ + rm -f $(DESTDIR)$(devpdffontdir)/download; \ + 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) +MOSTLYCLEANFILES += $(font_devpdf_TESTS) +EXTRA_DIST += $(font_devpdf_default_test) $(font_devpdf_urw_test) + + +# Local Variables: +# mode: makefile-automake +# fill-column: 72 +# End: +# vim: set autoindent filetype=automake textwidth=72: diff --git a/font/devpdf/tests/check-default-foundry.sh.in b/font/devpdf/tests/check-default-foundry.sh.in new file mode 100755 index 0000000..026cc01 --- /dev/null +++ b/font/devpdf/tests/check-default-foundry.sh.in @@ -0,0 +1,99 @@ +#!/bin/sh +# +# Copyright (C) 2022-2023 Free Software Foundation, Inc. +# +# This file is part of groff. +# +# groff is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# groff is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +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' + +# 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 +BMB +BMBI +BMI +BMR +HNB +HNBI +HNI +HNR +NB +NBI +NI +NR +PB +PBI +PI +PR +ZCMI' + +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 $supplementary_fonts +do + printf "checking for font description %s...\n" "$f" >&2 + test -f "$devpdf_fontbuilddir"/"$f" || wail +done + +test -z "$fail" + +# vim:set ai et sw=4 ts=4 tw=72: diff --git a/font/devpdf/tests/check-urw-foundry.sh.in b/font/devpdf/tests/check-urw-foundry.sh.in new file mode 100755 index 0000000..d31b3aa --- /dev/null +++ b/font/devpdf/tests/check-urw-foundry.sh.in @@ -0,0 +1,86 @@ +#!/bin/sh +# +# Copyright (C) 2022-2023 Free Software Foundation, Inc. +# +# This file is part of groff. +# +# groff is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# groff is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +# 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 +urwfontsdir=@urwfontsdir@ + +if [ -z "$urwfontsdir" ] +then + echo "URW fonts not found at configuration time; skipping" >&2 + exit 77 # skip +fi + +fonts='AB +ABI +AI +AR +BMB +BMBI +BMI +BMR +CB +CBI +CI +CR +HB +HBI +HI +HNB +HNBI +HNI +HNR +HR +NB +NBI +NI +NR +PB +PBI +PI +PR +S +TB +TBI +TI +TR +ZCMI +ZD' + +fail= + +for basefontname in $fonts +do + f=U-$basefontname + printf "checking for font description %s...\n" $f >&2 + if ! test -f "$devpdf_fontbuilddir"/$f + then + echo test -f "$devpdf_fontbuilddir"/$f + echo ...FAILED >&2 + fail=yes + fi +done + +test -z "$fail" + +# vim:set ai et sw=4 ts=4 tw=72: diff --git a/font/devpdf/util/BuildFoundries.pl b/font/devpdf/util/BuildFoundries.pl new file mode 100644 index 0000000..2815c37 --- /dev/null +++ b/font/devpdf/util/BuildFoundries.pl @@ -0,0 +1,578 @@ +#!/usr/bin/perl +# +# BuildFoundries: Given a Foundry file, generate groff font description +# files and a "download" file so gropdf can embed fonts in PDF output. +# +# Copyright (C) 2011-2020 Free Software Foundation, Inc. +# Written by Deri James <deri@chuzzlewit.myzen.co.uk> +# +# This file is part of groff. +# +# groff is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# groff is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +use strict; +use Getopt::Long; +use warnings; + +my $pathsep='@PATH_SEPARATOR@'; + +my $check=0; +my $dirURW=''; +my $beStrict=0; + +GetOptions("check" => \$check, "dirURW=s" => \$dirURW, + "strict" => \$beStrict); + +(my $progname = $0) =~s @.*/@@; +my $where=shift||''; +my @d=(split(':',shift||'../devps')); +my $devps=\@d; +chdir $where if $where ne ''; +my (%flg,@downloadpreamble,%download); +my $GSpath=FindGSpath(); +my $lct=0; +my $foundry=''; # the default foundry +my $notFoundFont=0; + +if ($check) +{ + CheckFoundry("Foundry.in"); + exit $notFoundFont; +} +else +{ + LoadDownload("download"); # not required + LoadFoundry("Foundry"); + WriteDownload(); +} +exit 0; + + + +sub LoadFoundry +{ + my $fn=shift; + my $foundrypath; + $notFoundFont=0; + + open(F,"<$fn") or Die("file '$fn' not found or not readable"); + + while (<F>) + { + chomp; + $lct++; + s/\r$//; # in case edited in windows + + s/\s*#.*?$//; # remove comments + + next if $_ eq ''; + + if (m/^[A-Za-z]=/) + { + my (@f)=split('='); + $flg{$f[0]}=$f[1]; + next; + } + + my (@r)=split('\|'); + + if (lc($r[0]) eq 'foundry') + { + Warn("\nThe path(s) used for searching:\n".join(':',@{$foundrypath})."\n") if $notFoundFont; + $foundry=uc($r[1]); + $foundrypath=[]; + push(@{$foundrypath},$dirURW) if $dirURW; + push(@{$foundrypath},(split(':',$r[2])),@{$devps}); + foreach my $j (0..$#{$foundrypath}) + { + if (defined($foundrypath->[$j]) + && $foundrypath->[$j]=~m'\s*\(gs\)') + { + splice(@{$foundrypath},$j,1,@{$GSpath}); + } + } + $notFoundFont=0; + } + 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 groff font + # description file for grops. + my $gotf=1; + my $gropsfnt=LocateFile($devps,$r[0],0); + if ($gropsfnt ne '' and -r "$gropsfnt") + { + my $psfont=UseGropsVersion($gropsfnt); + # To be embeddable in PDF, the font file name itself + # needs to be located and written to "download". + if (!PutDownload($psfont, + LocatePF($foundrypath,$r[5]), + uc($r[1]))) + { + if (uc($r[1]) ne 'Y') + { + $gotf=0; + my $fns=join(', ',split('!',$r[5])); + Warn("groff font '$gfont' will not be" + . " available for PDF output; unable" + . " to locate font file(s): $fns"); + $notFoundFont=1; + unlink $gfont; + } + } + Notice("copied grops font $gfont") if $gotf; + + } + else + { + Warn("Can't read grops font '$r[0]' for Foundry '$foundry'"); + } + } + else + { + # Use afmtodit to create a groff font description file. + my $afmfile=LocateAF($foundrypath,$r[5]); + if (!$afmfile) { + my $sub=\&Warn; + $sub=\&Die if ($beStrict); + &$sub("cannot locate AFM file for font '$gfont'"); + next; + } + my $psfont=RunAfmtodit($gfont,$afmfile,$r[2],$r[3],$r[4]); + + if ($psfont) + { + if (!PutDownload($psfont,LocatePF($foundrypath,$r[5]),uc($r[1]))) + { + unlink $gfont; # Unable to find the postscript file for the font just created by afmtodit + } + else + { + Notice("generated $gfont"); + } + } + else + { + Warn("Failed to create groff font '$gfont' by running afmtodit"); + $notFoundFont=1; + } + } + } + } + + close(F); + Warn("\nThe path(s) used for searching:\n".join(':',@{$foundrypath})."\n") if $notFoundFont; +} + +sub RunAfmtodit +{ + my $gfont=shift; + my $afmfile=shift; + my $flags=shift; + my $map=shift||''; + my $enc=shift||''; + my $psfont=''; + + $enc="-e 'enc/$enc'" if $enc; + $map="'map/$map'" if $map; + + my $cmd='afmtodit -c -dDESC'; + + foreach my $f (split('',$flags)) + { + if (!exists($flg{$f})) + { + Warn("Can't use undefined flag '$f' in calling afmtodit for groff font '$gfont'"); + return(''); + } + + $cmd.=" $flg{$f}"; + } + + system("$cmd $enc '$afmfile' $map $gfont"); + + if ($?) + { + unlink $gfont; + return(''); + } + + if (open(GF,"<$gfont")) + { + my (@gf)=(<GF>); + my @ps=grep(/^internalname /,@gf); + if ($#ps == 0) # Just 1 match + { + (undef,$psfont)=split(' ',$ps[0],2); + chomp($psfont); + } + else + { + Warn("Unexpected format for grops font '$gfont' for Foundry '$foundry' - ignoring"); + } + + close(GF); + } + + return($psfont); +} + +sub LocateAF +{ + my $path=shift; + my $file=shift; + + return(LocateFile($path,$file,1)); +} + +sub LocatePF +{ + my $path=shift; + my $file=shift; + + return(LocateFile($path,$file,0)); +} + +sub LocateFile +{ + my $path=shift; + my $files=shift; + my $tryafm=shift; + return(substr($files,1)) if substr($files,0,1) eq '*'; + + foreach my $p (@{$path}) + { + next if !defined($p) or $p eq ';' or $p eq ':'; + $p=~s/^\s+//; + $p=~s/\s+$//; + $p=~s@/+$@@; + + next if $p=~m/^\%rom\%/; # exclude %rom% paths (from (gs)) + + foreach my $file (reverse(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 + + if (-r $file) + { + return($file); + } + + if ($tryafm and $file=~s'type1/'afm/'i) + { + if (-r "$file") + { + return($file); + } + } + + return(''); + } + + if ($path eq '(tex)') + { + my $res=`kpsewhich $file`; + return '' if $?; + chomp($res); + return($res); + } + + if (-r "$p/$file") + { + return("$p/$file"); + } + + my $ap=$p; + + if ($tryafm and $ap=~s'type1/'afm/'i) + { + if (-r "$ap/$file") + { + return("$ap/$file"); + } + } + } + } + + return(''); +} + +sub FindGSpath +{ + my (@res)=`@GHOSTSCRIPT@ -h 2>/dev/null`; + return [] if $?; + my $buildpath=[]; + my $stg=1; + + foreach my $l (@res) + { + chomp($l); + + if ($stg==1 and $l=~m/^Search path:/) + { + $stg=2; + } + elsif ($stg == 2) + { + if (substr($l,0,1) ne ' ') + { + $stg=3; + } + else + { + $l=~s/^\s+//; + $pathsep=';' if substr($l,-1) eq ';'; + push(@{$buildpath},(split("$pathsep",$l))); + } + } + } + + return($buildpath); +} + +sub UseGropsVersion +{ + my $gfont=shift; + my $psfont=''; + my (@gfa)=split('/',$gfont); + my $gfontbase=pop(@gfa); + + if (open(GF,"<$gfont")) + { + my (@gf)=(<GF>); + my @ps=grep(/^internalname /,@gf); + if ($#ps == 0) # Just 1 match + { + (undef,$psfont)=split(' ',$ps[0],2); + chomp($psfont); + } + else + { + Warn("Unexpected format for grops font '$gfont' for Foundry '$foundry' - ignoring"); + } + + close(GF); + + if ($psfont) + { + if (open(GF,">$gfontbase")) + { + local $"=''; + print GF "@gf"; + close(GF); + } + else + { + $psfont=''; + Warn("Failed to create new font '$gfont' for Foundry '$foundry'"); + } + } + else + { + Warn("Failed to locate postscript internalname in grops font '$gfont' for Foundry '$foundry'"); + } + + close(GF); + } + else + { + Warn("Failed to open grops font '$gfont' for Foundry '$foundry'"); + } + + return($psfont); +} + +sub PutDownload +{ + my $psfont=shift; + my $pffile=shift; + my $IsBase14=shift; + my $key="$foundry $psfont"; + + delete($download{$key}), return 0 if ($pffile eq ''); + + $pffile='*'.$pffile if $IsBase14 eq 'Y'; # This signals to gropdf to only edmbed if -e given + $download{$key}=$pffile; + + return 1; +} + +sub LoadDownload +{ + my $fn=shift; + + return if !open(F,"<$fn"); + + while (<F>) + { + chomp; + s/\r$//; # in case edited in windows + + if (substr($_,0,1) eq '#' or $_ eq '') + { + # Preserve comments at top of download file + + push(@downloadpreamble,$_); + next; + } + + s/\s*#.*?$//; # remove comments + + next if $_ eq ''; + + my (@r)=split(/\t+/); + my $key=$r[1]; + $key="$r[0] $r[1]"; + $download{$key}=$r[2]; + } + + close(F); +} + +sub WriteDownload +{ + print join("\n",@downloadpreamble),"\n"; + + foreach my $k (sort keys %download) + { + my ($f,$ps)=split(/ /,$k); + print "$f\t$ps\t$download{$k}\n"; + } +} + +sub Notice { + my $msg=shift; + Msg("notice: $msg"); +} + +sub Warn { + my $msg=shift; + Msg("warning: line $lct: $msg"); +} + +sub Die { + my $msg=shift; + Msg("error: $msg"); + exit 2; +} + +sub Msg { + my $msg=shift; + print STDERR "$progname: $msg\n"; +} + +sub CheckFoundry +{ + my $fn=shift; + my $foundrypath=[]; + $notFoundFont=0; + + open(F,"<$fn") or Die("file '$fn' not found or not readable"); + + 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=[]; + push(@{$foundrypath},$dirURW) if $dirURW; + push(@{$foundrypath},(split(':',$r[2])),$devps); + foreach my $j (0..$#{$foundrypath}) + { + if ($foundrypath->[$j]=~m'\s*\(gs\)') + { + splice(@{$foundrypath},$j,1,@{$GSpath}); + } + } + $notFoundFont=0; + } + 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(F); +} + +# Local Variables: +# fill-column: 72 +# mode: CPerl +# End: +# vim: set cindent noexpandtab shiftwidth=4 softtabstop=4 textwidth=72: |