summaryrefslogtreecommitdiff
path: root/fonts/utilities/fontload
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /fonts/utilities/fontload
Initial commit
Diffstat (limited to 'fonts/utilities/fontload')
-rw-r--r--fonts/utilities/fontload/README46
-rw-r--r--fonts/utilities/fontload/README.news25
-rw-r--r--fonts/utilities/fontload/lib/35.FS35
-rw-r--r--fonts/utilities/fontload/lib/Fontmap.t1348
-rw-r--r--fonts/utilities/fontload/lib/Standard.FS13
-rw-r--r--fonts/utilities/fontload/lib/cvtmap.ps13
-rw-r--r--fonts/utilities/fontload/lib/psfstat.ps386
-rw-r--r--fonts/utilities/fontload/man/fload.170
-rw-r--r--fonts/utilities/fontload/man/subfont.1175
-rw-r--r--fonts/utilities/fontload/src/Makefile21
-rw-r--r--fonts/utilities/fontload/src/fstat.c17
-rw-r--r--fonts/utilities/fontload/src/subfont.c1860
-rw-r--r--fonts/utilities/fontload/unix/INSTALL120
-rw-r--r--fonts/utilities/fontload/unix/UpdateMap.csh35
-rw-r--r--fonts/utilities/fontload/unix/fload.csh140
-rw-r--r--fonts/utilities/fontload/unix/home.dirs15
-rw-r--r--fonts/utilities/fontload/unix/install.dirs18
-rw-r--r--fonts/utilities/fontload/unix/install.txt5
-rw-r--r--fonts/utilities/fontload/unix/mkmap34
-rw-r--r--fonts/utilities/fontload/unix/ppd2fs13
-rw-r--r--fonts/utilities/fontload/unix/usr-local.dirs15
-rw-r--r--fonts/utilities/fontload/vms/fload.com122
-rw-r--r--fonts/utilities/fontload/vms/fontmap.t1254
-rw-r--r--fonts/utilities/fontload/vms/init.com7
-rw-r--r--fonts/utilities/fontload/vms/install.txt77
-rw-r--r--fonts/utilities/fontload/vms/make.com11
-rw-r--r--fonts/utilities/fontload/vms/subfont.exe-alphabin0 -> 48128 bytes
-rw-r--r--fonts/utilities/fontload/vms/subfont.exe-vaxbin0 -> 89600 bytes
28 files changed, 3875 insertions, 0 deletions
diff --git a/fonts/utilities/fontload/README b/fonts/utilities/fontload/README
new file mode 100644
index 0000000000..2ab4070a33
--- /dev/null
+++ b/fonts/utilities/fontload/README
@@ -0,0 +1,46 @@
+
+Copyright (C) 1994, Basil K. Malyshev. All rights reserved.
+
+Partial font downloading utility.
+
+SYSTEMS: Unix, VMS, IBM-PC/MS-DOS.
+NEEDED: GhostScript interpreter: GS 2.6.1 (recomended) or GS 3.12
+
+This tool realizes partial downloading of the ATM compatible Type 1 fonts
+required in the specified PostScript file.
+This tool is combination of
+ - the psfstat.ps PostScript script
+ which collects information about font using
+ - and SubFont program which extracts from source fonts subfonts which
+ contains only required characters.
+
+This approach, in comparison with well known DVIPSONE partial font
+downloading facility, has follow advantages:
+ 1. That can be applied in many systems which generates PostScript output.
+ So, psfstat.ps script was tested with:
+ a. DVIPS output;
+ b. Frame Output;
+ c. MS Windows PostScript driver output.
+ 2. That prepare not only text fonts but also fonts used in inserted
+ pictures.
+
+However, this approach requires a lot of CPU time to complete scanning
+of the PostScript file.
+
+==== USING, for example with DVIPS. ====
+
+Tune DVIPS font maps such that ATM compatible Type 1 fonts
+will not be copied into output PostScript file.
+So, you must use for font mapping cmfonts.ref file which contains lines like:
+ cmr10 cmr10
+but not cmfonts.map file which contains lines like:
+ cmr10 cmr10 <cmr10.pfb
+
+In correct case, After command
+ dvips -P??? foo
+you will have PostScript file without fonts, which you can print by command
+ fload foo.ps | lpr
+
+Basil K. Malyshev, 11/24/94 22:59:01, Geneve, Switzerland.
+E-Mail: malyshev@dxcern.cern.ch or malyshev@mx.ihep.su
+
diff --git a/fonts/utilities/fontload/README.news b/fonts/utilities/fontload/README.news
new file mode 100644
index 0000000000..f3fd7c6b25
--- /dev/null
+++ b/fonts/utilities/fontload/README.news
@@ -0,0 +1,25 @@
+
+ Differences with previous version which was issued 28-Nov-94.
+
+ 1. It generates more compact code to download font into printer,
+ that reduces resulted file size and printer downloading time.
+ 2. Printer memory requirements is also slightly reduced.
+ 3. Ported to other platforms, such that it works now on
+ UNIX, MS-DOS, VMS.
+ 4. Improved control of the error situations.
+ 5. Added option '-p' that selects font set which is built in printer.
+ 6. Solved disadvantage with those fonts which have common
+ CharStrings (for example Univers fonts).
+ 7. Made the same font map for GhostScript and SubFont program.
+ 8. Tested with GhostScript 3.12,
+ that is able to apply partial font downloading to document
+ used Multiple Master fonts.
+ HOWEVER, gs 3.12 have a bugs, in thsi reason gs 2.6.1 using
+ is recomended.
+ 9. Man pages for 'fload' and 'subfont' are added.
+
+Basil K. Malyshev, 27-Jan-95, Geneve, Switzerland.
+
+
+
+
diff --git a/fonts/utilities/fontload/lib/35.FS b/fonts/utilities/fontload/lib/35.FS
new file mode 100644
index 0000000000..2b6a9ae723
--- /dev/null
+++ b/fonts/utilities/fontload/lib/35.FS
@@ -0,0 +1,35 @@
+AvantGarde-Book
+AvantGarde-BookOblique
+AvantGarde-Demi
+AvantGarde-DemiOblique
+Bookman-Demi
+Bookman-DemiItalic
+Bookman-Light
+Bookman-LightItalic
+Courier
+Courier-Bold
+Courier-BoldOblique
+Courier-Oblique
+Helvetica
+Helvetica-Bold
+Helvetica-BoldOblique
+Helvetica-Narrow
+Helvetica-Narrow-Bold
+Helvetica-Narrow-BoldOblique
+Helvetica-Narrow-Oblique
+Helvetica-Oblique
+NewCenturySchlbk-Bold
+NewCenturySchlbk-BoldItalic
+NewCenturySchlbk-Italic
+NewCenturySchlbk-Roman
+Palatino-Bold
+Palatino-BoldItalic
+Palatino-Italic
+Palatino-Roman
+Symbol
+Times-Bold
+Times-BoldItalic
+Times-Italic
+Times-Roman
+ZapfChancery-MediumItalic
+ZapfDingbats
diff --git a/fonts/utilities/fontload/lib/Fontmap.t1 b/fonts/utilities/fontload/lib/Fontmap.t1
new file mode 100644
index 0000000000..e96573ca11
--- /dev/null
+++ b/fonts/utilities/fontload/lib/Fontmap.t1
@@ -0,0 +1,348 @@
+%% This part was constructed from /usr/local/lib/texmf/fonts directory
+/cmcb10 (./russian/type1/cmcb10.pfb) ;
+/cmcbx10 (./russian/type1/cmcbx10.pfb) ;
+/cmcbx12 (./russian/type1/cmcbx12.pfb) ;
+/cmcbx5 (./russian/type1/cmcbx5.pfb) ;
+/cmcbx6 (./russian/type1/cmcbx6.pfb) ;
+/cmcbx7 (./russian/type1/cmcbx7.pfb) ;
+/cmcbx8 (./russian/type1/cmcbx8.pfb) ;
+/cmcbx9 (./russian/type1/cmcbx9.pfb) ;
+/cmcbxsl10 (./russian/type1/cmcbxsl1.pfb) ;
+/cmcbxti10 (./russian/type1/cmcbxti1.pfb) ;
+/cmccsc10 (./russian/type1/cmccsc10.pfb) ;
+/cmccsc8 (./russian/type1/cmccsc8.pfb) ;
+/cmccsc9 (./russian/type1/cmccsc9.pfb) ;
+/cmcitt10 (./russian/type1/cmcitt10.pfb) ;
+/cmcsc10 (./russian/type1/cmcsc10.pfb) ;
+/cmcsc8 (./russian/type1/cmcsc8.pfb) ;
+/cmcsc9 (./russian/type1/cmcsc9.pfb) ;
+/cmcsl10 (./russian/type1/cmcsl10.pfb) ;
+/cmcsl12 (./russian/type1/cmcsl12.pfb) ;
+/cmcsl8 (./russian/type1/cmcsl8.pfb) ;
+/cmcsl9 (./russian/type1/cmcsl9.pfb) ;
+/cmcsltt10 (./russian/type1/cmcsltt1.pfb) ;
+/cmcss10 (./russian/type1/cmcss10.pfb) ;
+/cmcss12 (./russian/type1/cmcss12.pfb) ;
+/cmcss17 (./russian/type1/cmcss17.pfb) ;
+/cmcss8 (./russian/type1/cmcss8.pfb) ;
+/cmcss9 (./russian/type1/cmcss9.pfb) ;
+/cmcssbx10 (./russian/type1/cmcssbx1.pfb) ;
+/cmcssdc10 (./russian/type1/cmcssdc1.pfb) ;
+/cmcssi10 (./russian/type1/cmcssi10.pfb) ;
+/cmcssi12 (./russian/type1/cmcssi12.pfb) ;
+/cmcssi17 (./russian/type1/cmcssi17.pfb) ;
+/cmcssi8 (./russian/type1/cmcssi8.pfb) ;
+/cmcssi9 (./russian/type1/cmcssi9.pfb) ;
+/cmcssq8 (./russian/type1/cmcssq8.pfb) ;
+/cmcssqi8 (./russian/type1/cmcssqi8.pfb) ;
+/cmcti10 (./russian/type1/cmcti10.pfb) ;
+/cmcti12 (./russian/type1/cmcti12.pfb) ;
+/cmcti7 (./russian/type1/cmcti7.pfb) ;
+/cmcti8 (./russian/type1/cmcti8.pfb) ;
+/cmcti9 (./russian/type1/cmcti9.pfb) ;
+/cmctt10 (./russian/type1/cmctt10.pfb) ;
+/cmctt12 (./russian/type1/cmctt12.pfb) ;
+/cmctt8 (./russian/type1/cmctt8.pfb) ;
+/cmctt9 (./russian/type1/cmctt9.pfb) ;
+/cmcu10 (./russian/type1/cmcu10.pfb) ;
+/cmcyr10 (./russian/type1/cmcyr10.pfb) ;
+/cmcyr12 (./russian/type1/cmcyr12.pfb) ;
+/cmcyr17 (./russian/type1/cmcyr17.pfb) ;
+/cmcyr5 (./russian/type1/cmcyr5.pfb) ;
+/cmcyr6 (./russian/type1/cmcyr6.pfb) ;
+/cmcyr7 (./russian/type1/cmcyr7.pfb) ;
+/cmcyr8 (./russian/type1/cmcyr8.pfb) ;
+/cmcyr9 (./russian/type1/cmcyr9.pfb) ;
+/cmb10 (./cm/type1/cmb10.pfb) ;
+/cmbsy10 (./cm/type1/cmbsy10.pfb) ;
+/cmbx10 (./cm/type1/cmbx10.pfb) ;
+/cmbx12 (./cm/type1/cmbx12.pfb) ;
+/cmbx5 (./cm/type1/cmbx5.pfb) ;
+/cmbx6 (./cm/type1/cmbx6.pfb) ;
+/cmbx7 (./cm/type1/cmbx7.pfb) ;
+/cmbx8 (./cm/type1/cmbx8.pfb) ;
+/cmbx9 (./cm/type1/cmbx9.pfb) ;
+/cmbxsl10 (./cm/type1/cmbxsl10.pfb) ;
+/cmbxti10 (./cm/type1/cmbxti10.pfb) ;
+/cmcb10 (./cm/type1/cmcb10.pfb) ;
+/cmcbx10 (./cm/type1/cmcbx10.pfb) ;
+/cmcbx12 (./cm/type1/cmcbx12.pfb) ;
+/cmcbx5 (./cm/type1/cmcbx5.pfb) ;
+/cmcbx6 (./cm/type1/cmcbx6.pfb) ;
+/cmcbx7 (./cm/type1/cmcbx7.pfb) ;
+/cmcbx8 (./cm/type1/cmcbx8.pfb) ;
+/cmcbx9 (./cm/type1/cmcbx9.pfb) ;
+/cmcbxsl10 (./cm/type1/cmcbxsl1.pfb) ;
+/cmcbxti10 (./cm/type1/cmcbxti1.pfb) ;
+/cmccsc10 (./cm/type1/cmccsc10.pfb) ;
+/cmccsc8 (./cm/type1/cmccsc8.pfb) ;
+/cmccsc9 (./cm/type1/cmccsc9.pfb) ;
+/cmcitt10 (./cm/type1/cmcitt10.pfb) ;
+/cmcsc10 (./cm/type1/cmcsc10.pfb) ;
+/cmcsc8 (./cm/type1/cmcsc8.pfb) ;
+/cmcsc9 (./cm/type1/cmcsc9.pfb) ;
+/cmcsl10 (./cm/type1/cmcsl10.pfb) ;
+/cmcsl12 (./cm/type1/cmcsl12.pfb) ;
+/cmcsl8 (./cm/type1/cmcsl8.pfb) ;
+/cmcsl9 (./cm/type1/cmcsl9.pfb) ;
+/cmcsltt10 (./cm/type1/cmcsltt1.pfb) ;
+/cmcss10 (./cm/type1/cmcss10.pfb) ;
+/cmcss12 (./cm/type1/cmcss12.pfb) ;
+/cmcss17 (./cm/type1/cmcss17.pfb) ;
+/cmcss8 (./cm/type1/cmcss8.pfb) ;
+/cmcss9 (./cm/type1/cmcss9.pfb) ;
+/cmcssbx10 (./cm/type1/cmcssbx1.pfb) ;
+/cmcssdc10 (./cm/type1/cmcssdc1.pfb) ;
+/cmcssi10 (./cm/type1/cmcssi10.pfb) ;
+/cmcssi12 (./cm/type1/cmcssi12.pfb) ;
+/cmcssi17 (./cm/type1/cmcssi17.pfb) ;
+/cmcssi8 (./cm/type1/cmcssi8.pfb) ;
+/cmcssi9 (./cm/type1/cmcssi9.pfb) ;
+/cmcssq8 (./cm/type1/cmcssq8.pfb) ;
+/cmcssqi8 (./cm/type1/cmcssqi8.pfb) ;
+/cmcti10 (./cm/type1/cmcti10.pfb) ;
+/cmcti12 (./cm/type1/cmcti12.pfb) ;
+/cmcti7 (./cm/type1/cmcti7.pfb) ;
+/cmcti8 (./cm/type1/cmcti8.pfb) ;
+/cmcti9 (./cm/type1/cmcti9.pfb) ;
+/cmctt10 (./cm/type1/cmctt10.pfb) ;
+/cmctt12 (./cm/type1/cmctt12.pfb) ;
+/cmctt8 (./cm/type1/cmctt8.pfb) ;
+/cmctt9 (./cm/type1/cmctt9.pfb) ;
+/cmcu10 (./cm/type1/cmcu10.pfb) ;
+/cmdunh10 (./cm/type1/cmdunh10.pfb) ;
+/cmex10 (./cm/type1/cmex10.pfb) ;
+/cmff10 (./cm/type1/cmff10.pfb) ;
+/cmfi10 (./cm/type1/cmfi10.pfb) ;
+/cmfib8 (./cm/type1/cmfib8.pfb) ;
+/cminch (./cm/type1/cminch.pfb) ;
+/cmitt10 (./cm/type1/cmitt10.pfb) ;
+/cmmi10 (./cm/type1/cmmi10.pfb) ;
+/cmmi12 (./cm/type1/cmmi12.pfb) ;
+/cmmi5 (./cm/type1/cmmi5.pfb) ;
+/cmmi6 (./cm/type1/cmmi6.pfb) ;
+/cmmi7 (./cm/type1/cmmi7.pfb) ;
+/cmmi8 (./cm/type1/cmmi8.pfb) ;
+/cmmi9 (./cm/type1/cmmi9.pfb) ;
+/cmmib10 (./cm/type1/cmmib10.pfb) ;
+/cmr10 (./cm/type1/cmr10.pfb) ;
+/cmr12 (./cm/type1/cmr12.pfb) ;
+/cmr17 (./cm/type1/cmr17.pfb) ;
+/cmr5 (./cm/type1/cmr5.pfb) ;
+/cmr6 (./cm/type1/cmr6.pfb) ;
+/cmr7 (./cm/type1/cmr7.pfb) ;
+/cmr8 (./cm/type1/cmr8.pfb) ;
+/cmr9 (./cm/type1/cmr9.pfb) ;
+/cmsl10 (./cm/type1/cmsl10.pfb) ;
+/cmsl12 (./cm/type1/cmsl12.pfb) ;
+/cmsl8 (./cm/type1/cmsl8.pfb) ;
+/cmsl9 (./cm/type1/cmsl9.pfb) ;
+/cmsltt10 (./cm/type1/cmsltt10.pfb) ;
+/cmss10 (./cm/type1/cmss10.pfb) ;
+/cmss12 (./cm/type1/cmss12.pfb) ;
+/cmss17 (./cm/type1/cmss17.pfb) ;
+/cmss8 (./cm/type1/cmss8.pfb) ;
+/cmss9 (./cm/type1/cmss9.pfb) ;
+/cmssbx10 (./cm/type1/cmssbx10.pfb) ;
+/cmssdc10 (./cm/type1/cmssdc10.pfb) ;
+/cmssi10 (./cm/type1/cmssi10.pfb) ;
+/cmssi12 (./cm/type1/cmssi12.pfb) ;
+/cmssi17 (./cm/type1/cmssi17.pfb) ;
+/cmssi8 (./cm/type1/cmssi8.pfb) ;
+/cmssi9 (./cm/type1/cmssi9.pfb) ;
+/cmssq8 (./cm/type1/cmssq8.pfb) ;
+/cmssqi8 (./cm/type1/cmssqi8.pfb) ;
+/cmsy10 (./cm/type1/cmsy10.pfb) ;
+/cmsy5 (./cm/type1/cmsy5.pfb) ;
+/cmsy6 (./cm/type1/cmsy6.pfb) ;
+/cmsy7 (./cm/type1/cmsy7.pfb) ;
+/cmsy8 (./cm/type1/cmsy8.pfb) ;
+/cmsy9 (./cm/type1/cmsy9.pfb) ;
+/cmtcsc10 (./cm/type1/cmtcsc10.pfb) ;
+/cmtex10 (./cm/type1/cmtex10.pfb) ;
+/cmtex8 (./cm/type1/cmtex8.pfb) ;
+/cmtex9 (./cm/type1/cmtex9.pfb) ;
+/cmti10 (./cm/type1/cmti10.pfb) ;
+/cmti12 (./cm/type1/cmti12.pfb) ;
+/cmti7 (./cm/type1/cmti7.pfb) ;
+/cmti8 (./cm/type1/cmti8.pfb) ;
+/cmti9 (./cm/type1/cmti9.pfb) ;
+/cmtt10 (./cm/type1/cmtt10.pfb) ;
+/cmtt12 (./cm/type1/cmtt12.pfb) ;
+/cmtt8 (./cm/type1/cmtt8.pfb) ;
+/cmtt9 (./cm/type1/cmtt9.pfb) ;
+/cmu10 (./cm/type1/cmu10.pfb) ;
+/cmvtt10 (./cm/type1/cmvtt10.pfb) ;
+/lasy10 (./cm/type1/lasy10.pfb) ;
+/lasy5 (./cm/type1/lasy5.pfb) ;
+/lasy6 (./cm/type1/lasy6.pfb) ;
+/lasy7 (./cm/type1/lasy7.pfb) ;
+/lasy8 (./cm/type1/lasy8.pfb) ;
+/lasy9 (./cm/type1/lasy9.pfb) ;
+/lasyb10 (./cm/type1/lasyb10.pfb) ;
+/lcircle10 (./cm/type1/lcircle1.pfb) ;
+/lcirclew10 (./cm/type1/lcirclew.pfb) ;
+/line10 (./cm/type1/line10.pfb) ;
+/linew10 (./cm/type1/linew10.pfb) ;
+/logo10 (./cm/type1/logo10.pfb) ;
+/logo8 (./cm/type1/logo8.pfb) ;
+/logo9 (./cm/type1/logo9.pfb) ;
+/logobf10 (./cm/type1/logobf10.pfb) ;
+/logosl10 (./cm/type1/logosl10.pfb) ;
+/cmbsy6 (./cm/type1/cmbsy6.pfb) ;
+/cmbsy7 (./cm/type1/cmbsy7.pfb) ;
+/cmbsy8 (./cm/type1/cmbsy8.pfb) ;
+/cmbsy9 (./cm/type1/cmbsy9.pfb) ;
+/cmex7 (./cm/type1/cmex7.pfb) ;
+/cmex8 (./cm/type1/cmex8.pfb) ;
+/cmex9 (./cm/type1/cmex9.pfb) ;
+/cmmib6 (./cm/type1/cmmib6.pfb) ;
+/cmmib7 (./cm/type1/cmmib7.pfb) ;
+/cmmib8 (./cm/type1/cmmib8.pfb) ;
+/cmmib9 (./cm/type1/cmmib9.pfb) ;
+/euex10 (./ams/type1/euex10.pfb) ;
+/eufb10 (./ams/type1/eufb10.pfb) ;
+/eufb5 (./ams/type1/eufb5.pfb) ;
+/eufb7 (./ams/type1/eufb7.pfb) ;
+/eufm10 (./ams/type1/eufm10.pfb) ;
+/eufm5 (./ams/type1/eufm5.pfb) ;
+/eufm7 (./ams/type1/eufm7.pfb) ;
+/eurb10 (./ams/type1/eurb10.pfb) ;
+/eurb5 (./ams/type1/eurb5.pfb) ;
+/eurb7 (./ams/type1/eurb7.pfb) ;
+/eurm10 (./ams/type1/eurm10.pfb) ;
+/eurm5 (./ams/type1/eurm5.pfb) ;
+/eurm7 (./ams/type1/eurm7.pfb) ;
+/eusb10 (./ams/type1/eusb10.pfb) ;
+/eusb5 (./ams/type1/eusb5.pfb) ;
+/eusb7 (./ams/type1/eusb7.pfb) ;
+/eusm10 (./ams/type1/eusm10.pfb) ;
+/eusm5 (./ams/type1/eusm5.pfb) ;
+/eusm7 (./ams/type1/eusm7.pfb) ;
+/cmcyr10 (./ams/type1/cmcyr10.pfb) ;
+/cmcyr12 (./ams/type1/cmcyr12.pfb) ;
+/cmcyr17 (./ams/type1/cmcyr17.pfb) ;
+/cmcyr5 (./ams/type1/cmcyr5.pfb) ;
+/cmcyr6 (./ams/type1/cmcyr6.pfb) ;
+/cmcyr7 (./ams/type1/cmcyr7.pfb) ;
+/cmcyr8 (./ams/type1/cmcyr8.pfb) ;
+/cmcyr9 (./ams/type1/cmcyr9.pfb) ;
+/msam10 (./ams/type1/msam10.pfb) ;
+/msbm10 (./ams/type1/msbm10.pfb) ;
+/dcb10 (./dc/type1/dcb10.pfb) ;
+/dcb12 (./dc/type1/dcb12.pfb) ;
+/dcb17 (./dc/type1/dcb17.pfb) ;
+/dcb5 (./dc/type1/dcb5.pfb) ;
+/dcb6 (./dc/type1/dcb6.pfb) ;
+/dcb7 (./dc/type1/dcb7.pfb) ;
+/dcb8 (./dc/type1/dcb8.pfb) ;
+/dcb9 (./dc/type1/dcb9.pfb) ;
+/dcbx10 (./dc/type1/dcbx10.pfb) ;
+/dcbx12 (./dc/type1/dcbx12.pfb) ;
+/dcbx5 (./dc/type1/dcbx5.pfb) ;
+/dcbx6 (./dc/type1/dcbx6.pfb) ;
+/dcbx7 (./dc/type1/dcbx7.pfb) ;
+/dcbx8 (./dc/type1/dcbx8.pfb) ;
+/dcbx9 (./dc/type1/dcbx9.pfb) ;
+/dcbxsl10 (./dc/type1/dcbxsl10.pfb) ;
+/dcbxsl12 (./dc/type1/dcbxsl12.pfb) ;
+/dcbxsl5 (./dc/type1/dcbxsl5.pfb) ;
+/dcbxsl6 (./dc/type1/dcbxsl6.pfb) ;
+/dcbxsl7 (./dc/type1/dcbxsl7.pfb) ;
+/dcbxsl8 (./dc/type1/dcbxsl8.pfb) ;
+/dcbxsl9 (./dc/type1/dcbxsl9.pfb) ;
+/dcbxti10 (./dc/type1/dcbxti10.pfb) ;
+/dcbxti12 (./dc/type1/dcbxti12.pfb) ;
+/dcbxti17 (./dc/type1/dcbxti17.pfb) ;
+/dccsc10 (./dc/type1/dccsc10.pfb) ;
+/dccsc12 (./dc/type1/dccsc12.pfb) ;
+/dccsc17 (./dc/type1/dccsc17.pfb) ;
+/dcdunh10 (./dc/type1/dcdunh10.pfb) ;
+/dcdunh12 (./dc/type1/dcdunh12.pfb) ;
+/dcdunh17 (./dc/type1/dcdunh17.pfb) ;
+/dcdunh5 (./dc/type1/dcdunh5.pfb) ;
+/dcdunh6 (./dc/type1/dcdunh6.pfb) ;
+/dcdunh7 (./dc/type1/dcdunh7.pfb) ;
+/dcdunh8 (./dc/type1/dcdunh8.pfb) ;
+/dcdunh9 (./dc/type1/dcdunh9.pfb) ;
+/dcff10 (./dc/type1/dcff10.pfb) ;
+/dcfi10 (./dc/type1/dcfi10.pfb) ;
+/dcfib10 (./dc/type1/dcfib10.pfb) ;
+/dcfib8 (./dc/type1/dcfib8.pfb) ;
+/dcfib9 (./dc/type1/dcfib9.pfb) ;
+/dcitt10 (./dc/type1/dcitt10.pfb) ;
+/dcitt12 (./dc/type1/dcitt12.pfb) ;
+/dcitt17 (./dc/type1/dcitt17.pfb) ;
+/dcitt8 (./dc/type1/dcitt8.pfb) ;
+/dcitt9 (./dc/type1/dcitt9.pfb) ;
+/dcr10 (./dc/type1/dcr10.pfb) ;
+/dcr12 (./dc/type1/dcr12.pfb) ;
+/dcr17 (./dc/type1/dcr17.pfb) ;
+/dcr5 (./dc/type1/dcr5.pfb) ;
+/dcr6 (./dc/type1/dcr6.pfb) ;
+/dcr7 (./dc/type1/dcr7.pfb) ;
+/dcr8 (./dc/type1/dcr8.pfb) ;
+/dcr9 (./dc/type1/dcr9.pfb) ;
+/dcsl10 (./dc/type1/dcsl10.pfb) ;
+/dcsl12 (./dc/type1/dcsl12.pfb) ;
+/dcsl17 (./dc/type1/dcsl17.pfb) ;
+/dcsl5 (./dc/type1/dcsl5.pfb) ;
+/dcsl6 (./dc/type1/dcsl6.pfb) ;
+/dcsl7 (./dc/type1/dcsl7.pfb) ;
+/dcsl8 (./dc/type1/dcsl8.pfb) ;
+/dcsl9 (./dc/type1/dcsl9.pfb) ;
+/dcsltt10 (./dc/type1/dcsltt10.pfb) ;
+/dcsltt12 (./dc/type1/dcsltt12.pfb) ;
+/dcsltt8 (./dc/type1/dcsltt8.pfb) ;
+/dcsltt9 (./dc/type1/dcsltt9.pfb) ;
+/dcss10 (./dc/type1/dcss10.pfb) ;
+/dcss12 (./dc/type1/dcss12.pfb) ;
+/dcss17 (./dc/type1/dcss17.pfb) ;
+/dcss7 (./dc/type1/dcss7.pfb) ;
+/dcss8 (./dc/type1/dcss8.pfb) ;
+/dcss9 (./dc/type1/dcss9.pfb) ;
+/dcssbx10 (./dc/type1/dcssbx10.pfb) ;
+/dcssbx12 (./dc/type1/dcssbx12.pfb) ;
+/dcssbx17 (./dc/type1/dcssbx17.pfb) ;
+/dcssbx8 (./dc/type1/dcssbx8.pfb) ;
+/dcssbx9 (./dc/type1/dcssbx9.pfb) ;
+/dcssbxi10 (./dc/type1/dcssbxi10.pfb) ;
+/dcssi10 (./dc/type1/dcssi10.pfb) ;
+/dcssi12 (./dc/type1/dcssi12.pfb) ;
+/dcssi17 (./dc/type1/dcssi17.pfb) ;
+/dcssi7 (./dc/type1/dcssi7.pfb) ;
+/dcssi8 (./dc/type1/dcssi8.pfb) ;
+/dcssi9 (./dc/type1/dcssi9.pfb) ;
+/dctcsc10 (./dc/type1/dctcsc10.pfb) ;
+/dctcsc12 (./dc/type1/dctcsc12.pfb) ;
+/dctcsc17 (./dc/type1/dctcsc17.pfb) ;
+/dcti10 (./dc/type1/dcti10.pfb) ;
+/dcti12 (./dc/type1/dcti12.pfb) ;
+/dcti17 (./dc/type1/dcti17.pfb) ;
+/dcti5 (./dc/type1/dcti5.pfb) ;
+/dcti6 (./dc/type1/dcti6.pfb) ;
+/dcti7 (./dc/type1/dcti7.pfb) ;
+/dcti8 (./dc/type1/dcti8.pfb) ;
+/dcti9 (./dc/type1/dcti9.pfb) ;
+/dctt10 (./dc/type1/dctt10.pfb) ;
+/dctt12 (./dc/type1/dctt12.pfb) ;
+/dctt8 (./dc/type1/dctt8.pfb) ;
+/dctt9 (./dc/type1/dctt9.pfb) ;
+/dcu10 (./dc/type1/dcu10.pfb) ;
+/dcu12 (./dc/type1/dcu12.pfb) ;
+/dcu17 (./dc/type1/dcu17.pfb) ;
+/dcu7 (./dc/type1/dcu7.pfb) ;
+/dcu8 (./dc/type1/dcu8.pfb) ;
+/dcu9 (./dc/type1/dcu9.pfb) ;
+/dcvtt10 (./dc/type1/dcvtt10.pfb) ;
+/dcvtt12 (./dc/type1/dcvtt12.pfb) ;
+/dcvtt8 (./dc/type1/dcvtt8.pfb) ;
+/dcvtt9 (./dc/type1/dcvtt9.pfb) ;
+/CharterBT-Bold (./charter/type1/bchb0.pfb) ;
+/CharterBT-BoldItalic (./charter/type1/bchbi0.pfb) ;
+/CharterBT-Roman (./charter/type1/bchr0.pfb) ;
+/CharterBT-Italic (./charter/type1/bchri0.pfb) ;
+/Utopia-Bold (./utopia/type1/putb0.pfb) ;
+/Utopia-BoldItalic (./utopia/type1/putbi0.pfb) ;
+/Utopia-Regular (./utopia/type1/putr0.pfb) ;
+/Utopia-Italic (./utopia/type1/putri0.pfb) ;
diff --git a/fonts/utilities/fontload/lib/Standard.FS b/fonts/utilities/fontload/lib/Standard.FS
new file mode 100644
index 0000000000..455ea2ecaf
--- /dev/null
+++ b/fonts/utilities/fontload/lib/Standard.FS
@@ -0,0 +1,13 @@
+Times-Roman
+Times-Bold
+Times-Italic
+Times-BoldItalic
+Courier
+Courier-Bold
+Courier-BoldOblique
+Courier-Oblique
+Helvetica
+Helvetica-Bold
+Helvetica-BoldOblique
+Helvetica-Oblique
+Symbol
diff --git a/fonts/utilities/fontload/lib/cvtmap.ps b/fonts/utilities/fontload/lib/cvtmap.ps
new file mode 100644
index 0000000000..5c2fa715ea
--- /dev/null
+++ b/fonts/utilities/fontload/lib/cvtmap.ps
@@ -0,0 +1,13 @@
+/; { def } bind def
+256 dict begin
+INFILE run
+currentdict end
+/outfp OUTFILE (w) file def
+{
+ exch (..............................................................) cvs
+ outfp exch writestring
+ outfp ( ) writestring
+ outfp exch writestring
+ outfp (\n) writestring
+} forall
+
diff --git a/fonts/utilities/fontload/lib/psfstat.ps b/fonts/utilities/fontload/lib/psfstat.ps
new file mode 100644
index 0000000000..e9e35cd379
--- /dev/null
+++ b/fonts/utilities/fontload/lib/psfstat.ps
@@ -0,0 +1,386 @@
+%!PS-GhostScript-2.6.1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%!PS-GhostScript-3.12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% File: psfstat.ps %
+% %
+% This PostScript program calculate fonts and characters used %
+% in PostScript file loaded after this. %
+% This program usefull for make partial font DownLoading... %
+% %
+% Usage: %
+% gs -DNODISPLAY -DWRITESYSTEMDICT %
+% -I... (must be synchronized with SubFont path) %
+% -sRESIDENTFONTS=file_name_with_list_of_printer_fonts %
+% -sINFILE=file_name_of_the_user_PostScript_file %
+% -sOUTFILE=file_name_for_output_font/char_using_statistics %
+% psfstat.ps quit.ps %
+% %
+% Result: %
+% If all right, It generates OUTFILE which contains names of fonts%
+% and required glyph names. %
+% Zero length file mean that all fonts already in file. %
+% OUTFILE absense means that some error was accured %
+% in processing time. Typically, PS files refers to such fonts %
+% which have no in file and not accesible by GS. %
+% %
+% Date: 5-Dec-1994 %
+% %
+% Copyright (C) 1994 Basil K. Malyshev. All rights reserved. %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+/usrdef { userdict begin def end } bind def
+/sysdef { systemdict begin odef end } bind def
+/savdef { load systemdict begin def end } bind def
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% USAGE %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+/usage
+{
+ (Usage:\n) print
+ ( gs -q -DWRITESYSTEMDICT -DNODISPLAY psfstat.ps <user-ps-file>\n) print
+ stop
+} bind def
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Check SYSTEMDICT write permission and disable all access checks. %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+systemdict dup wcheck not { usage } if
+begin /readonly { } odef /executeonly { } odef /noaccess { } odef end
+ /readonly { } odef /executeonly { } odef /noaccess { } odef
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Statistic collection routines .... %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+/PSF-Stat 100 dict def % Dictionary with statistics ...
+/PSF-CurFont null def % No Any current font there
+
+/Create-Font-Stat-Pool
+{
+ 256 dict % Dictionary with charstrings ...
+} bind def
+
+/Use-Font % Select current font ...
+{
+% (Call Use-Font\n) print pstack
+ dup /FontType get 1 eq
+ {
+ % { dup /OrigFont known { /OrigFont get } { exit } ifelse } loop
+ % /FontName get % Name of original font there ...
+ /FontInfo get /FullName get cvn
+ dup PSF-Stat exch known
+ { PSF-Stat exch get }
+ { Create-Font-Stat-Pool PSF-Stat 2 index 2 index put exch pop }
+ ifelse
+ }
+ { % Don't try collect statistics for NOT Type1 fonts.
+ pop null % discard dictionary, and fill NONE font identifier ...
+ } ifelse
+ /PSF-CurFont exch usrdef
+% (End of Call Use-Font\n) print pstack
+} bind sysdef
+
+/Use-Character
+{
+ PSF-CurFont dup null eq
+ {
+ pop
+ (Calling font using routines (i.e. `show') before font selection\n) print
+ (Refer to character ) print (....) cvs print (\n) print
+ }
+ {
+ begin currentfont /Encoding get exch get 1 def end
+ } ifelse
+} bind sysdef
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Save original system command and redefine it by self hacks %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+/Native-show /show savdef
+/Native-charpath /charpath savdef
+/Native-widthshow /widthshow savdef
+/Native-awidthshow /awidthshow savdef
+/Native-ashow /ashow savdef
+/Native-setfont /setfont savdef
+/Native-showpage /showpage savdef
+/Native-findfont /findfont savdef
+
+% This important routine dump marking of the font preloading
+% and font full names ...
+
+/Can-not-find-font
+{
+ (Can not find font ) print
+ (...........................................) cvs print
+ (\n Process will be terminated in this reason...\n) print
+ psfsFile closefile
+ OUTFILE deletefile % File absence denotes some error...
+ quit
+} bind def
+
+%%% Load map of our ATM compatible Type1 fonts.
+%%% Load our map into separate dictionary (PSF-Fontmap)
+/PSF-Fontmap 512 dict def
+PSF-Fontmap begin
+ /; { def } bind def
+ (Fontmap.t1) findlibfile
+ {
+ closefile
+ run
+% exch pop .loadFontmap % It is run in GS2.61 and GS3.12
+ }
+ { pop
+ (I can not found Type 1 fonts specific map Fontmap.t1\n) print
+ (It is probabbly error, but I will continue...\n) print
+ }
+ ifelse
+ currentdict /; undef
+end
+
+%%% Load list of resident fonts now ....
+/ResidentFonts 100 dict def
+systemdict /RESIDENTFONTS known
+{ % load list of resident fonts
+ RESIDENTFONTS findlibfile
+ { % Load all described fonts...
+ { % Read line by line in loop
+ dup (....................................) readline not { pop exit } if
+ cvn ResidentFonts begin true def end
+ } loop
+ closefile
+ } if
+ pop
+} if
+
+% In this dictionary is stored already prepared fonts to
+% avoid recursion effects which is appeared in GS 3.12
+/findfontCalledOn 100 dict def
+
+/findfont
+{ findfontCalledOn 1 index known { Native-findfont } {
+ findfontCalledOn begin dup true def end
+ (/) psfsWrite dup (........................................) cvs psfsWrite
+ dup FontDirectory exch known
+ { % Font exists in DontDirectory, this means that it is already preloaded ...
+ ( true ) psfsWrite
+ Native-findfont
+ }
+ { % Font yet not loaded, There I will try to load it ...
+ ( false ) psfsWrite
+ dup ResidentFonts exch known
+ { Native-findfont }
+ {
+ dup PSF-Fontmap exch known
+ { dup PSF-Fontmap exch get findlibfile
+ {.loadfont pop} {Can-not-find-font} ifelse
+ }
+ {
+ dup Fontmap exch known
+ { dup Fontmap exch get findlibfile
+ {.loadfont pop} {Can-not-find-font} ifelse
+ }
+ { Can-not-find-font }
+ ifelse
+ }
+ ifelse
+ Native-findfont
+ }
+ ifelse
+ }
+ ifelse
+ dup /FontInfo get /FullName get
+ (\() psfsWrite psfsWrite (\) psfsAlias\n) psfsWrite
+} ifelse } bind sysdef % bind systemdict begin def end % sysdef
+
+/show
+{
+ PSF-CurFont null ne { dup { Use-Character } forall } if
+ Native-show
+} bind sysdef
+
+/charpath
+{
+ PSF-CurFont null ne { 1 index { Use-Character } forall } if
+ Native-charpath
+} bind sysdef
+
+/ashow % ax ay string ashow -
+{
+ PSF-CurFont null ne { dup { Use-Character } forall } if
+ Native-ashow
+} bind sysdef
+
+/awidthshow % cx cy char ax ay string awidthshow -
+{
+ PSF-CurFont null ne { dup { Use-Character } forall } if
+ Native-awidthshow
+} bind sysdef
+
+/widthshow % cx cy char string widthshow -
+{
+ PSF-CurFont null ne { dup { Use-Character } forall } if
+ Native-widthshow
+} bind sysdef
+
+/setfont
+{
+% (call setfont\n) print pstack
+ dup Use-Font
+ Native-setfont
+} bind sysdef
+
+/showpage
+{
+ Print-Stat
+ Native-showpage
+} bind sysdef
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Routines for output statistics ... %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+/Print-Stat
+{
+ PSF-Stat
+ {
+ % Prepare font name ...
+ (\() psfsWrite
+ exch (.........1.........2.........3.........4) cvs psfsWrite
+ (\) cvn [ ) psfsWrite
+ % Prepare statistics ...
+ { pop (/) psfsWrite (.............................) cvs psfsWrite } forall
+ (] psfsChars\n) psfsWrite
+ } forall
+} bind sysdef
+
+/Native-restore /restore load def
+/restore
+{
+ Print-Stat
+ Native-restore
+} bind sysdef
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% To avoid destruction our hacks Close up systemdict %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+systemdict readonly pop
+
+/psfsFile OUTFILE (w) file def
+/psfsWrite { dup print psfsFile exch writestring } bind sysdef
+
+%%% Now executes user file
+
+{ INFILE run } stopped
+{ % There is error, finish process with removing output file ...
+ psfsFile closefile
+ OUTFILE deletefile
+% handleerror % command run already calls this ...
+ quit
+} if
+
+% Load raw statistic file, that will remove duplicate refernces.
+
+/PSF-Loaded 100 dict def % List of loaded fonts ...
+/PSF-Alias 100 dict def
+/psfsChars
+{
+ PSF-Stat 2 index known not
+ { PSF-Stat 2 index 256 dict put } if
+ exch PSF-Stat exch get begin { 1 def } forall end
+} bind def
+/psfsAlias
+{
+ % Check, if alias yet not exists put it into dictionary ...
+ cvn dup PSF-Alias exch known not
+ {
+ PSF-Alias exch 3 index put
+ { % Mark this font as already loaded ...
+ dup PSF-Loaded exch true put
+ } if
+ pop
+ }
+ { pop pop pop }
+ ifelse
+} bind def
+
+ psfsFile closefile
+ (ReLoad file ... \n) print
+ OUTFILE run
+
+%
+% There are fonts which share CharaterStrings.
+% For example Univers & Univer-Oblique fonts.
+% In this reason Univers-Oblique font contains Univers font.
+% In this reason we have list of such fonts check that used both
+% and in this case redirect request from first font to second.
+% So, if PS files uses both Univers and Univers-Oblique fonts
+% all references to Univers font will be replaced by references
+% to Univers-Oblique.
+%
+% NOTE. There is list of fonts of the Univers family !
+% One, before installing this tool, must detect such fonts
+% and expand this list...
+% The most simplest method to detect such fonts is to call:
+% t1disasm font-file | grep FontName
+% So in case of normal font (Univers) you will see:
+% /FontName /Univers def
+% dup/FontName get exch definefont pop
+% but the same command for font Univers-Oblique will outputs:
+% /FontName /Univers-Oblique def
+% /FontName /Univers def
+% dup/FontName get exch definefont pop
+% dup/FontName get exch definefont pop
+% So, one can see that Univers-Oblique font contains Univers font.
+%
+/BiFontList 20 dict begin
+/Univers /Univers-Oblique def
+/Univers-Black /Univers-BlackOblique def
+/Univers-Bold /Univers-BoldOblique def
+/Univers-CondensedBold /Univers-CondensedBoldOblique def
+/Univers-CondensedLight /Univers-CondensedLightOblique def
+/Univers-Condensed /Univers-CondensedOblique def
+/Univers-Light /Univers-LightOblique def
+currentdict end def
+
+BiFontList
+{
+ PSF-Stat 1 index known 2 index PSF-Stat exch known and
+ { % Redirect first font references into second font
+ PSF-Stat exch get begin
+ dup PSF-Stat exch get { def } forall
+ end
+ PSF-Stat exch undef
+ }
+ { pop pop }
+ ifelse
+} forall
+
+% Write back prepared statistic ...
+
+ /psfsFile OUTFILE (w) file def
+ PSF-Loaded { ==only == } forall
+ PSF-Stat
+ {
+ % Prepare font name ...
+ exch PSF-Alias exch get
+ dup PSF-Loaded exch known not
+ 1 index ResidentFonts exch known not and
+ {
+ (.........1.........2.........3.........4) cvs psfsWrite
+ % Write list of used characters
+ { pop (/) psfsWrite (..........................) cvs psfsWrite } forall
+ (/\n) psfsWrite
+ }
+ { pop pop }
+ ifelse
+ } forall
+ psfsFile closefile
+ quit
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% End of file `psfstat.ps' %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
diff --git a/fonts/utilities/fontload/man/fload.1 b/fonts/utilities/fontload/man/fload.1
new file mode 100644
index 0000000000..22026fc6d1
--- /dev/null
+++ b/fonts/utilities/fontload/man/fload.1
@@ -0,0 +1,70 @@
+.TH fload 1.2 "11/28/94"
+.\" @(#) fload.1 1.2 21:06:00 11/28/94
+.SH NAME
+fload \- Type 1 font downloading utility.
+.SH SYNOPSIS
+.B fload [-p font-set] <source-PS-file> [<output-PS-file>]
+
+.SH DESCRIPTION
+.B Fload
+is C-shell script that
+parses (via GhostScript with
+.I psfstat.ps
+script) legal PostScript file, determines characters and fonts which
+are required but not preloaded into file and then loads required fonts
+.I partially
+(by using
+.I SubFont
+program). Source will be also copied into output streem.
+If name of output file is missed, script will write into standard output.
+So, anyone can print file by command:
+ fload foo.ps | lpr
+.SH OPTIONS
+.TP 12
+.B -p font-set
+This option selects font-set which is in your printer.
+In standard configuration, only two font sets are distributed:
+ Standard (default)
+ 35
+ However, adding of the new font sets is trivial procedure.
+In this reason
+.B fload
+called without parameters will shows list of available font sets.
+.SH REMARK
+To make partial font downloading procedure successfully
+fonts intended to be downloaded partially must not be included
+into <source-PS-file>.
+.SH ERRORS
+Several errors can accure in this process:
+ 1. Source file is absent.
+ 2. Can't write destination file(s)
+ 3. Invalid PostScript file or required font is not accessible.
+In this case one can examine
+.I *.flog
+file which contains protocol of the source parsing by GhostScript.
+.SH LIMITATIONS
+This software was tested with PS output of
+ the DVIPS program
+ the FrameBuilder (Unix)
+ MS Windows PostScript driver.
+
+There is no guarantee that any PostScript file will be processed successfully
+because of high flexibility of the PostScript language.
+
+This software was tested with several fonts and accounts such kinds of
+ATM compatible Type 1 fonts as hybrid fonts, Multiple master fonts
+and fonts with shareable set of the CharStrings.
+However, every new font must be tested that it will be correctly downloaded
+partially. Note, that Multiple master fonts can be downloaded correctly only
+with GhostScript version 3.12 and higher.
+However, this version have a lot of bugs
+that result in crashing of GS interpreter.
+.SH "SEE ALSO"
+.LP
+.BR SubFont (1),
+.LP
+.I "Adobe Type 1 Font Format"
+.SH BUGS
+None known.
+.SH AUTHOR
+Basil K. Malyshev (malyshev@mx.ihep.su)
diff --git a/fonts/utilities/fontload/man/subfont.1 b/fonts/utilities/fontload/man/subfont.1
new file mode 100644
index 0000000000..db7db9ad53
--- /dev/null
+++ b/fonts/utilities/fontload/man/subfont.1
@@ -0,0 +1,175 @@
+.TH SubFont 1.2 "11/28/94"
+.\" @(#) SubFont.1 1.2 21:06:00 11/28/94
+.SH NAME
+SubFont \- Makes type 1 font from a characters of other font
+.SH SYNOPSIS
+.B subfont
+<
+.B Command list
+>
+.SH DESCRIPTION
+.B SubFont
+parses Adobe type-1 font programs
+(in PFA (hexadecimal) or PFB (binary) formats),
+extracts specified characters and write out font which contains only
+specified characters. When this program works with single font it
+writes out font in PFA or PFB ATM compatible font formats.
+When the program works in multifont mode
+(which is automatically switched on by option
+.I -f
+) that writes fonts in such format that can be loaded only
+by complete PS interpreter.
+In multifont mode, fonts with the same encoding share one
+encoding vector,
+.I eexec
+PS operator is not used in output stream and other
+optimizations were done.
+
+.SH Commands
+
+.TP 12
+.B -v
+This option tell program to output more information about font parsing stadies.
+.TP
+.B -o<file>
+By default, program outputs into stdout.
+One can redirect output via redirection facility.
+Also one can redirect output by this option.
+.TP
+.B -a<file>
+It works like
+.I -o
+option but opens file in append mode.
+It is usefull when addition of some prolog is required.
+.TP
+.B -b<file>
+The same as
+.I -o
+option but force output in binary mode.
+So, program will be write PFB-font format.
+Note that this option contradicts with multifont preparation,
+and in attempt of loading second font process will be canceled.
+.TP
+.B -c<file>
+Copying specified file to output as is. This option is strange in
+UNIX environment but is very usefull in VMS environment.
+.TP
+.B -n/../../
+This option defines characters required to download from next font.
+Note, if this option is missed, program will loads all characters.
+In this case only convertion from
+.I PFB
+format to
+.I PFA
+format and back will be done.
+.TP
+.B <file>
+Process font from file.
+.TP
+.B -
+Process font from stdin.
+.TP
+.B -f<file>
+Reads list of required fonts and characters from
+.I file
+and process every font. This option turns on
+.I multifont
+mode in which fonts with the same encoding will share one
+encoding vector,
+.I eexec
+PS operator will not be used in output stream
+and other optimizations will be done.
+
+Every line of this file must containes specification:
+
+font-name/char-1/char-2/.../char.../
+.TP
+.B -m<map-file>
+defines file with mapping of font names (used in file processed by
+.I -f
+option) to file names.
+Every line of map-file maps font to file like to:
+
+ Times-Romat tir____.pfb
+ Times-Bold tib____.pfb
+.TP
+.B -I<path>
+Font search path, which is used for searching font files (used with
+.I -f
+option).
+.TP
+.B -u<file>
+File for put list of undefined fonts (used with -f option).
+This file will be created only in case if unknown fonts exist.
+.TP
+.B -e\#
+Touch encoding flag.
+In multifont mode the same font encoding verctors is loaded only once.
+To make so, every encoding vector loaded out of font body
+and have uniqual name. Every font will only refer
+into already loaded encoding verctor. To suppress this
+feature one can use option
+.B -e-1
+When program prepares several files without
+.I \-f
+option
+but using
+.I \-n
+option and
+.I <file>,
+encoding vector will be loaded as is.
+To force removing the same encodings one can say
+.B -e1.
+.TP
+.B -x\#
+eexec applying flag.
+In multifont mode fonts will be outputted without
+.I eexec
+instruction.
+This feature make output file smaller.
+To suppress this feature in multifont mode one can use option
+.B -x2
+When program prepares several files without
+.I \-f
+option
+but using
+.I \-n
+option and
+.I <file>,
+eexec will be applied.
+To remove eexec, in this case, one can use
+.B -x0.
+.TP
+.B -z <file1> ...
+In this case program will be read every file from list,
+search line with pattern:
+
+.B /FontName /<font-name> def
+
+and output line like
+
+.B /<fontname> (<file-name>) ;
+
+This facility is usefull for making font map file.
+.SH EXAMPLES
+.LP
+.nf
+To make font with characters 'B', 'K' and 'M' from Times-Roman font:
+
+.B subfont -o BKM.pfa -n/B/K/M/ Times-Roman.pfa
+
+The same but output will be in PFB format:
+
+.B subfont -b BKM.pfb -n/B/K/M/ Times-Roman.pfa
+
+.ft R
+.fi
+.SH "SEE ALSO"
+.LP
+.BR fload (1),
+.LP
+.I "Adobe Type 1 Font Format"
+.SH BUGS
+None known.
+.SH AUTHOR
+Basil K. Malyshev (malyshev@mx.ihep.su)
diff --git a/fonts/utilities/fontload/src/Makefile b/fonts/utilities/fontload/src/Makefile
new file mode 100644
index 0000000000..49551cde78
--- /dev/null
+++ b/fonts/utilities/fontload/src/Makefile
@@ -0,0 +1,21 @@
+# Makefile for subfont program
+
+BINDIR=$(HOME)/bin
+MANDIR=$(HOME)/man/man1
+
+# ANSI C --- can use gcc too
+CC=gcc
+CFLAGS=-O
+
+all: subfont
+
+subfont: subfont.o
+ $(CC) -o subfont subfont.o
+
+install: all
+ install -cs subfont $(BINDIR)
+ cp subfont.1 $(MANDIR)
+
+clean:
+ rm -f *.o *~ *.bak core a.out subfont
+
diff --git a/fonts/utilities/fontload/src/fstat.c b/fonts/utilities/fontload/src/fstat.c
new file mode 100644
index 0000000000..36fca11030
--- /dev/null
+++ b/fonts/utilities/fontload/src/fstat.c
@@ -0,0 +1,17 @@
+# include <stdio.h>
+
+int main()
+{
+ static char buf[4096];
+
+ while ( fgets(buf,sizeof(buf),stdin) != NULL )
+ {
+ int cnt;
+ char *cp;
+ for( cp = buf; *cp && *cp != '/' ; cp++ );
+ *cp++ = 0;
+ for( cnt = 0; *cp ; cp++ ) if ( *cp == '/' ) cnt++;
+ printf("%s & %d\\cr\n",buf,cnt);
+ }
+ return 0;
+}
diff --git a/fonts/utilities/fontload/src/subfont.c b/fonts/utilities/fontload/src/subfont.c
new file mode 100644
index 0000000000..5c24016d5f
--- /dev/null
+++ b/fonts/utilities/fontload/src/subfont.c
@@ -0,0 +1,1860 @@
+/* SubFont
+**
+** This program makes new subfont which contains only selected characters.
+** The program was started 27-Oct-1994 and began from source codes of the
+** t1disasm and t1asm programs whose wroten by I. Lee Hetherington
+** (ilh@lcs.mit.edu).
+**
+** Copyright (C) 1994, 1995, Basil K. Malyshev. All Rights Reserved.
+**
+** LIMITATIONS:
+** This program can prepare only ATM compatible PS Type 1 fonts.
+** In this reason you must download other type fonts avoiding this program.
+**
+** The reasons and applications of this program:
+** 1. Some expert fonts have a lot of characters. For example EC/DC
+** fonts are designed to cover most of european languages.
+** However in each european language only few accented characters
+** is used. This program can be used to make own smaller font
+** which will be enought for typesetting in your language.
+** 2. Together with psfstat.ps program distributed with this program
+** you can organize partial font downloading.
+** 3. Using this module as part of DVIPS program partial font
+** downloading can be done faster.
+**
+** History:
+** 27-Oct-94 Beginning ...
+** 1-Nov-94 V1.0 First completly workable version.
+** Works together with fload C-shell script which calls
+** GhostScript with 'psfstat.ps' macroses to make
+** map of required charactrs.
+** 3-Nov-94 V1.1 Now can prepare fonts with non standard layout
+** that have 'noaccess put' instead of '|' or 'NP'.
+** Now can process HYBRID fonts which have two versions
+** of the 'Subrs' for High and low resolution devices.
+** That is many Oblique fonts (Univers, Helvetica, ...)
+** 24-Nov-94 Uploaded to CTAN:fonts/utilities/fontload.
+** 25-Nov-94 Fixed for VMS.
+** 27-Nov-94 Add ability for the output without eexec that reduces
+** size of output file and accelerates downloading process
+** but not reduces required printer memory.
+** 28-Nov-94 optimize Subrs construction, which slightly reduces
+** memory requirements.
+** Remove warning on unknown_15 code which is not documented
+** by Adobe but used in blank characters.
+** Enclose every font into mark ... cleartoark if
+** Eexec_Output flag is off.
+** 30-Nov-94 V1.2 Ported to MS-DOS, compiled by
+** Microsoft (R) C/C++ Optimizing Compiler Version 8.0
+** 19-Dec-94 V1.3 Now can read font map in GhostScript format.
+** So, SubFont and GhostScript can share the same font map.
+** 7-Jan-95 V1.4 Fixed dcr10 encoding size problem.
+**
+******* Also, copyright of the t1asm and t1disasm programs is there: ********
+**
+** Copyright (c) 1992 by I. Lee Hetherington, all rights reserved.
+**
+** Permission is hereby granted to use, modify, and distribute this program
+** for any purpose provided this copyright notice and the one below remain
+** intact.
+**
+** author of the t1asm and t1disasm programs:
+** I. Lee Hetherington (ilh@lcs.mit.edu)
+*/
+
+# define PROGRAM "SubFont"
+# define PROBLEM "BKM Type1 SubFont Extractor"
+# define VERSION "1.4"
+# define REVDATE "7-Jan-1995"
+# define AUTHOR "Basil K.Malyshev (Vassili Malychev)"
+# define COPYRIGHT "1994, 1995, Basil K. Malyshev."
+
+# include <stdio.h>
+# include <stdlib.h>
+# include <string.h>
+# include <ctype.h>
+
+# ifdef MSDOS
+# define SMALL_MEMORY
+# define SYSID "MS-DOS"
+# define PATH_DELIMITER ';'
+# define FILE_DELIMITER '\\'
+# define DEFAULTFONTPATH ".;C:\\PSFONTS;C:\\GS;C:\\GS\\FONTS"
+# define RB "rb"
+# define WB "wb"
+# endif
+
+# ifdef vms
+# define SYSID "VMS"
+# define PATH_DELIMITER ','
+# define FILE_DELIMITER 0
+# define DEFAULTFONTPATH "SYS$DISK:[],Type1_Fonts:,GS_LIB:"
+# define RB "rb"
+# define WB "wb"
+# endif
+
+# ifdef unix
+# define SYSID "UNIX"
+# define PATH_DELIMITER ':'
+# define FILE_DELIMITER '/'
+# define DEFAULTFONTPATH ".:/usr/local/lib/Fonts"
+# define RB "r"
+# define WB "w"
+# endif
+
+# ifndef SYSID
+# define SMALL_MEMORY
+# define SYSID "(Assumed MS-DOS)"
+# define PATH_DELIMITER ';'
+# define FILE_DELIMITER '\\'
+# define DEFAULTFONTPATH ".;C:\\PSFONTS;C:\\GS;C:\\GS\\FONTS"
+# define RB "rb"
+# define WB "wb"
+# endif
+
+#define LINESIZE 4096 /* 256 */
+
+typedef unsigned char byte;
+
+static int Verbose = 0;
+static int Trace = 0;
+static int ArrLosts = 0;
+static int TouchEncoding = 0;
+static int Eexec_Output = 1;
+
+static FILE *ifp /*VMS: = stdin */ ;
+static FILE *ofp /*VMS: = stdout */;
+static FILE *ufp = NULL;
+static char *uFileName = NULL;
+static char line[LINESIZE];
+static int lenIV = 4;
+
+static char RD_String[] = "RD";
+static char ND_String[] = "noaccess def";
+static char NP_String[] = "noaccess put";
+
+static struct { int code; char *name; } StdEnc[] = {
+ 040 , "space",
+ 041 , "exclam",
+ 042 , "quotedbl",
+ 043 , "numbersign",
+ 044 , "dollar",
+ 045 , "percent",
+ 046 , "ampersand",
+ 047 , "quoteright",
+ 050 , "parenleft",
+ 051 , "parenright",
+ 052 , "asterisk",
+ 053 , "plus",
+ 054 , "comma",
+ 055 , "hyphen",
+ 056 , "period",
+ 057 , "slash",
+ 060 , "zero",
+ 061 , "one",
+ 062 , "two",
+ 063 , "three",
+ 064 , "four",
+ 065 , "five",
+ 066 , "six",
+ 067 , "seven",
+ 070 , "eight",
+ 071 , "nine",
+ 072 , "colon",
+ 073 , "semicolon",
+ 074 , "less",
+ 075 , "equal",
+ 076 , "greater",
+ 077 , "question",
+ 0100 , "at",
+ 0101 , "A",
+ 0102 , "B",
+ 0103 , "C",
+ 0104 , "D",
+ 0105 , "E",
+ 0106 , "F",
+ 0107 , "G",
+ 0110 , "H",
+ 0111 , "I",
+ 0112 , "J",
+ 0113 , "K",
+ 0114 , "L",
+ 0115 , "M",
+ 0116 , "N",
+ 0117 , "O",
+ 0120 , "P",
+ 0121 , "Q",
+ 0122 , "R",
+ 0123 , "S",
+ 0124 , "T",
+ 0125 , "U",
+ 0126 , "V",
+ 0127 , "W",
+ 0130 , "X",
+ 0131 , "Y",
+ 0132 , "Z",
+ 0133 , "bracketleft",
+ 0134 , "backslash",
+ 0135 , "bracketright",
+ 0136 , "asciicircum",
+ 0137 , "underscore",
+ 0140 , "quoteleft",
+ 0141 , "a",
+ 0142 , "b",
+ 0143 , "c",
+ 0144 , "d",
+ 0145 , "e",
+ 0146 , "f",
+ 0147 , "g",
+ 0150 , "h",
+ 0151 , "i",
+ 0152 , "j",
+ 0153 , "k",
+ 0154 , "l",
+ 0155 , "m",
+ 0156 , "n",
+ 0157 , "o",
+ 0160 , "p",
+ 0161 , "q",
+ 0162 , "r",
+ 0163 , "s",
+ 0164 , "t",
+ 0165 , "u",
+ 0166 , "v",
+ 0167 , "w",
+ 0170 , "x",
+ 0171 , "y",
+ 0172 , "z",
+ 0173 , "braceleft",
+ 0174 , "bar",
+ 0175 , "braceright",
+ 0176 , "asciitilde",
+ 0241 , "exclamdown",
+ 0242 , "cent",
+ 0243 , "sterling",
+ 0244 , "fraction",
+ 0245 , "yen",
+ 0246 , "florin",
+ 0247 , "section",
+ 0250 , "currency",
+ 0251 , "quotesingle",
+ 0252 , "quotedblleft",
+ 0253 , "guillemotleft",
+ 0254 , "guilsinglleft",
+ 0255 , "guilsinglright",
+ 0256 , "fi",
+ 0257 , "fl",
+ 0261 , "endash",
+ 0262 , "dagger",
+ 0263 , "daggerdbl",
+ 0264 , "periodcentered",
+ 0266 , "paragraph",
+ 0267 , "bullet",
+ 0270 , "quotesinglbase",
+ 0271 , "quotedblbase",
+ 0272 , "quotedblright",
+ 0273 , "guillemotright",
+ 0274 , "ellipsis",
+ 0275 , "perthousand",
+ 0277 , "questiondown",
+ 0301 , "grave",
+ 0302 , "acute",
+ 0303 , "circumflex",
+ 0304 , "tilde",
+ 0305 , "macron",
+ 0306 , "breve",
+ 0307 , "dotaccent",
+ 0310 , "dieresis",
+ 0312 , "ring",
+ 0313 , "cedilla",
+ 0315 , "hungarumlaut",
+ 0316 , "ogonek",
+ 0317 , "caron",
+ 0320 , "emdash",
+ 0341 , "AE",
+ 0343 , "ordfeminine",
+ 0350 , "Lslash",
+ 0351 , "Oslash",
+ 0352 , "OE",
+ 0353 , "ordmasculine",
+ 0361 , "ae",
+ 0365 , "dotlessi",
+ 0370 , "lslash",
+ 0371 , "oslash",
+ 0372 , "oe",
+ 0373 , "germandbls",
+ 0, 0
+};
+
+static char *StandardEncoding[256];
+
+void init_Encoding(void)
+{
+ int i;
+ for( i = 0 ; i < 256 ; i++ )
+ StandardEncoding[i] = NULL;
+
+ for( i = 0 ; StdEnc[i].name != NULL ; i++ )
+ StandardEncoding[StdEnc[i].code] = StdEnc[i].name ;
+}
+
+static int Files = 0; /* Number of processed fonts */
+
+void *xmalloc( int Size )
+{
+ void *ptr;
+
+ if ( (ptr=malloc( Size )) == NULL )
+ {
+ fprintf(stderr,"? SubFont: Not enought memory(needed %d bytes)\n",Size);
+ exit(1);
+ }
+ return ptr;
+}
+
+char *xstrdup( char *str )
+{
+ char *ptr;
+ ptr = xmalloc( strlen(str) + 1 );
+ strcpy(ptr,str);
+ return ptr;
+}
+
+# define CHUNK_SIZE 128
+struct ChunkSt
+ { struct ChunkSt *next; void *ptr[CHUNK_SIZE]; }
+ *currChunk = NULL, *next;
+static int currPtr = CHUNK_SIZE;
+
+void *fmalloc( int Size , char *tag )
+{
+ void *ptr;
+
+ if ( (ptr=malloc( Size )) == NULL )
+ {
+ fprintf(stderr,"? SubFont: Not enought memory for %s(needed %d bytes)\n",
+ tag,Size);
+ exit(1);
+ }
+ if ( currPtr >= CHUNK_SIZE )
+ {
+ next = xmalloc( sizeof(struct ChunkSt) );
+ next->next = currChunk;
+ currChunk = next;
+ currPtr = 0;
+ }
+ currChunk->ptr[currPtr++] = ptr;
+ return ptr;
+}
+
+void fAllFree( void )
+/* Freeing all memory which was allocated by fmalloc */
+{
+ int j;
+ long l;
+ for( l = 0; currChunk != NULL; currChunk = next )
+ {
+ next = currChunk->next;
+ for( j = 0 ; j < currPtr ; j++,l++ ) free(currChunk->ptr[j]);
+ free(currChunk);
+ currPtr = CHUNK_SIZE;
+ }
+ if ( Verbose ) fprintf(stderr,"fAllFree(): Freeing %d memory blocks\n",l);
+}
+
+/* decryption stuff */
+static unsigned short er, oer, cr;
+static unsigned short c1 = 52845, c2 = 22719;
+
+/* This function looks for `currentfile eexec' string and returns 1 once found.
+ If c == 0, then simply check the status. */
+
+static char *p_eexec_scan = 0;
+
+static int eexec_scanner( int /*char*/ c)
+{
+ static char *key = "currentfile eexec\n";
+
+ if (!p_eexec_scan)
+ p_eexec_scan = key;
+
+ if (c && *p_eexec_scan) {
+ if (c == *p_eexec_scan)
+ ++p_eexec_scan;
+ else
+ p_eexec_scan = key;
+ }
+ return *p_eexec_scan == '\0';
+}
+
+/* This function returns the value of a single hex digit. */
+
+static int hexval(char c)
+{
+ if (c >= 'A' && c <= 'F')
+ return c - 'A' + 10;
+ else if (c >= 'a' && c <= 'f')
+ return c - 'a' + 10;
+ else if (c >= '0' && c <= '9')
+ return c - '0';
+ else
+ return 0;
+}
+
+/* This function returns a single character at a time from a PFA or PFB file.
+ This stream is mixed ASCII and binary bytes. For PFB files, the section
+ headers are removed, and \r is replaced by \n in ASCII sections. For PFA
+ files, the hexdecimal data is turned into binary bytes. */
+
+ static int first_byte = 1;
+ static int is_pfa = 0;
+ static int is_pfb = 0;
+ static long pfb_remaining = 0;
+
+static int bgetc()
+{
+ int c, val;
+
+ /* is_pfa == 1 means PFA initial ASCII section
+ is_pfa == 2 means PFA hexadecimal section
+ is_pfb == 1 means PFB ASCII section
+ is_pfB == 2 means PFB binary section */
+
+ c = fgetc(ifp);
+
+ if (c == EOF)
+ return EOF;
+
+ if (first_byte) {
+ /* Determine if this is a PFA or PFB file by looking at first byte. */
+ if (c == 0x80) {
+ is_pfb = 1;
+ is_pfa = 0;
+ } else {
+ is_pfb = 0;
+ is_pfa = 1;
+ }
+ first_byte = 0;
+ }
+
+ if (is_pfb) {
+ /* PFB */
+ if (pfb_remaining == 0) {
+ /* beginning of block---we know c == 0x80 at this point */
+ switch (fgetc(ifp)) {
+ case 1:
+ is_pfb = 1;
+ break;
+ case 2:
+ is_pfb = 2;
+ break;
+ case 3:
+ return EOF;
+ default:
+ fprintf(stderr, "error: is this really a PFB file?\n");
+ exit(1);
+ }
+ /* get block length */
+ pfb_remaining = (long)fgetc(ifp) & 0xff;
+ pfb_remaining |= ((long)fgetc(ifp) & 0xff) << 8;
+ pfb_remaining |= ((long)fgetc(ifp) & 0xff) << 16;
+ pfb_remaining |= ((long)fgetc(ifp) & 0xff) << 24;
+ /* get character */
+ c = fgetc(ifp);
+ if (c == EOF)
+ return EOF;
+ }
+ --pfb_remaining;
+ /* in ASCII section change return to newline */
+ if (is_pfb == 1 && c == '\r')
+ c = '\n';
+ (void)eexec_scanner(c);
+ return c;
+ } else {
+ /* PFA */
+ if (is_pfa == 1) {
+ /* in initial ASCII */
+ if (eexec_scanner(c))
+ is_pfa = 2;
+ return c;
+ } else {
+ /* in hexadecimal */
+ while (isspace(c))
+ c = fgetc(ifp);
+ val = hexval((char)c) << 4;
+ val |= hexval((char)(c = fgetc(ifp)));
+ if (c == EOF)
+ return EOF;
+ return val;
+ }
+ }
+}
+
+/* Two separate decryption functions because eexec and charstring decryption
+ must proceed in parallel. */
+
+static byte edecrypt(int /*byte */ cipher)
+{
+ byte plain;
+
+ plain = (byte)(cipher ^ (er >> 8));
+ er = (cipher + er) * c1 + c2;
+ return plain;
+}
+
+static byte cdecrypt( int /*byte*/ cipher)
+{
+ byte plain;
+
+ plain = (byte)(cipher ^ (cr >> 8));
+ cr = (cipher + cr) * c1 + c2;
+ return plain;
+}
+
+/* This function returns 1 the first time the eexec_scanner returns 1. */
+
+ static int reported = 0;
+static int immediate_eexec()
+{
+
+ if (!reported && eexec_scanner(0)) {
+ reported = 1;
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+/* This function returns a single byte at a time through (possible) eexec
+ decryption. When immediate_eexec returns 1 it fires up the eexec decryption
+ machinery. */
+
+ static int in_eexec = 0, out_eexec = 0;
+static int egetc()
+{
+ int c,j;
+
+ if ((c = bgetc()) == EOF)
+ return EOF;
+
+ if (!in_eexec) {
+ if (immediate_eexec()) {
+ /* start eexec decryption */
+ in_eexec = 1;
+ er = 55665;
+ /* toss out four random bytes */
+ for( j = 4 ; j > 0 ; j-- )
+ (void) edecrypt(bgetc());
+ }
+ return c;
+ } else {
+ return edecrypt(c);
+ }
+}
+
+/* This function returns a line of eexec decrypted characters. A line is
+ terminated by length (including terminating null) greater than LINESIZE, a
+ newline \n, or one of the special charstring start sequences ` -| ' or
+ ` RD '. The line, including the terminating newline or charstring start
+ sequence is put into line[]. If terminated by a charstring start sequence,
+ the flag start_charstring is set to 1. */
+
+static int egetline()
+{
+ int c,cnt,cntcont;
+ char *p = line;
+
+ cnt = 0; cntcont = 0;
+ while (p < line + LINESIZE) {
+ c = egetc();
+ if (c == EOF)
+ break;
+ if ( '0' <= c && c <= '9' )
+ { cnt = ( cntcont ? cnt * 10 : 0 ) + c - '0' ; cntcont = 1; }
+ else
+ cntcont = 0;
+ *p++ = (char) c;
+ if (p >= line + 4 && (strncmp(p - 4, " -| ", 4) == 0 ||
+ strncmp(p - 4, " RD ", 4) == 0)) {
+ for( ; cnt >= 0 ; cnt-- ) *p++ = (char)egetc(); /* load char string */
+ }
+ if (c == '\r') { /* map \r to \n */
+ p[-1] = '\n';
+ break;
+ }
+ if (c == '\n')
+ break;
+ }
+ *p = '\0';
+ return (int)(p-line);
+}
+
+/* If the line contains an entry of the form `/lenIV <num>' then set the global
+ lenIV to <num>. This indicates the number of random bytes at the beginning
+ of each charstring. */
+
+static void set_lenIV()
+{
+ char *p = strstr(line, "/lenIV ");
+
+ if (p && isdigit(p[7])) {
+ lenIV = atoi(p + 7);
+ }
+}
+
+/* Subroutine to output strings. */
+
+# define MAXPOOL 8192
+static char *pool[MAXPOOL];
+static int pool_cnt = 0;
+
+static void output(char *string)
+{
+ if ( pool_cnt >= MAXPOOL )
+ { fprintf(stderr,"Not enought pool size...\n"); exit(1); }
+ pool[pool_cnt] = fmalloc( strlen(string) + 1 , "output buffer line" );
+ strcpy(pool[pool_cnt],string);
+ pool_cnt++;
+}
+
+/************************** Output routines .... ************************/
+# define SMALL_MEMORY
+
+#ifdef SMALL_MEMORY
+#define MAXBLOCKLEN 32000
+#else
+#define MAXBLOCKLEN ((1<<17)-6)
+#endif
+
+#define MINBLOCKLEN ((1<<8)-6)
+
+#define MARKER 128
+#define ASCII 1
+#define BINARY 2
+#define DONE 3
+
+/* flags */
+static int pfb = 0;
+static int active = 0;
+/* static int in_eexec = 0; File firstly loaded and then dumped ... */
+
+/* for PFB block buffering */
+static byte blockbuf[MAXBLOCKLEN];
+static int blocklen = MAXBLOCKLEN;
+static int blockpos = -1;
+static int blocktyp = ASCII;
+
+static byte eencrypt( byte plain)
+{
+ byte cipher;
+
+ cipher = (byte)(plain ^ (oer >> 8));
+ oer = (cipher + oer) * c1 + c2;
+ return cipher;
+}
+
+/* This function flushes a buffered PFB block. */
+
+static void output_block()
+{
+ int i;
+
+ /* output four-byte block length */
+ fputc(blockpos & 0xff, ofp);
+ fputc((blockpos >> 8) & 0xff, ofp);
+ fputc((blockpos >> 16) & 0xff, ofp);
+ fputc((blockpos >> 24) & 0xff, ofp);
+
+ /* output block data */
+ for (i = 0; i < blockpos; i++)
+ fputc(blockbuf[i], ofp);
+
+ /* mark block buffer empty and uninitialized */
+ blockpos = -1;
+}
+
+/* This function outputs a single byte. If output is in PFB format then output
+ is buffered through blockbuf[]. If output is in PFA format, then output
+ will be hexadecimal if in_eexec is set, ASCII otherwise. */
+
+static int hexcol = 0 ;
+static void output_byte(byte b)
+{
+ static char *hexchar = "0123456789ABCDEF";
+
+ if (pfb) {
+ /* PFB */
+ if (blockpos < 0) {
+ fputc(MARKER, ofp);
+ fputc(blocktyp, ofp);
+ blockpos = 0;
+ }
+ blockbuf[blockpos++] = b;
+ if (blockpos == blocklen)
+ output_block();
+ } else {
+ /* PFA */
+ if (out_eexec) {
+ /* trim hexadecimal lines to 64 columns */
+ if (hexcol >= 64) {
+ fputc('\n', ofp);
+ hexcol = 0;
+ }
+ fputc(hexchar[(b >> 4) & 0xf], ofp);
+ fputc(hexchar[b & 0xf], ofp);
+ hexcol += 2;
+ } else {
+ fputc(b, ofp);
+ }
+ }
+}
+
+/* This function outputs a byte through possible eexec encryption. */
+
+static void eexec_byte(byte b)
+{
+ if (out_eexec)
+ output_byte(eencrypt(b));
+ else
+ output_byte(b);
+}
+
+/* This function outputs a null-terminated string through possible eexec
+ encryption. */
+
+static void eexec_string(char *string)
+{
+ while (*string)
+ eexec_byte((byte) *string++);
+}
+
+/* This function gets ready for the eexec-encrypted data. If output is in
+ PFB format then flush current ASCII block and get ready for binary block.
+ We start encryption with four random (zero) bytes. */
+
+static void eexec_start()
+{
+ if (pfb) {
+ output_block();
+ blocktyp = BINARY;
+ }
+
+ out_eexec = 1;
+ oer = 55665;
+ eexec_byte('B');
+ eexec_byte('K');
+ eexec_byte('M');
+ eexec_byte('!');
+}
+
+/* This function wraps-up the eexec-encrypted data and writes ASCII trailer.
+ If output is in PFB format then this entails flushing binary block and
+ starting an ASCII block. */
+
+static void eexec_end()
+{
+ int i, j;
+
+ if (pfb) {
+ output_block();
+ blocktyp = ASCII;
+ } else {
+ fputc('\n', ofp);
+ }
+ out_eexec = 0;
+ for (i = 0; i < 8; i++) {
+ for (j = 0; j < 64; j++)
+ eexec_byte('0');
+ eexec_byte('\n');
+ }
+ eexec_string("cleartomark\n");
+ if (pfb) {
+ output_block();
+ fputc(MARKER, ofp);
+ fputc(DONE, ofp);
+ }
+}
+
+static void Dump_Pool( int from , int to )
+{
+ int i;
+ for ( i = from ; i < to ; i++ )
+ {
+ if ( Eexec_Output )
+ {
+ eexec_string(pool[i]);
+ if ( strcmp(pool[i], "currentfile eexec\n") == 0 ) eexec_start();
+ }
+ else
+ {
+ if ( i == 0 )
+ eexec_string("mark %%\n");
+ if( strcmp(pool[i], "mark currentfile closefile\n") == 0 )
+ eexec_string("end cleartomark%%\n");
+ else if ( strcmp(pool[i], "currentfile eexec\n") == 0 )
+ eexec_string("systemdict begin\n");
+ else
+ eexec_string(pool[i]);
+ }
+ }
+}
+
+static void Dump_CS( int Len , unsigned char *cs )
+{
+ if ( Eexec_Output )
+ {
+ char buf[64];
+ sprintf(buf," %d %s ", Len, RD_String);
+ eexec_string(buf);
+ for( ; Len > 0 ; Len--, cs++) eexec_byte(*cs);
+ eexec_byte(' ');
+ }
+ else
+ {
+ int c;
+ eexec_string("\n<");
+ for( c = 2 ; Len > 0 ; Len--, cs++, c += 2)
+ {
+ eexec_byte("0123456789ABCDEF"[((*cs)>>4)&0xF]);
+ eexec_byte("0123456789ABCDEF"[(*cs)&0xF]);
+ if ( c > 70 ) { eexec_byte('\n'); c = 0; }
+ }
+ eexec_string("> ");
+ }
+}
+
+int Subrs = 0;
+int MaxSubrs = 0;
+int SubrsPosition = 0;
+int HiSubrs = 0;
+int HiMaxSubrs = 0;
+int HiSubrsPosition = 0;
+typedef struct {
+ unsigned char *cs;
+ int len;
+ int use; /* Using marker ... */
+ } CSType;
+CSType *Subr, *HiSubr;
+
+int CharStrings = 0;
+int CharStringsPosition = 0;
+struct {
+ char *Name;
+ unsigned char *cs;
+ int len;
+ int use; /* Using marker */
+ } *CharString;
+int CharStringCnt = 0;
+
+static int sp, stack[128];
+static int cop, vop[32];
+void ProcessCharString( unsigned char *cs , int len )
+{
+ int p, i, b, val;
+ unsigned short cr_save ;
+
+ cr_save = cr;
+
+ cr = 4330;
+ for (p = 0; p < len && p < lenIV; p++ )
+ cdecrypt(cs[p]);
+
+ while ( p < len )
+ {
+ b = cdecrypt(cs[p++]);
+ if (b >= 32) {
+ if (b >= 32 && b <= 246)
+ val = b - 139;
+ else if (b >= 247 && b <= 250)
+ val = (b - 247)*256 + 108 + cdecrypt(cs[p++]);
+ else if (b >= 251 && b <= 254)
+ val = -(b - 251)*256 - 108 - cdecrypt(cs[p++]);
+ else if (b == 255) {
+ val = (cdecrypt(cs[p++]) & 0xff) << 24;
+ val |= (cdecrypt(cs[p++]) & 0xff) << 16;
+ val |= (cdecrypt(cs[p++]) & 0xff) << 8;
+ val |= (cdecrypt(cs[p++]) & 0xff) << 0;
+ /* in case an int is larger than four bytes---sign extend */
+ if (sizeof(int) > 4 && val & (1U << 31))
+ for (i = 4; i < sizeof(int); i++)
+ val |= 0xff << (i * 8);
+ }
+ stack[sp++] = val;
+ } else {
+ if ( Trace ) fprintf(stderr,"[%d]",b);
+ switch (b) {
+ case 1: sp = 0; /* ("hstem"); */ break;
+ case 3: sp = 0; /* ("vstem"); */ break;
+ case 4: sp = 0; /* ("vmoveto"); */ break;
+ case 5: sp = 0; /* ("rlineto"); */ break;
+ case 6: sp = 0; /* ("hlineto"); */ break;
+ case 7: sp = 0; /* ("vlineto"); */ break;
+ case 8: sp = 0; /* ("rrcurveto"); */ break;
+ case 9: sp = 0; /* ("closepath"); */ break;
+ case 10: /* ("callsubr"); */
+ val = stack[--sp];
+ if ( ! ( 0 <= val && val < MaxSubrs ) )
+ {
+ fprintf(stderr,"Illegal call of unexistant subroutine %d\n",val);
+ exit(1);
+ }
+ if ( Trace ) fprintf(stderr,"{%d:",val);
+ /* if ( ! Subr[val].use ) */
+ { /* Process it, if yet not processed ... */
+ CSType *SvSubr;
+ SvSubr = HiSubr; HiSubr = NULL;
+ Subr[val].use = 1;
+ ProcessCharString( Subr[val].cs , Subr[val].len );
+ HiSubr = SvSubr;
+ }
+ if ( HiSubr != NULL )
+ { /* Process it, if yet not processed ... */
+ CSType *SvSubr;
+ SvSubr = Subr; Subr = HiSubr; HiSubr = NULL;
+ Subr[val].use = 1;
+ ProcessCharString( Subr[val].cs , Subr[val].len );
+ HiSubr = Subr; Subr = SvSubr;
+ }
+ if ( Trace ) fprintf(stderr,"}");
+ break;
+ case 11: /* ("return"); */
+ cr = cr_save;
+ return;
+ case 13: sp = 0; /* ("hsbw"); */ break;
+ case 14: sp = 0; /* ("endchar"); */ break;
+ case 15: sp = 0; /* Undocumented code but used in blank characters */
+ break;
+ case 21: sp = 0; /* ("rmoveto"); */ break;
+ case 22: sp = 0; /* ("hmoveto"); */ break;
+ case 30: sp = 0; /* ("vhcurveto"); */ break;
+ case 31: sp = 0; /* ("hvcurveto"); */ break;
+ case 12:
+ b = cdecrypt(cs[p++]) ;
+ if ( Trace ) fprintf(stderr,"[%d]",b);
+ switch (b) {
+ case 0: sp = 0; /* ("dotsection"); */ break;
+ case 1: sp = 0; /* ("vstem3"); */ break;
+ case 2: sp = 0; /* ("hstem3"); */ break;
+ case 6: /* ("seac"); */
+ {
+ int c1,c2;
+ c1 = stack[--sp];
+ c2 = stack[--sp];
+ sp -= 3;
+ if ( StandardEncoding[c1] == NULL )
+ fprintf(stderr,"No character %d in Standard encoding\n",c1);
+ else
+ {
+ for( i = 0 ; i < CharStringCnt ; i++ )
+ if ( ! strcmp(CharString[i].Name+1,StandardEncoding[c1]) )
+ break;
+ if ( i >= CharStringCnt )
+ fprintf(stderr,"No seac refered character %s in font\n",
+ StandardEncoding[c1]);
+ else if ( ! CharString[i].use )
+ {
+ CharString[i].use = 1;
+ sp = 0;
+ ProcessCharString( CharString[i].cs , CharString[i].len );
+ }
+ }
+ c1 = c2;
+ if ( StandardEncoding[c1] == NULL )
+ fprintf(stderr,"No character %d in Standard encoding\n",c1);
+ else
+ {
+ for( i = 0 ; i < CharStringCnt ; i++ )
+ if ( ! strcmp(CharString[i].Name+1,StandardEncoding[c1]) )
+ break;
+ if ( i >= CharStringCnt )
+ fprintf(stderr,"No seac refered character %s in font\n",
+ StandardEncoding[c1]);
+ else if ( ! CharString[i].use )
+ {
+ CharString[i].use = 1;
+ sp = 0;
+ ProcessCharString( CharString[i].cs , CharString[i].len );
+ }
+ }
+ }
+ break;
+ case 7: sp = 0; /* ("sbw"); */ break;
+ case 12: sp--; stack[sp-1] /= stack[sp]; /* ("div"); */ break;
+ case 16: /* ("callothersubr"); */
+ /* I have no Adobe Type 1 manual on hands now and not remember
+ order of loading arguments in calling of othersubr
+ but there it is not important. */
+ val = stack[--sp];
+ cop = stack[--sp];
+ for( i = 0 ; i < cop ; i++ )
+ vop[i] = stack[--sp];
+ /* Special logic there ... */
+ if ( val == 3 ) Subr[3].use = 1; /* Used hint replacement */
+ break;
+ case 17: /* ("pop"); */
+ stack[sp++] = vop[--cop];
+ break;
+ case 33: sp -= 2; /* sp = 0; */ /* ("setcurrentpoint"); */ break;
+ default:
+ fprintf(stderr, "UNKNOWN_12_%d", b);
+ break;
+ }
+ break;
+ default:
+ fprintf(stderr, "UNKNOWN_%d", b);
+ break;
+ }
+ }
+ } /* End while */
+ cr = cr_save;
+}
+
+void Fix_String( char *dst , char *Tag , int Val , char *src )
+{
+ char *cp,*dp;
+ strcpy(dst,src);
+ if ( (cp=strstr(src,Tag)) == NULL )
+ { fprintf(stderr,"Nu i nu, not '%s' in '%s'\n",Tag,src); exit(1); }
+ cp += strlen(Tag);
+ dp = dst + (cp-src);
+ while ( *cp && *cp <= ' ' ) cp++; /* skip spaces */
+ while ( '0' <= *cp && *cp <= '9' ) cp++; /* skip digits */
+ sprintf(dp,"%d%s",Val,cp);
+}
+
+# define MAXENCODINGS 64
+int EncodingPosition = 0;
+# ifdef PEDANTICAL_ENCODING_PROCESSING
+char **Encoding = 0;
+int EncodingCnt = 0;
+char **EncodingList[MAXENCODINGS];
+
+char *RegisterEncoding( char **Encoding )
+{
+ int i,j;
+ static char buf[64];
+
+ /* Search the same encoding ... */
+ for( i = 0 ; i < EncodingCnt ; i++ )
+ {
+ for( j = 0 ; j < 256 ; j++ )
+ if ( strcmp(Encoding[j],EncodingList[i][j]) ) break;
+ if ( j >= 256 ) break; /* Found the same encoding ... */
+ }
+ if ( i >= EncodingCnt )
+ { /* Booking new encoding ... */
+ if ( EncodingCnt < MAXENCODINGS )
+ EncodingList[EncodingCnt++] = Encoding;
+ else
+ fprintf(stderr,"Too many different encodings...\n");
+ /* Write this Encoding into file ... */
+ fprintf(ofp,"/SubFontEncoding-%d 256 array\n",i);
+ fprintf(ofp,"0 1 255 {1 index exch /.notdef put} for\n");
+ for( j = 0 ; j < 256 ; j++ )
+ if ( strcmp(Encoding[j],"/.notdef") )
+ fprintf(ofp,"dup %d %s put\n",j,Encoding[j]);
+ fprintf(ofp,"readonly def\n");
+ }
+ sprintf(buf,"SubFontEncoding-%d",i);
+ return buf;
+}
+
+void Begin_Encoding( char *line )
+{
+ int i;
+ Encoding = xmalloc( 256 * sizeof(char *) );
+ for( i = 0; i < 256 ; i++ ) Encoding[i] = "/.notdef";
+}
+
+int Fill_Encoding( char *line )
+{
+ int IsEncoding ;
+ char *cp,buf[128];
+
+ IsEncoding = 1;
+ if ( (cp=strstr(line," def")) != NULL ) /* End of encoding vector */
+ {
+ char *EncName, buf[128];
+ IsEncoding = 0;
+ EncName = RegisterEncoding( Encoding );
+ sprintf(buf,"/Encoding %s def\n",EncName);
+ pool_cnt--; /* discard previos Encoding line */
+ if ( Verbose )
+ fprintf(stderr,"End of encoding vector at: %s by %s",line,cp);
+ output(buf); /* make reference into our encoding ... */
+ }
+ else if ( (cp=strstr(line,"dup ")) != NULL )
+ { /* Fill encoding vector by follow material ... */
+ int code;
+ char *ep;
+
+ while ( (cp=strstr(cp,"dup ")) != NULL )
+ {
+ cp += 4;
+ code = atoi(cp);
+ if ( code < 0 || code >= 256 )
+ { fprintf(stderr,"Invalid encoding '%s'\n",line); exit(1); }
+ while( *cp && *cp <= ' ' ) cp++;
+ while( *cp && '0' <= *cp && *cp <= '9' ) cp++;
+ while( *cp && *cp <= ' ' ) cp++;
+ if ( *cp != '/' )
+ { fprintf(stderr,"Invalid encoding '%s'\n",line); exit(1); }
+ for( ep = cp ; *ep && *ep > ' ' ; ep++ );
+ Encoding[code] = xmalloc( (ep-cp) + 1 );
+ memcpy(Encoding[code],cp,ep-cp);
+ Encoding[code][ep-cp] = 0;
+ }
+ }
+ return IsEncoding;
+}
+# else
+# define MAXENCODINGLINES 512 /* Must be more then 256, for example dcr... */
+int EncodingLines = 0;
+char *Encoding[MAXENCODINGLINES];
+int EncodingCnt = 0;
+struct { char **Body; int Lines; } EncodingList[MAXENCODINGS];
+
+char *RegisterEncoding( char **Encoding )
+{
+ int i,j;
+ static char buf[64];
+
+ /* Search the same encoding ... */
+ for( i = 0 ; i < EncodingCnt ; i++ )
+ if ( EncodingList[i].Lines == EncodingLines )
+ {
+ for( j = 0 ; j < EncodingList[i].Lines ; j++ )
+ if ( strcmp(Encoding[j],EncodingList[i].Body[j]) ) break;
+ if ( j >= EncodingList[i].Lines ) break; /* the same encoding ... */
+ }
+
+ if ( i >= EncodingCnt )
+ { /* Booking new encoding ... */
+ if ( EncodingCnt < MAXENCODINGS )
+ {
+ EncodingList[EncodingCnt].Lines = EncodingLines ;
+ EncodingList[EncodingCnt].Body =
+ xmalloc( sizeof(char *) * EncodingLines );
+ memcpy(EncodingList[EncodingCnt].Body,Encoding,
+ sizeof(char *) * EncodingLines );
+ EncodingCnt++;
+ }
+ else
+ fprintf(stderr,"Too many different encodings...\n");
+ /* Write this Encoding into file ... */
+ for( j = 0 ; j < EncodingLines ; j++ )
+ fputs(Encoding[j],ofp);
+ fprintf(ofp,"/SubFontEncoding-%d Encoding def\n",i);
+ }
+ sprintf(buf,"SubFontEncoding-%d",i);
+ return buf;
+}
+
+void Begin_Encoding( char *line )
+{
+ EncodingLines = 0;
+ Encoding[EncodingLines++] = xstrdup(line);
+}
+
+int Fill_Encoding( char *line )
+{
+ int IsEncoding ;
+ char *cp;
+
+ IsEncoding = 1;
+ if ( EncodingLines >= MAXENCODINGLINES )
+ { fprintf(stderr,"? SubFont: Too long encoding\n"); exit(1); }
+ Encoding[EncodingLines++] = xstrdup(line);
+ if ( (cp=strstr(line," def")) != NULL ) /* End of encoding vector */
+ {
+ char *EncName, buf[128];
+ EncName = RegisterEncoding( Encoding );
+ sprintf(buf,"/Encoding %s def\n",EncName);
+ pool_cnt--; /* discard previos Encoding line */
+ if ( Verbose )
+ fprintf(stderr,"End of encoding vector at: %s by %s",line,cp);
+ output(buf); /* make reference into our encoding ... */
+ return 0;
+ }
+ return 1;
+}
+# endif
+
+int Process_Font( char *NeedChars )
+{
+ int i,k,l;
+ int IsEncoding;
+
+ /* reset important variables ... */
+ Subrs = 0;
+ MaxSubrs = 0;
+ SubrsPosition = 0;
+ HiMaxSubrs = 0;
+ HiSubrsPosition = 0;
+ Subr = HiSubr = NULL;
+
+ CharStrings = 0;
+ CharStringsPosition = 0;
+ CharStringCnt = 0;
+ lenIV = 4;
+ first_byte = 1;
+ is_pfa = is_pfb = 0;
+ pfb_remaining = 0;
+ p_eexec_scan = 0;
+ reported = 0;
+ in_eexec = out_eexec = 0;
+ pool_cnt = 0;
+ EncodingPosition = 0;
+ /* Encoding = NULL; */
+ IsEncoding = 0;
+ hexcol = 0;
+ /* main loop---normally done when reach `mark currentfile closefile' on
+ output (rest is garbage). */
+
+ for (;;) {
+ egetline();
+ if (line[0] == '\0')
+ break;
+ set_lenIV();
+
+ if ( IsEncoding )
+ {
+ IsEncoding = Fill_Encoding( line );
+ }
+ else if ( Subrs )
+ {
+ int SubrNo;
+ char *cp;
+ for( cp = line ; *cp && *cp <= ' ' ; cp++ );
+ if ( strncmp(cp,"dup ",4) != 0 )
+ {
+ fprintf(stderr,"Unexpected end of Subrs: '%s'",line);
+ fprintf(stderr,"While %d Subrs yet not defined\n",Subrs);
+ Subrs = 0;
+ }
+ else
+ {
+ cp += 4;
+ while( *cp && *cp <= ' ' ) cp++; /* skip leader spaces */
+ SubrNo = atoi(cp);
+ if ( SubrNo < 0 || SubrNo >= MaxSubrs )
+ { fprintf(stderr,"Invalid subr number %d\n",SubrNo); exit(1); }
+ while( '0' <= *cp && *cp <= '9' ) cp++; /* skip digits */
+ while( *cp && *cp <= ' ' ) cp++; /* skip spaces */
+ Subr[SubrNo].len = atoi(cp);
+ while( '0' <= *cp && *cp <= '9' ) cp++; /* skip digits */
+ while( *cp && *cp <= ' ' ) cp++; /* skip spaces */
+ if ( ! ( ( cp[0] == 'R' && cp[1] == 'D' && cp[2] == ' ' )
+ || ( cp[0] == '-' && cp[1] == '|' && cp[2] == ' ' )
+ )
+ ) { fprintf(stderr,"Bad CharString: %s",cp); exit(1); }
+ if ( cp[0] == 'R' && cp[1] == 'D' ) strcpy(RD_String,"RD");
+ if ( cp[0] == '-' && cp[1] == '|' ) strcpy(RD_String,"-|");
+ cp += 3 ;
+ Subr[SubrNo].cs = fmalloc( Subr[SubrNo].len + 1 , "Subrs" );
+ memcpy(Subr[SubrNo].cs,cp,Subr[SubrNo].len );
+ Subr[SubrNo].cs[Subr[SubrNo].len] = 0;
+ cp += Subr[SubrNo].len ;
+ while( *cp && *cp <= ' ' ) cp++; /* skip spaces */
+ if ( cp[0] == 'N' && cp[1] == 'P' )
+ strcpy(NP_String,"NP");
+ else if ( cp[0] == '|' )
+ strcpy(NP_String,"|");
+ else if ( strncmp(cp,"noaccess put",12) == 0 )
+ strcpy(NP_String,"noaccess put");
+ else if ( strncmp(cp,"readonly put",12) == 0 )
+ strcpy(NP_String,"readonly put");
+ else
+ { fprintf(stderr,"Bad CharString: %s",cp); exit(1); }
+
+ if ( Trace ) fprintf(stderr,"[%d,%d]",SubrNo,Subr[SubrNo].len);
+ Subrs--;
+ }
+ }
+ else if ( CharStrings )
+ {
+ char *cp;
+ if ( line[0] != '/' )
+ {
+ fprintf(stderr,"Unexpected end of CharStrings: '%s'",line);
+ fprintf(stderr,"While %d CharStrings yet not defined\n",Subrs);
+ CharStrings = 0;
+ }
+ else
+ {
+ cp = line;
+ while( *cp && *cp > ' ' ) cp++; /* Skip name */
+ *cp++ = 0;
+ CharString[CharStringCnt].Name = fmalloc(strlen(line)+1,line);
+ strcpy(CharString[CharStringCnt].Name, line );
+ if ( Trace ) fprintf(stderr,"%s",line);
+ while( *cp && *cp <= ' ' ) cp++; /* Skip spaces ... */
+ CharString[CharStringCnt].len = atoi(cp);
+ while( '0' <= *cp && *cp <= '9' ) cp++; /* skip digits */
+ while( *cp && *cp <= ' ' ) cp++; /* skip spaces */
+ if ( ! ( ( cp[0] == 'R' && cp[1] == 'D' && cp[2] == ' ' )
+ || ( cp[0] == '-' && cp[1] == '|' && cp[2] == ' ' )
+ )
+ ) { fprintf(stderr,"Bad CharString: %s",cp); exit(1); }
+ if ( cp[0] == 'R' && cp[1] == 'D' ) strcpy(RD_String,"RD");
+ if ( cp[0] == '-' && cp[1] == '|' ) strcpy(RD_String,"-|");
+ cp += 3 ;
+ CharString[CharStringCnt].cs
+ = fmalloc( CharString[CharStringCnt].len , "CharString" );
+ memcpy(CharString[CharStringCnt].cs,cp,
+ CharString[CharStringCnt].len );
+ cp += CharString[CharStringCnt].len ;
+ while( *cp && *cp <= ' ' ) cp++; /* skip spaces */
+ if ( cp[0] == 'N' && cp[1] == 'D' )
+ strcpy(ND_String,"ND");
+ else if ( cp[0] == '|' && cp[1] == '-' )
+ strcpy(ND_String,"|-");
+ else if ( strncmp(cp,"noaccess def",12) == 0 )
+ strcpy(ND_String,"noaccess def");
+ else if ( strncmp(cp,"readonly def",12) == 0 )
+ strcpy(ND_String,"readonly def");
+ else
+ { fprintf(stderr,"Bad CharString: %s",cp); exit(1); }
+ CharStringCnt++;
+ CharStrings--;
+ }
+ }
+ else
+ {
+ char *cp;
+ if ( (cp=strstr(line,"/Subrs ")) != NULL )
+ { /* Start of subrs there ... */
+ if ( SubrsPosition )
+ { /* HYBRID Type1 fonts have two copies of Subrs,
+ for High and low resolution devices.
+ There I will save previously accumulated Subrs ... */
+ HiMaxSubrs = MaxSubrs;
+ HiSubrsPosition = SubrsPosition;
+ HiSubr = Subr;
+ }
+ /* Temporarie, fragments only first copy of Subrs... */
+ cp += strlen("/Subrs ");
+ MaxSubrs = Subrs = atoi(cp);
+ if ( Verbose ) fprintf(stderr,"Declared %d in Subrs\n",Subrs);
+ SubrsPosition = pool_cnt ;
+ Subr = fmalloc( Subrs * sizeof(*Subr) , "Subr array" );
+ }
+ else if ( (cp=strstr(line,"/CharStrings ")) != NULL )
+ { /* Start of CharStrings there ... */
+ if ( ! CharStringsPosition )
+ { /* Only first appearing of /CharStrings indicate real CS */
+ cp += strlen("/CharStrings ");
+ CharStrings = atoi(cp);
+ if ( Verbose )
+ fprintf(stderr,"Declared %d in CharStrings\n",CharStrings);
+ CharStringsPosition = pool_cnt ;
+ CharString = fmalloc( CharStrings * sizeof(*CharString) ,
+ "CharString array" );
+ CharStringCnt = 0;
+ }
+ }
+ else if ( TouchEncoding && (cp=strstr(line,"/Encoding ")) == line )
+ {
+ if ( (cp=strstr(line,"def")) == NULL )
+ {
+ EncodingPosition = pool_cnt;
+ IsEncoding = 1;
+ Begin_Encoding( line );
+ }
+ }
+ output(line);
+ }
+
+ if (strcmp(line, "mark currentfile closefile\n") == 0)
+ break;
+ }
+
+ if ( Verbose )
+ fprintf(stderr,"Loaded %d lines\n",pool_cnt);
+
+ /* Mark ONLY required charstrings ... */
+ /* Clear all use markers */
+ for( i = 0 ; i < MaxSubrs ; i++ ) Subr[i].use = 0;
+ if ( HiSubr != NULL )
+ for( i = 0 ; i < HiMaxSubrs ; i++ ) HiSubr[i].use = 0;
+ for( i = 0 ; i < CharStringCnt ; i++ ) CharString[i].use = 0;
+
+ /* Walk Throught Charstrings and mark all used ones. */
+ for( i = 0 ; i < CharStringCnt ; i++ )
+ {
+ char buf[128];
+ sprintf(buf,"%s/",CharString[i].Name);
+ if ( strcmp(buf,"/.notdef/") == 0 || strstr(NeedChars,buf) != NULL )
+ {
+ CharString[i].use = 1;
+ sp = 0;
+ if ( Trace ) fprintf(stderr,"<%s",buf);
+ ProcessCharString( CharString[i].cs , CharString[i].len );
+ if ( Trace ) fprintf(stderr,">");
+ }
+ }
+
+ /* Simplest variant; replace unused charstrings by shortenest ... */
+ l = 0;
+ for ( i = 0 , k = 0 ; i < MaxSubrs ; i++ )
+ if ( ! Subr[i].use )
+ { Subr[i] = Subr[3]; Subr[i].use = 0; }
+ else
+ { k = i; l++; }
+ MaxSubrs = k+1; /* Forget tail of unused subrs ... */
+ if ( HiSubr != NULL )
+ {
+ for ( i = 0 , k = 0 ; i < HiMaxSubrs ; i++ )
+ if ( ! HiSubr[i].use )
+ { HiSubr[i] = HiSubr[3]; HiSubr[i].use = 0; }
+ else
+ { k = i; l++; }
+ HiMaxSubrs = k+1; /* Forget tail of unused subrs ... */
+ }
+
+ l = MaxSubrs + (HiSubr == NULL ? 0 : HiMaxSubrs) - l;
+ if ( Verbose ) fprintf(stderr,"%d empty array positions\n",l);
+ ArrLosts += l * 8;
+
+ /* Now dumps all my fragments ... */
+ in_eexec = out_eexec = 0;
+ if ( SubrsPosition )
+ {
+ if ( HiSubrsPosition )
+ {
+ Dump_Pool( 0 , HiSubrsPosition) ;
+ if ( HiMaxSubrs > 0 ) /* Can be removed all after filtering ... */
+ { /* Dump Subrs there ... */
+ Fix_String( line , "/Subrs " , HiMaxSubrs , pool[HiSubrsPosition] );
+ eexec_string(line);
+ for( i = 0 ; i < HiMaxSubrs ; i++ )
+ {
+ if ( (!Eexec_Output) && (!HiSubr[i].use) ) continue;
+ sprintf(line,"dup %d",i);
+ eexec_string(line);
+ Dump_CS(HiSubr[i].len,HiSubr[i].cs);
+ sprintf(line,"%s\n",NP_String);
+ eexec_string(line);
+ }
+ Dump_Pool( HiSubrsPosition+1, SubrsPosition ) ;
+ }
+ else
+ Dump_Pool( HiSubrsPosition+2 , SubrsPosition) ;
+ }
+ else
+ Dump_Pool( 0 , SubrsPosition) ;
+ if ( MaxSubrs > 0 ) /* Can be removed all after filtering ... */
+ { /* Dump Subrs there ... */
+ Fix_String( line , "/Subrs " , MaxSubrs , pool[SubrsPosition] );
+ eexec_string(line);
+ for( i = 0 ; i < MaxSubrs ; i++ )
+ {
+ if ( (!Eexec_Output) && (!Subr[i].use) ) continue;
+ sprintf(line,"dup %d", i);
+ eexec_string(line);
+ Dump_CS(Subr[i].len,Subr[i].cs);
+ sprintf(line,"%s\n",NP_String);
+ eexec_string(line);
+ }
+ Dump_Pool( SubrsPosition+1, CharStringsPosition ) ;
+ }
+ else
+ Dump_Pool( SubrsPosition+2, CharStringsPosition ) ;
+ }
+ else
+ Dump_Pool( 0, CharStringsPosition ) ;
+
+ for( i = k = 0 ; i < CharStringCnt ; i++ )
+ if ( CharString[i].use ) k++;
+ Fix_String( line , "/CharStrings " , k , pool[CharStringsPosition] );
+ eexec_string(line);
+ for( i = k = 0 ; i < CharStringCnt ; i++ )
+ if ( CharString[i].use )
+ {
+ eexec_string(CharString[i].Name);
+ Dump_CS(CharString[i].len, CharString[i].cs );
+ sprintf(line,"%s\n",ND_String);
+ eexec_string(line);
+ }
+ Dump_Pool( CharStringsPosition+1 , pool_cnt ) ;
+ if ( out_eexec )
+ eexec_end();
+ else if ( Eexec_Output )
+ fprintf(stderr,"? Strange font format (without eexec...)\n");
+
+ fAllFree();
+ return 0;
+}
+
+Copying_Full_Font(void)
+{
+ int i, cnt;
+
+ lenIV = 4;
+ first_byte = 1;
+ is_pfa = is_pfb = 0;
+ pfb_remaining = 0;
+ p_eexec_scan = 0;
+ reported = 0;
+ in_eexec = out_eexec = 0;
+ hexcol = 0;
+
+ while ( 1 )
+ {
+ cnt = egetline();
+ if ( line[0] == 0 ) break;
+ set_lenIV();
+ for( i = 0 ; i < cnt ; i++ )
+ eexec_byte(line[i]);
+ if (strcmp(line, "mark currentfile closefile\n") == 0) break;
+ if ( in_eexec && (!out_eexec) ) eexec_start();
+ }
+ if ( out_eexec )
+ eexec_end();
+ else
+ fprintf(stderr,"This font is not an ATM compatible, eexec is missed\n");
+ return 0;
+}
+
+FILE *Set_Adequate_Read_Mode( FILE *fp , char *fileName )
+/* 25-Nov-94
+ I can not correctly read text file which was opened as binary in VMS.
+ In this reason, if opened file is not PFB i will reopen it in text mode.
+*/
+{
+# if defined(vms) || defined(MSDOS)
+ if ( fgetc(fp) == MARKER )
+ ungetc(MARKER,fp);
+ else
+ {
+ fclose(fp);
+ if ( (fp=fopen(fileName,"r")) == NULL )
+ {
+ fprintf(stderr,"Ops, can't reopen file %s\n",fileName);
+ exit(1);
+ }
+ }
+# endif
+ return fp;
+}
+
+Scan_FontName( char *fileName , FILE *fp )
+{
+ int cnt;
+
+ lenIV = 4;
+ first_byte = 1;
+ is_pfa = is_pfb = 0;
+ pfb_remaining = 0;
+ p_eexec_scan = 0;
+ reported = 0;
+ in_eexec = out_eexec = 0;
+ hexcol = 0;
+
+ if ( (ifp=fopen(fileName,RB)) == NULL )
+ {
+ fprintf(stderr,"? Can't found file %s\n",fileName);
+ return 0;
+ }
+ ifp = Set_Adequate_Read_Mode( ifp , fileName );
+ while ( 1 )
+ {
+ cnt = egetline();
+ if ( line[0] == 0 ) break;
+ set_lenIV();
+ if( strncmp(line,"/FontName",9) == 0 )
+ {
+ char *cp,*ep;
+ for( cp = line + 9 ; *cp && *cp <= ' ' ; cp++ );
+ for( ep = cp ; *ep && *ep > ' ' ; ep++ ); *ep = '\0';
+ fprintf(fp,"%s (%s) ;\n",cp,fileName);
+ fclose(ifp);
+ return 1;
+ }
+ }
+ fclose(ifp);
+ return 0;
+}
+
+struct FontMap {
+ struct FontMap *next;
+ char *fontName;
+ char *fileName;
+ } *fmp, *fontMap = NULL;
+
+int main(int ac, char **av)
+{
+ int ap;
+ char *cp;
+ char *Need_Chars = NULL;
+ char *FontSearchPath = DEFAULTFONTPATH ;
+ FILE *fp;
+ char buf[4096];
+
+ ifp = stdin;
+ ofp = stdout;
+
+ init_Encoding();
+
+ for( ap = 1 ; ap < ac ; ap++ )
+ if ( av[ap][0] == '-' && av[ap][1] != 0 )
+ switch( av[ap][1] )
+ {
+ case 'v': case 'V': /* Like trace verbose */
+ Verbose = 1;
+ break;
+ case 't': case 'T': /* Trace font processing */
+ Trace = 1;
+ break;
+ case 'e': case 'E': /* Encoding optimization falg */
+ TouchEncoding = atoi(av[ap]+2);
+ break;
+ case 'x': case 'X': /* output eexec using flag */
+ Eexec_Output = atoi(av[ap]+2);
+ break;
+ case 'o': case 'O': /* ... Open output file there */
+ cp = av[ap][2] ? av[ap]+2 : av[++ap] ;
+ if ( (ofp=fopen(cp,"w")) == NULL )
+ { fprintf(stderr,"? Can't create file: '%s'\n",cp); return 1; }
+ break;
+ case 'a': case 'A': /* ... Open output file for append */
+ cp = av[ap][2] ? av[ap]+2 : av[++ap] ;
+ if ( (ofp=fopen(cp,"a")) == NULL )
+ { fprintf(stderr,"? Can't open for append file: '%s'\n",cp); return 1; }
+ break;
+ case 'b': case 'B': /* Open binary file for output */
+ cp = av[ap][2] ? av[ap]+2 : av[++ap] ;
+ if ( (ofp=fopen(cp,WB)) == NULL )
+ { fprintf(stderr,"? Can't create file: '%s'\n",cp); return 1; }
+ pfb = 1;
+ break;
+ case 'c': case 'C': /* Copy specified file to output as is */
+ /* Generally, this code solves problems of the file merging
+ of different record type in VMS operating system.
+ */
+ cp = av[ap][2] ? av[ap]+2 : av[++ap] ;
+ if ( cp[0] == '-' && cp[1] == 0 )
+ ifp = stdin ;
+ else if ( (ifp=fopen(cp,"r")) == NULL )
+ { fprintf(stderr,"? Can't found file: '%s'\n",cp); return 1; }
+ while ( fgets(buf,sizeof(buf),ifp) != NULL )
+ fputs(buf,ofp);
+ if ( ifp != stdin ) fclose(ifp);
+ Files++;
+ break;
+ case 'u': case 'U': /* Open binary file for output */
+ uFileName = av[ap][2] ? av[ap]+2 : av[++ap] ;
+ break;
+ case 'n': case 'N': /* Load required names ... */
+ Need_Chars = av[ap] + 2 ;
+ break;
+ case 'i': case 'I': /* Install font search path */
+ FontSearchPath = av[ap]+2;
+ break;
+ case 'm': case 'M': /* font mapping file */
+ cp = av[ap][2] ? av[ap]+2 : av[++ap] ;
+ if ( (fp=fopen(cp,"r")) == NULL )
+ {fprintf(stderr,"? SubFont: Can't found file '%s'\n",cp); return 1;}
+ while ( fgets(buf,sizeof(buf),fp) != NULL )
+ {
+ char *fontp,*ecp;
+ for( cp = buf; *cp && *cp <= ' ' ; cp++ ); /* skip spaces */
+ if ( *cp == 0 || *cp == '%' ) continue; /* Comment or empty line */
+ if ( *cp == '/' )
+ { /* Process GhostScript like font map */
+ fontp = ++cp;
+ while ( *cp && *cp > ' ' ) cp++; /* search end of font name */
+ *cp++ = 0;
+ while ( *cp && *cp <= ' ' ) cp++;
+ if ( *cp == '(' )
+ { /* Format like to: '/FontName (file-name) ; */
+ for( ecp = ++cp; *ecp && *ecp > ' ' && *ecp != ')'; ecp++);
+ *ecp = 0;
+ }
+ else
+ { /* Format like to: '/Fontmap file-name' */
+ for( ecp=cp ; *ecp && *ecp > ' ' ; ecp++);
+ *ecp = 0;
+ }
+ }
+ else
+ { /* Process simple format Fontmap */
+ fontp = cp;
+ while ( *cp && *cp > ' ' ) cp++; /* search end of font name */
+ *cp++ = 0;
+ while ( *cp && *cp <= ' ' ) cp++;
+ for( ecp=cp ; *ecp && *ecp > ' ' ; ecp++); *ecp = 0;
+ }
+ /* Add entry to font mapping list */
+ fmp = xmalloc(sizeof(struct FontMap));
+ fmp->next = fontMap;
+ fmp->fontName = xstrdup(fontp);
+ fmp->fileName = xstrdup(cp);
+ fontMap = fmp;
+ }
+ fclose(fp);
+ break;
+ case 'f': case 'F': /* Load all fonts according psfontstat list */
+ if ( pfb )
+ {
+ fprintf(stderr,
+ "Processing several fonts into one PFB not available.\n");
+ return 1;
+ }
+ else
+ {
+ cp = av[ap][2] ? av[ap]+2 : (ap+1<ac?av[++ap]:"-") ;
+ if ( cp[0] == '-' && cp[1] == '\0' )
+ fp = stdin;
+ else if ( (fp=fopen(cp,"r")) == NULL )
+ { fprintf(stderr,"No file '%s'\n",cp); return 1; }
+ Files += 10000 ;
+ while ( fgets( buf, sizeof(buf), fp ) != NULL )
+ {
+ char *cp, *ep, fntName[64],fontName[64],fileName[256];
+ /* extract font name */
+ if ( (cp=strchr(buf,'/')) == NULL || cp == buf )
+ { fprintf(stderr,"Invalid: '%s'\n",buf); return 1; }
+ memcpy(fontName,buf,(int)(cp-buf)); fontName[cp-buf] = '\0';
+ strcpy(fntName,fontName);
+ /* Search alias in map ... */
+ for( fmp = fontMap ; fmp != NULL ; fmp=fmp->next)
+ if ( strcmp(fmp->fontName,fontName) == 0 )
+ {
+ /* fprintf(stderr,"Font '%s' looks in file '%s'\n",
+ fmp->fontName,fmp->fileName); */
+ strcpy(fontName,fmp->fileName);
+ break;
+ }
+ /* install list of required characters */
+ Need_Chars = cp;
+ /* Search font file */
+ for( ifp = NULL, cp = FontSearchPath ; *cp > ' ' ; cp = ep )
+ {
+ int j;
+ if( (ep=strchr(cp,PATH_DELIMITER)) == NULL )
+ ep = cp + strlen(cp);
+ j = (int)(ep - cp); if ( *ep == PATH_DELIMITER ) ep++;
+ memcpy(fileName,cp,j);
+ if ( FILE_DELIMITER != '\0' )
+ if ( j && fileName[j-1] != FILE_DELIMITER )
+ fileName[j++] = FILE_DELIMITER;
+ strcpy(fileName+j,fontName); j = strlen(fileName);
+ if ( Verbose ) fprintf(stderr,"Try open '%s'\n",fileName);
+ if ( (ifp=fopen(fileName,RB)) != NULL ) break;
+ if ( strcmp(fntName,fontName) == 0 )
+ {
+ strcpy(fileName+j,".pfb");
+ if ( Verbose ) fprintf(stderr,"Try open '%s'\n",fileName);
+ if ( (ifp=fopen(fileName,RB)) != NULL ) break;
+ strcpy(fileName+j,".pfa");
+ if ( Verbose ) fprintf(stderr,"Try open '%s'\n",fileName);
+ if ( (ifp=fopen(fileName,RB)) != NULL ) break;
+ }
+ }
+ if ( ifp == NULL )
+ {
+ fprintf(stderr,"Can't found font '%s' in path '%s'\n",
+ fontName,FontSearchPath);
+ if ( ufp == NULL && uFileName != NULL )
+ {
+ if ( (ufp=fopen(uFileName,"w")) == NULL )
+ { fprintf(stderr,"? Can't create file: '%s'\n",uFileName); }
+ }
+ if ( ufp != NULL )
+ fprintf(ufp,"%s\n",fontName);
+ continue;
+ }
+ else
+ fprintf(stderr,"Process font '%s' from file '%s'\n",
+ fntName,fileName);
+ /*fprintf(ofp,"(Loading font %s\\n) print flush\n",fontName);*/
+ TouchEncoding++;
+ Eexec_Output--;
+ ifp = Set_Adequate_Read_Mode( ifp , fileName );
+ Process_Font( Need_Chars );
+ Eexec_Output++;
+ TouchEncoding--;
+ if ( ifp != stdin ) fclose(ifp);
+ Files++;
+ }
+ }
+ break;
+ case 'z': case 'Z': /* This command is used to make font map */
+ if ( av[ap][2] == '\0' )
+ ofp = stdout;
+ else if ( (ofp=fopen(av[ap]+2,"a")) == NULL )
+ {
+ fprintf(stderr,"? SubFont: Can't write file '%s'\n",av[ap]+2);
+ return 1;
+ }
+ for( ap++ ; ap < ac ; ap++ )
+ Scan_FontName( av[ap] , ofp );
+ return 0;
+ default:
+ fprintf(stderr,"? SubFont: Unknown option '%s'\n",av[ap]);
+ return 1;
+ }
+ else
+ {
+ if ( pfb && Files )
+ {
+ fprintf(stderr,
+ "Processing several fonts into one PFB not available.\n");
+ return 1;
+ }
+# ifndef vms
+ if ( av[ap][0] == '-' && av[ap][1] == 0 )
+ ifp = stdin ;
+ else
+# endif
+ if ( (ifp=fopen(av[ap],RB)) == NULL )
+ { fprintf(stderr,"? Can't found file: '%s'\n",av[ap]); return 1; }
+ ifp = Set_Adequate_Read_Mode( ifp , av[ap] );
+ if ( Need_Chars == NULL )
+ { if ( Copying_Full_Font() ) exit(1); }
+ else
+ Process_Font( Need_Chars );
+ if ( ifp != stdin ) fclose(ifp);
+ Files++;
+ }
+
+ if ( ! Files )
+ {
+ fprintf(stderr,"%s designed by %s\n",PROBLEM,AUTHOR);
+ fprintf(stderr,"Shortly called %s, Version %s/%s, Revision Date %s\n",
+ PROGRAM, VERSION, SYSID, REVDATE);
+ fprintf(stderr,"Copyright (C) %s All Rights Reserved.\n\n",COPYRIGHT);
+ fprintf(stderr,"Usage: SubFont [options] { -n... | <in-file> } \n");
+ fprintf(stderr," Options are:\n");
+ fprintf(stderr," -v - Verbose ...\n");
+ fprintf(stderr," -o<file> - Output file (Default is stdout)\n");
+ fprintf(stderr," -a<file> - Output file in append(text) mode\n");
+ fprintf(stderr," -b<file> - Output binary file (PFB)\n");
+ fprintf(stderr," -c<file> - Copying specified file to output as is\n");
+ fprintf(stderr," -n/../../ - List of names of required characters ...\n");
+ fprintf(stderr," <file> - Process font from file...\n");
+# ifndef vms
+ fprintf(stderr," - - Process font from stdin...\n");
+# endif
+ fprintf(stderr," -f<file> - Process font list from file.\n");
+ fprintf(stderr," -m<file> - Font mapping file (used with -f)\n");
+ fprintf(stderr," -I<path> - Font search path (used with -f)\n");
+ fprintf(stderr," Default='%s'\n",FontSearchPath);
+ fprintf(stderr," -u<file> - File for put list of undefined fonts (used with -f)\n");
+ fprintf(stderr," -e# - Encoding optimization flag...\n");
+ fprintf(stderr," -x# - output eexec using flag...\n");
+ fprintf(stderr," -z - read files and print it PS name...\n");
+ return 1;
+ }
+ else
+ {
+ fprintf(stderr,"Totaly %d files are processed.\n",Files % 10000 );
+ if ( Verbose )
+ fprintf(stderr,"Totally %d unused bytes in Subr arrays\n",ArrLosts);
+ }
+ if ( ofp != stdout ) fclose(ofp);
+ if ( ufp != NULL ) fclose(ufp);
+ return 0;
+}
+
diff --git a/fonts/utilities/fontload/unix/INSTALL b/fonts/utilities/fontload/unix/INSTALL
new file mode 100644
index 0000000000..bbc444d6bd
--- /dev/null
+++ b/fonts/utilities/fontload/unix/INSTALL
@@ -0,0 +1,120 @@
+#!/bin/csh
+# Install
+# This C-shell will help to install fload tool,
+# which realizes Partial Downloading of the ATM compatible Type 1 fonts
+# for some PostScript file.
+###############################################################################
+if ( ! -e INSTALL ) then
+ echo Installation available only from directory with install script.
+ exit
+endif
+if ( -e install.dirs ) then
+ source install.dirs
+else
+ # Directory to put system dependent executable files (subfont program)
+ setenv FBIN /usr/local/bin
+ # Directory to put system independent scripts (fload C-shell script)
+ setenv FSHR /usr/local/bin
+ # Directory for library files (Fontmap, psfstat.ps, SubFont.map, *.FS)
+ setenv FLIB /usr/local/lib/fload
+ # Also Check that all your fonta are in list directory tries
+ setenv FPATH /usr/local/lib/texmf/fonts
+endif
+##############################################################################
+echo Check environment ...
+set gsbin=`which gs`
+if ( ! -e "$gsbin" ) then
+ echo Can not found GhostScript program in path $path
+ exit
+endif
+
+echo Making subfont program first ...
+pushd ../src
+make
+popd
+if ( ! -e ../src/subfont ) then
+ echo Make failed.
+ exit 1
+endif
+echo Copying SubFont program to $FBIN/subfont
+cp ../src/subfont $FBIN/subfont
+if ( ! -e $FBIN/subfont ) then
+ echo Can not copying SubFont program to $FBIN directory.
+ exit
+endif
+chmod +x $FBIN/subfont
+
+############## Copying man pages if FMAN environment is on ###################
+if ( $?FMAN ) then
+ echo Copying man pages subfont.1 and fload.1 into $FMAN directory ...
+ cp ../doc/fload.1 $FMAN
+ cp ../doc/subfont.1 $FMAN
+endif
+
+############## Making fload C-shell script ###################################
+
+set out=$FSHR/fload
+echo Create $out C-shell script.
+echo "#\!/bin/csh" >$out
+if ( ! -e $FSHR/fload ) then
+ echo Can not write fload C-shell script into $FSHR directory.
+ exit
+endif
+echo "# Copyright (C) 1994, Basil K. Malyshev. All rights reserved." >>$out
+echo "# WARNING this script was created automatically." >>$out
+echo "set lib=$FLIB" >>$out
+echo "setenv FONTPATH $FPATH" >>$out
+cat <fload.csh >>$out
+chmod +x $out
+
+############## Create files in library directory #############################
+
+if ( ! -e $FLIB ) then
+ mkdir -p $FLIB
+else
+ if ( -e $FLIB/Fontmap ) then
+ rm -f $FLIB/Fontmap
+ endif
+endif
+echo Copying psfstat.ps PostScript script to $FLIB/psfstat.ps
+cp ../lib/psfstat.ps $FLIB/psfstat.ps
+if ( ! -e $FLIB/psfstat.ps ) then
+ echo Can not copying psfstat.ps PostScript script to $FLIB directory.
+ exit
+endif
+echo "Copying files ../lib/*.FS to $FLIB directory."
+cp ../lib/*.FS $FLIB
+
+#### Create standard head of the Fontmap file for GhostScript.
+### $gsbin -DNODISPLAY -sOUT=$FLIB/Fontmap ../lib/Fontmap.get
+### echo "(Fontmap.t1) run" >>$FLIB/Fontmap
+
+#### Scan all font directories and add records to Fontmap & SubFont.map ####
+# Split FPATH variable into elements
+set pathSave=($path)
+setenv PATH $FPATH
+set fpath=($path)
+set path=($pathSave)
+# Now go throght all font directories
+setenv SUBFONT $FBIN/subfont
+echo >$FLIB/Fontmap.t1
+foreach root ($fpath)
+ echo "Scanning $root directory..."
+ echo "%% This part was constructed from $root directory" >>$FLIB/Fontmap.t1
+ pushd root
+ find . -name "*.pf[ab]" -exec $SUBFONT -z$FLIB/Fontmap.t1 {} \;
+ popd
+end
+
+### # And creates map for SubFont program
+### $gsbin -DNODISPLAY -sINFILE=$FLIB/Fontmap.t1 -sOUTFILE=$FLIB/SubFont.map \
+### ../lib/cvtmap.ps quit.ps
+
+echo "=================================================="
+echo "== Installation have been completed. =="
+echo "== Now you can use command: =="
+echo "== fload PS-without-fonts >PS-with-fonts =="
+echo "== to preload fonts partially into your PS-file =="
+echo "=================================================="
+
+#### End of installation script ####
diff --git a/fonts/utilities/fontload/unix/UpdateMap.csh b/fonts/utilities/fontload/unix/UpdateMap.csh
new file mode 100644
index 0000000000..6e9adfd611
--- /dev/null
+++ b/fonts/utilities/fontload/unix/UpdateMap.csh
@@ -0,0 +1,35 @@
+#!/bin/csh
+# Copyright (C) 1994, Basil K. Malyshev. All rights reserved.
+# WARNING this script was created automatically.
+set lib=/usr/local/lib/fload
+setenv FONTPATH /usr/local/lib/texmf/fonts:/usr/local/lib/ISOFonts/pfa
+#!
+#! File: UpdateMap.csh
+#! This C shell script updates font map which is used by FLoad script.
+#!
+#! Copyright (C) 1994, Basil K. Malyshev. All rights reserved.
+#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+setenv SUBFONT "`which subfont`"
+if ( ! -e "$SUBFONT" ) then
+ echo Can not found SubFont program in path $path
+ exit
+endif
+
+#### Scan all font directories and add records to Fontmap.t1
+# Split FPATH variable into elements
+set pathSave=($path)
+setenv PATH $FONTPATH
+set fpath=($path)
+set path=($pathSave)
+# Now go throght all font directories
+echo >$lib/Fontmap.t1
+foreach root ($fpath)
+ echo "Scanning $root directory..."
+ echo "%% This part was constructed from $root directory" >>$lib/Fontmap.t1
+ pushd root
+ find . -name "*.pf[ab]" -exec $SUBFONT -z$lib/Fontmap.t1 {} \;
+ popd
+end
+###
+
diff --git a/fonts/utilities/fontload/unix/fload.csh b/fonts/utilities/fontload/unix/fload.csh
new file mode 100644
index 0000000000..92f670ef84
--- /dev/null
+++ b/fonts/utilities/fontload/unix/fload.csh
@@ -0,0 +1,140 @@
+#!
+#! File: FLoad.csh
+#! This C shell script implements partial downloading
+#! of the ATM compatible PostScript Type 1 fonts which
+#! is used in specified PostScript file.
+#! This procedure is done via GhostScript & SubFont programs.
+#!
+#! Copyright (C) 1994, Basil K. Malyshev. All rights reserved.
+#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+set FontMap=$lib/Fontmap.t1
+
+# User can place in HOME directory file '.fload'
+# which can contains redefinition of the FONTPATH, like
+# setenv FONTPATH $FONTPATH:$HOME/psfonts
+# and FontMap, like:
+# set FontMap=$HOME/Fontmap.t1
+# Also, user can redefine `lib` variable,
+# but in this case, also redefinion of the 'FontMap` variable is required.
+#
+if ( -e ~/.fload ) then
+ source ~/.fload
+endif
+
+# Check of the existance GhostScript (gs) and SubFont (subfont) programs.
+if ( ! -e "`which gs`" ) then
+ echo "? FLoad: I can not work without GhostScript." | /bin/sh -c "cat 1>&2"
+ exit
+endif
+if ( ! -e "`which subfont`" ) then
+ echo "? FLoad: I can not work without subfont program." | /bin/sh -c "cat 1>&2"
+ exit
+endif
+
+# Update map if specified option '-updatemap'
+if ( "$1" == "-updatemap" ) then
+ # Split FONTPATH variable into elements
+ set pathSave=($path)
+ setenv PATH $FONTPATH
+ set fpath=($path)
+ set path=($pathSave)
+ # Now go throght all font directories
+ echo >$FontMap
+ foreach root ($fpath)
+ echo "Scanning $root directory..."
+ echo "%% This part was constructed from $root directory" >>$FontMap
+ pushd root
+ find . -name "*.pf[ab]" -exec subfont -z$FontMap {} \;
+ popd
+ end
+ exit
+endif
+
+# Which font set is in printer
+if ( "$1" == "-p" || "$1" == "-P" ) then
+ if ( "$2" == "" ) then
+ echo "List of available font sets:" | /bin/sh -c "cat 1>&2"
+ cd $lib
+ ls *.FS | sed -e s/.FS// | /bin/sh -c "cat 1>&2"
+ exit
+ endif
+ set fontSet="$2"
+ shift
+ shift
+else
+ set fontSet="Standard"
+endif
+
+if ( ! -e $lib/$fontSet.FS ) then
+ echo "? $fontSet font set is not known." | /bin/sh -c "cat 1>&2"
+ exit
+endif
+
+set fn=$1
+set out=$2
+
+if ( "$out" == "" ) then
+ set base=$fn:r
+else
+ set base=$out:r
+ if ( "$out" == "$out:r" ) then
+ set out=$out.ps
+ endif
+endif
+
+# If input file name is not presented show usage and list of built in fonts.
+if ( "$fn" == "" ) then
+ echo "Usage: (of the fload de Basil)" | /bin/sh -c "cat 1>&2"
+ echo "fload [-p fontSet] <ps-file> [<output-ps-file>]" | /bin/sh -c "cat 1>&2"
+ echo " where following fontSets is available" | /bin/sh -c "cat 1>&2"
+ cd $lib
+ ls *.FS | sed -e s/.FS// | /bin/sh -c "cat 1>&2"
+ exit
+endif
+if ( ! -e $fn ) then
+ echo "? FLoad: I can not found file $fn." | /bin/sh -c "cat 1>&2"
+ exit
+endif
+
+# Interpret file via Ghostscript to determine required fonts and characters.
+set fstat=$base.fstat
+echo "Process PS file $fn." | /bin/sh -c "cat 1>&2"
+echo "Write font using statistic to $fstat" | /bin/sh -c "cat 1>&2"
+if ( -e $fstat ) then
+ /bin/rm -f $fstat
+endif
+gs -I${lib}:$FONTPATH -DNODISPLAY -DWRITESYSTEMDICT \
+ -sOUTFILE=$fstat -sINFILE=$fn \
+ -sRESIDENTFONTS=$fontSet.FS psfstat.ps quit.ps >&$base.flog
+if ( -e $fstat ) then
+ /bin/rm $base.flog
+else
+ echo "There is some errors in scanning PS file." | /bin/sh -c "cat 1>&2"
+ echo "Look GhostScript log file $base.flog for more information" | /bin/sh -c "cat 1>&2"
+ echo "Most frequently error is that some font is not anywhere." | /bin/sh -c "cat 1>&2"
+ exit
+endif
+
+# Began file from conventional metacomment to fit with spooler.
+if ( "$out" == "" ) then
+ echo "%\!PS-Adobe-3.0"
+else
+ echo "Write output into file $out" | /bin/sh -c "cat 1>&2"
+ echo "%\!PS-Adobe-3.0" >$out
+endif
+
+# Make partial downloading of these fonts which is available
+if ( -e $base.undef ) then
+ /bin/rm -f $base.undef
+endif
+if ( "$out" == "" ) then
+ subfont -I$FONTPATH -u$base.undef -m$FontMap -f$fstat -c$fn
+else
+ subfont -I$FONTPATH -u$base.undef -m$FontMap -f$fstat -c$fn >>$out
+endif
+if ( -e $base.undef ) then
+ echo "There is unknown font(s)" | /bin/sh -c "cat 1>&2"
+ cat $base.undef | /bin/sh -c "cat 1>&2"
+endif
+###
diff --git a/fonts/utilities/fontload/unix/home.dirs b/fonts/utilities/fontload/unix/home.dirs
new file mode 100644
index 0000000000..96c64d7cb4
--- /dev/null
+++ b/fonts/utilities/fontload/unix/home.dirs
@@ -0,0 +1,15 @@
+# CHECK THIS DIRECTORIES FIRST !!
+
+# Directory to put system dependent executable files (subfont program)
+setenv FBIN ~/bin
+
+# Directory to put system independent scripts (fload C-shell script)
+setenv FSHR ~/bin
+
+# Directory for library files (psfstat.ps, Fontmap, SubFont.map, mprint.*)
+setenv FLIB ~/lib/fload
+
+# Also Check that all your fonta are in list of directory tries
+setenv FPATH /usr/local/lib/texmf/fonts:/usr/local/lib/ISOFonts/pfa
+
+###
diff --git a/fonts/utilities/fontload/unix/install.dirs b/fonts/utilities/fontload/unix/install.dirs
new file mode 100644
index 0000000000..f3494986c4
--- /dev/null
+++ b/fonts/utilities/fontload/unix/install.dirs
@@ -0,0 +1,18 @@
+# CHECK THIS DIRECTORIES FIRST !!
+
+# Directory to put system dependent executable files (subfont program)
+setenv FBIN /usr/local/bin
+
+# Directory to put system independent scripts (fload C-shell script)
+setenv FSHR /usr/local/bin
+
+# Directory for library files (psfstat.ps, Fontmap, SubFont.map, mprint.*)
+setenv FLIB /usr/local/lib/fload
+
+# Directory for man pages (this directory may be omitted)
+setenv FMAN /usr/local/man/man1
+
+# Also Check that all your fonts are in list of directory tries
+setenv FPATH /usr/local/lib/texmf/fonts:/usr/local/lib/ISOFonts/pfa
+
+###
diff --git a/fonts/utilities/fontload/unix/install.txt b/fonts/utilities/fontload/unix/install.txt
new file mode 100644
index 0000000000..edc5fc0a9c
--- /dev/null
+++ b/fonts/utilities/fontload/unix/install.txt
@@ -0,0 +1,5 @@
+==== INSTALLATION on UNIX ====
+
+1. Correct directories specified in the 'install.dirs' file.
+2. Run installation script by command: 'csh INSTALL'.
+
diff --git a/fonts/utilities/fontload/unix/mkmap b/fonts/utilities/fontload/unix/mkmap
new file mode 100644
index 0000000000..b012e4e346
--- /dev/null
+++ b/fonts/utilities/fontload/unix/mkmap
@@ -0,0 +1,34 @@
+#!/bin/csh
+#
+# This script is used to create map of the files available in
+# specified tree ...
+#
+if ( "$1" != "-focus" ) then
+ # Temorarie, but normally this program is in path...
+ setenv SUBFONT `pwd`/subfont
+
+ set root=$1
+ if ( "$1" == "" ) then
+ set root="/usr/local/lib/texmf/fonts"
+ endif
+ set CWD=`pwd`
+ if ( -e $CWD/mkmap ) then
+ set itself=$CWD/mkmap
+ else
+ echo Can not found itself when try search in cuurent directory.
+ exit
+ endif
+ echo >SubFont.map
+ echo >Fontmap.t1
+ cd root
+ find . -name "*.pf[ab]" -exec $itself -focus {} $CWD/Fontmap.t1 $CWD/SubFont.map \;
+else
+ set fn=$2
+ set gsmap=$3
+ set sfmap=$4
+ set font=`$SUBFONT $fn | grep /FontName | cut -d/ -f3 | cut '-d ' -f1`
+ echo font /$font/ in file /$fn/
+ echo "$font $fn" >>$sfmap
+ echo "/$font ($fn) ;" >>$gsmap
+endif
+####
diff --git a/fonts/utilities/fontload/unix/ppd2fs b/fonts/utilities/fontload/unix/ppd2fs
new file mode 100644
index 0000000000..ff48ce8ff3
--- /dev/null
+++ b/fonts/utilities/fontload/unix/ppd2fs
@@ -0,0 +1,13 @@
+#!/bin/csh
+# File: ppd2fs
+# This simple C-Shell script extracts font set declared in PPD file.
+# PPD (PostScript(R) Printer Description) file for particular printer
+# anyone can extract
+# from the '/pub/adobe/PPD/win' directory of the 'ftp.adobe.com' host.
+# So, PPD-file for the 'HP LaserJet IIIP PostScript Plus' is hplj_3p1.ppd.
+# This printer contains 35 builtin fonts. List of fonts can be extracted
+# by command:
+# ppd2fs hplj_3p1.ppd >hplj_3p1.FontSet
+#
+grep "^\*Font" $1 | cut "-d " -f2 | cut -d: -f1
+###
diff --git a/fonts/utilities/fontload/unix/usr-local.dirs b/fonts/utilities/fontload/unix/usr-local.dirs
new file mode 100644
index 0000000000..d37c3f4f05
--- /dev/null
+++ b/fonts/utilities/fontload/unix/usr-local.dirs
@@ -0,0 +1,15 @@
+# CHECK THIS DIRECTORIES FIRST !!
+
+# Directory to put system dependent executable files (subfont program)
+setenv FBIN /usr/local/bin
+
+# Directory to put system independent scripts (fload C-shell script)
+setenv FSHR /usr/local/bin
+
+# Directory for library files (psfstat.ps, Fontmap, SubFont.map, mprint.*)
+setenv FLIB /usr/local/lib/fload
+
+# Also Check that all your fonta are in list of directory tries
+setenv FPATH /usr/local/lib/texmf/fonts:/usr/local/lib/ISOFonts/pfa
+
+###
diff --git a/fonts/utilities/fontload/vms/fload.com b/fonts/utilities/fontload/vms/fload.com
new file mode 100644
index 0000000000..6b78690d97
--- /dev/null
+++ b/fonts/utilities/fontload/vms/fload.com
@@ -0,0 +1,122 @@
+$!
+$! File: FLoad.com
+$! This VMS command file implements partial downloading
+$! of the ATM compatible PostScript Type 1 fonts which
+$! is used in specified PostScript file.
+$! This procedure is done via GhostScript & SubFont programs.
+$!
+$! Copyright (C) 1994, Basil K. Malyshev. All rights reserved.
+$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+$! Customize this variables...
+$ gs="$usr_local:[exe]gs.exe"
+$ define/nolog gs_path usr_local:[lib.gs]
+$ define/nolog font_path disk$et:[tex.newtex.xps],disk$et:[tex.newtex.ps]
+$! SubFont must be defined erlier ...
+$! subfont=="$disk$et:[texmgr.bkm.fload.src]subfont.exe"
+$! Which font set is in printer
+$ fontSet="Standard"
+$!
+$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+$ cf = F$ENV("PROCEDURE")
+$ root=f$parse(cf,,,"DEVICE") + f$parse(cf,,,"DIRECTORY")
+$ define/nolog fload_lib 'root'
+$ define/nolog fload_path fload_lib,font_path,gs_path
+$!
+$ echo="write sys$output"
+$!
+$! Recompute map on switch '-updatemap'
+$ if ( P1 .eqs. "-updatemap" .or. P1 .eqs. "-UPDATEMAP" )
+$ then
+$ open/write lun fontmap.t1
+$ write lun " "
+$ close lun
+$ list_loop:
+$ tmp = f$sear("font_path:*.*")
+$ if tmp .eqs. "" then goto list_end
+$ type = f$par(tmp,,,"TYPE")
+$ if ( type .eqs. ".PFB" .or. type .eqs. ".PFA" )
+$ then
+$ fname=f$par(tmp,,,"NAME") + type
+$ write sys$output "Process " + tmp
+$ subfont -zFontmap.t1 font_path:'fname'
+$ endif
+$ goto list_loop
+$ list_end:
+$ exit
+$ endif
+$!
+$! Check all required arguments is in command line
+$ if ( P1 .eqs. "-P" )
+$ then
+$ if ( P2 .eqs. "" )
+$ then
+$ echo "There are following font sets:"
+$ direct_dcl fload_lib:*.FS
+$ exit
+$ endif
+$ fontSet=P2
+$ ifn=P3
+$ out=P4
+$ else
+$ ifn=P1
+$ out=P2
+$ endif
+$ if ( f$sear("fload_lib:"+fontSet+".FS") .eqs. "" )
+$ then
+$ echo "? "+fontSet+" font set is not known."
+$ exit
+$ endif
+$! If input file name is not presented show usage and list of built in fonts.
+$ if "''ifn'" .eqs. "" .or. "''out'" .eqs. ""
+$ then
+ $ echo "Usage: (of the fload de Basil/VMS version)"
+ $ echo "fload [-p <fontset>] <input-ps-file> <output-ps-file>"
+ $ exit
+$ endif
+$! Check file existance, and make full file name
+$ fn = f$search(ifn)
+$ if fn .eqs. ""
+$ then
+ $ echo "? FLoad: Can not found file "+ifn
+ $ exit
+$ endif
+
+$! Interpret file via Ghostscript to determine required fonts and characters.
+$!fbase=f$parse(fn,,,"DEVICE")+f$parse(fn,,,"DIRECTORY")+f$parse(fn,,,"NAME")
+$ fbase=f$parse(out,,,"DEVICE")+f$parse(out,,,"DIRECTORY")+f$parse(out,,,"NAME")
+$ out=fbase+f$parse(out,,,"TYPE")
+$ if out .eqs. fbase+"." then $ out=fbase+".ps"
+$ fstat=fbase+".fstat"
+$ echo "Process PS file "+fn+"."
+$ echo "Write font using statistic to "+fstat
+$ if f$search(fstat) .nes. "" then $ delete_command/nolog 'fstat';*
+$ define/user gs_lib fload_path:
+$ define/user sys$output 'fbase'.flog
+$ gs "-DNODISPLAY" "-DWRITESYSTEMDICT" "-sOUTFILE=''fstat'" -
+ "-sRESIDENTFONTS=''fontSet'.FS" "-sINFILE=''fn'" psfstat.ps
+$ if f$search(fstat) .eqs. ""
+$ then
+ $ echo "? FLOAD EROOR: There is some errors in scanning PS file."
+ $ echo "! Look GhostScript log file "+fbase+".flog for more information"
+ $ echo "! Most frequently error is that some font is not anywhere."
+ $ exit
+$ else
+$ delete_dcl/nolog 'fbase'.flog;
+$ delete_dcl/nolog 'fstat';-1
+$ endif
+
+$ echo "Writing main output PS file: "+out
+$ open/write outfd 'out'
+$ write outfd "%!PS-Adobe-3.0"
+$ close outfd
+$! Make partial downloading of these fonts which is available
+$ if f$search(fbase+".undef") .nes. "" then $ delete_cmd/nolog 'fbase'.undef;*
+$ subfont -I,FONT_PATH: -u'fbase'.undef -mFLOAD_LIB:Fontmap.t1 -a'out' -f'fstat' -c 'fn'
+$ if f$search(fbase+".undef") .nes. ""
+$ then
+ $ echo "There is fonts which is not found by SubFont program."
+ $ echo "That is fonts:"
+ $ type_dcl 'fbase'.undef
+ $ echo "This list is also saved in file "+fbase+".undef"
+$ endif
+$ exit
diff --git a/fonts/utilities/fontload/vms/fontmap.t1 b/fonts/utilities/fontload/vms/fontmap.t1
new file mode 100644
index 0000000000..1c7ac09727
--- /dev/null
+++ b/fonts/utilities/fontload/vms/fontmap.t1
@@ -0,0 +1,254 @@
+
+/cmb10 (font_path:cmb10.pfb) ;
+/cmbsy10 (font_path:cmbsy10.pfb) ;
+/cmbsy6 (font_path:cmbsy6.pfb) ;
+/cmbsy7 (font_path:cmbsy7.pfb) ;
+/cmbsy8 (font_path:cmbsy8.pfb) ;
+/cmbsy9 (font_path:cmbsy9.pfb) ;
+/cmbx10 (font_path:cmbx10.pfb) ;
+/cmbx12 (font_path:cmbx12.pfb) ;
+/cmbx5 (font_path:cmbx5.pfb) ;
+/cmbx6 (font_path:cmbx6.pfb) ;
+/cmbx7 (font_path:cmbx7.pfb) ;
+/cmbx8 (font_path:cmbx8.pfb) ;
+/cmbx9 (font_path:cmbx9.pfb) ;
+/cmbxsl10 (font_path:cmbxsl10.pfb) ;
+/cmbxti10 (font_path:cmbxti10.pfb) ;
+/cmcsc10 (font_path:cmcsc10.pfb) ;
+/cmcsc8 (font_path:cmcsc8.pfb) ;
+/cmcsc9 (font_path:cmcsc9.pfb) ;
+/cmdunh10 (font_path:cmdunh10.pfb) ;
+/cmex10 (font_path:cmex10.pfb) ;
+/cmex7 (font_path:cmex7.pfb) ;
+/cmex8 (font_path:cmex8.pfb) ;
+/cmex9 (font_path:cmex9.pfb) ;
+/cmff10 (font_path:cmff10.pfb) ;
+/cmfi10 (font_path:cmfi10.pfb) ;
+/cmfib8 (font_path:cmfib8.pfb) ;
+/cminch (font_path:cminch.pfb) ;
+/cmitt10 (font_path:cmitt10.pfb) ;
+/cmmi10 (font_path:cmmi10.pfb) ;
+/cmmi12 (font_path:cmmi12.pfb) ;
+/cmmi5 (font_path:cmmi5.pfb) ;
+/cmmi6 (font_path:cmmi6.pfb) ;
+/cmmi7 (font_path:cmmi7.pfb) ;
+/cmmi8 (font_path:cmmi8.pfb) ;
+/cmmi9 (font_path:cmmi9.pfb) ;
+/cmmib10 (font_path:cmmib10.pfb) ;
+/cmmib6 (font_path:cmmib6.pfb) ;
+/cmmib7 (font_path:cmmib7.pfb) ;
+/cmmib8 (font_path:cmmib8.pfb) ;
+/cmmib9 (font_path:cmmib9.pfb) ;
+/cmr10 (font_path:cmr10.pfb) ;
+/cmr12 (font_path:cmr12.pfb) ;
+/cmr17 (font_path:cmr17.pfb) ;
+/cmr5 (font_path:cmr5.pfb) ;
+/cmr6 (font_path:cmr6.pfb) ;
+/cmr7 (font_path:cmr7.pfb) ;
+/cmr8 (font_path:cmr8.pfb) ;
+/cmr9 (font_path:cmr9.pfb) ;
+/cmsl10 (font_path:cmsl10.pfb) ;
+/cmsl12 (font_path:cmsl12.pfb) ;
+/cmsl8 (font_path:cmsl8.pfb) ;
+/cmsl9 (font_path:cmsl9.pfb) ;
+/cmsltt10 (font_path:cmsltt10.pfb) ;
+/cmss10 (font_path:cmss10.pfb) ;
+/cmss12 (font_path:cmss12.pfb) ;
+/cmss17 (font_path:cmss17.pfb) ;
+/cmss8 (font_path:cmss8.pfb) ;
+/cmss9 (font_path:cmss9.pfb) ;
+/cmssbx10 (font_path:cmssbx10.pfb) ;
+/cmssdc10 (font_path:cmssdc10.pfb) ;
+/cmssi10 (font_path:cmssi10.pfb) ;
+/cmssi12 (font_path:cmssi12.pfb) ;
+/cmssi17 (font_path:cmssi17.pfb) ;
+/cmssi8 (font_path:cmssi8.pfb) ;
+/cmssi9 (font_path:cmssi9.pfb) ;
+/cmssq8 (font_path:cmssq8.pfb) ;
+/cmssqi8 (font_path:cmssqi8.pfb) ;
+/cmsy10 (font_path:cmsy10.pfb) ;
+/cmsy5 (font_path:cmsy5.pfb) ;
+/cmsy6 (font_path:cmsy6.pfb) ;
+/cmsy7 (font_path:cmsy7.pfb) ;
+/cmsy8 (font_path:cmsy8.pfb) ;
+/cmsy9 (font_path:cmsy9.pfb) ;
+/cmtcsc10 (font_path:cmtcsc10.pfb) ;
+/cmtex10 (font_path:cmtex10.pfb) ;
+/cmtex8 (font_path:cmtex8.pfb) ;
+/cmtex9 (font_path:cmtex9.pfb) ;
+/cmti10 (font_path:cmti10.pfb) ;
+/cmti12 (font_path:cmti12.pfb) ;
+/cmti7 (font_path:cmti7.pfb) ;
+/cmti8 (font_path:cmti8.pfb) ;
+/cmti9 (font_path:cmti9.pfb) ;
+/cmtt10 (font_path:cmtt10.pfb) ;
+/cmtt12 (font_path:cmtt12.pfb) ;
+/cmtt8 (font_path:cmtt8.pfb) ;
+/cmtt9 (font_path:cmtt9.pfb) ;
+/cmu10 (font_path:cmu10.pfb) ;
+/cmvtt10 (font_path:cmvtt10.pfb) ;
+/cmb10 (font_path:cmb10.pfa) ;
+/cmbsy10 (font_path:cmbsy10.pfa) ;
+/cmbx10 (font_path:cmbx10.pfa) ;
+/cmbx12 (font_path:cmbx12.pfa) ;
+/cmbx5 (font_path:cmbx5.pfa) ;
+/cmbx6 (font_path:cmbx6.pfa) ;
+/cmbx7 (font_path:cmbx7.pfa) ;
+/cmbx8 (font_path:cmbx8.pfa) ;
+/cmbx9 (font_path:cmbx9.pfa) ;
+/cmbxsl10 (font_path:cmbxsl10.pfa) ;
+/cmbxti10 (font_path:cmbxti10.pfa) ;
+/cmcb10 (font_path:cmcb10.pfa) ;
+/cmcbx10 (font_path:cmcbx10.pfa) ;
+/cmcbx12 (font_path:cmcbx12.pfa) ;
+/cmcbx5 (font_path:cmcbx5.pfa) ;
+/cmcbx6 (font_path:cmcbx6.pfa) ;
+/cmcbx7 (font_path:cmcbx7.pfa) ;
+/cmcbx8 (font_path:cmcbx8.pfa) ;
+/cmcbx9 (font_path:cmcbx9.pfa) ;
+/cmcbxsl10 (font_path:cmcbxsl1.pfa) ;
+/cmcbxti10 (font_path:cmcbxti1.pfa) ;
+/cmccsc10 (font_path:cmccsc10.pfa) ;
+/cmccsc8 (font_path:cmccsc8.pfa) ;
+/cmccsc9 (font_path:cmccsc9.pfa) ;
+/cmcitt10 (font_path:cmcitt10.pfa) ;
+/cmcsc10 (font_path:cmcsc10.pfa) ;
+/cmcsc8 (font_path:cmcsc8.pfa) ;
+/cmcsc9 (font_path:cmcsc9.pfa) ;
+/cmcsl10 (font_path:cmcsl10.pfa) ;
+/cmcsl12 (font_path:cmcsl12.pfa) ;
+/cmcsl8 (font_path:cmcsl8.pfa) ;
+/cmcsl9 (font_path:cmcsl9.pfa) ;
+/cmcsltt10 (font_path:cmcsltt1.pfa) ;
+/cmcss10 (font_path:cmcss10.pfa) ;
+/cmcss12 (font_path:cmcss12.pfa) ;
+/cmcss17 (font_path:cmcss17.pfa) ;
+/cmcss8 (font_path:cmcss8.pfa) ;
+/cmcss9 (font_path:cmcss9.pfa) ;
+/cmcssbx10 (font_path:cmcssbx1.pfa) ;
+/cmcssdc10 (font_path:cmcssdc1.pfa) ;
+/cmcssi10 (font_path:cmcssi10.pfa) ;
+/cmcssi12 (font_path:cmcssi12.pfa) ;
+/cmcssi17 (font_path:cmcssi17.pfa) ;
+/cmcssi8 (font_path:cmcssi8.pfa) ;
+/cmcssi9 (font_path:cmcssi9.pfa) ;
+/cmcssq8 (font_path:cmcssq8.pfa) ;
+/cmcssqi8 (font_path:cmcssqi8.pfa) ;
+/cmcti10 (font_path:cmcti10.pfa) ;
+/cmcti12 (font_path:cmcti12.pfa) ;
+/cmcti7 (font_path:cmcti7.pfa) ;
+/cmcti8 (font_path:cmcti8.pfa) ;
+/cmcti9 (font_path:cmcti9.pfa) ;
+/cmctt10 (font_path:cmctt10.pfa) ;
+/cmctt12 (font_path:cmctt12.pfa) ;
+/cmctt8 (font_path:cmctt8.pfa) ;
+/cmctt9 (font_path:cmctt9.pfa) ;
+/cmcu10 (font_path:cmcu10.pfa) ;
+/cmcyr10 (font_path:cmcyr10.pfa) ;
+/cmcyr12 (font_path:cmcyr12.pfa) ;
+/cmcyr17 (font_path:cmcyr17.pfa) ;
+/cmcyr5 (font_path:cmcyr5.pfa) ;
+/cmcyr6 (font_path:cmcyr6.pfa) ;
+/cmcyr7 (font_path:cmcyr7.pfa) ;
+/cmcyr8 (font_path:cmcyr8.pfa) ;
+/cmcyr9 (font_path:cmcyr9.pfa) ;
+/cmdunh10 (font_path:cmdunh10.pfa) ;
+/cmex10 (font_path:cmex10.pfa) ;
+/cmff10 (font_path:cmff10.pfa) ;
+/cmfi10 (font_path:cmfi10.pfa) ;
+/cmfib8 (font_path:cmfib8.pfa) ;
+/cminch (font_path:cminch.pfa) ;
+/cmitt10 (font_path:cmitt10.pfa) ;
+/cmmi10 (font_path:cmmi10.pfa) ;
+/cmmi12 (font_path:cmmi12.pfa) ;
+/cmmi5 (font_path:cmmi5.pfa) ;
+/cmmi6 (font_path:cmmi6.pfa) ;
+/cmmi7 (font_path:cmmi7.pfa) ;
+/cmmi8 (font_path:cmmi8.pfa) ;
+/cmmi9 (font_path:cmmi9.pfa) ;
+/cmmib10 (font_path:cmmib10.pfa) ;
+/cmr10 (font_path:cmr10.pfa) ;
+/cmr12 (font_path:cmr12.pfa) ;
+/cmr17 (font_path:cmr17.pfa) ;
+/cmr5 (font_path:cmr5.pfa) ;
+/cmr6 (font_path:cmr6.pfa) ;
+/cmr7 (font_path:cmr7.pfa) ;
+/cmr8 (font_path:cmr8.pfa) ;
+/cmr9 (font_path:cmr9.pfa) ;
+/cmsl10 (font_path:cmsl10.pfa) ;
+/cmsl12 (font_path:cmsl12.pfa) ;
+/cmsl8 (font_path:cmsl8.pfa) ;
+/cmsl9 (font_path:cmsl9.pfa) ;
+/cmsltt10 (font_path:cmsltt10.pfa) ;
+/cmss10 (font_path:cmss10.pfa) ;
+/cmss12 (font_path:cmss12.pfa) ;
+/cmss17 (font_path:cmss17.pfa) ;
+/cmss8 (font_path:cmss8.pfa) ;
+/cmss9 (font_path:cmss9.pfa) ;
+/cmssbx10 (font_path:cmssbx10.pfa) ;
+/cmssdc10 (font_path:cmssdc10.pfa) ;
+/cmssi10 (font_path:cmssi10.pfa) ;
+/cmssi12 (font_path:cmssi12.pfa) ;
+/cmssi17 (font_path:cmssi17.pfa) ;
+/cmssi8 (font_path:cmssi8.pfa) ;
+/cmssi9 (font_path:cmssi9.pfa) ;
+/cmssq8 (font_path:cmssq8.pfa) ;
+/cmssqi8 (font_path:cmssqi8.pfa) ;
+/cmsy10 (font_path:cmsy10.pfa) ;
+/cmsy5 (font_path:cmsy5.pfa) ;
+/cmsy6 (font_path:cmsy6.pfa) ;
+/cmsy7 (font_path:cmsy7.pfa) ;
+/cmsy8 (font_path:cmsy8.pfa) ;
+/cmsy9 (font_path:cmsy9.pfa) ;
+/cmtcsc10 (font_path:cmtcsc10.pfa) ;
+/cmtex10 (font_path:cmtex10.pfa) ;
+/cmtex8 (font_path:cmtex8.pfa) ;
+/cmtex9 (font_path:cmtex9.pfa) ;
+/cmti10 (font_path:cmti10.pfa) ;
+/cmti12 (font_path:cmti12.pfa) ;
+/cmti7 (font_path:cmti7.pfa) ;
+/cmti8 (font_path:cmti8.pfa) ;
+/cmti9 (font_path:cmti9.pfa) ;
+/cmtt10 (font_path:cmtt10.pfa) ;
+/cmtt12 (font_path:cmtt12.pfa) ;
+/cmtt8 (font_path:cmtt8.pfa) ;
+/cmtt9 (font_path:cmtt9.pfa) ;
+/cmu10 (font_path:cmu10.pfa) ;
+/cmvtt10 (font_path:cmvtt10.pfa) ;
+/euex10 (font_path:euex10.pfa) ;
+/eufb10 (font_path:eufb10.pfa) ;
+/eufb5 (font_path:eufb5.pfa) ;
+/eufb7 (font_path:eufb7.pfa) ;
+/eufm10 (font_path:eufm10.pfa) ;
+/eufm5 (font_path:eufm5.pfa) ;
+/eufm7 (font_path:eufm7.pfa) ;
+/eurb10 (font_path:eurb10.pfa) ;
+/eurb5 (font_path:eurb5.pfa) ;
+/eurb7 (font_path:eurb7.pfa) ;
+/eurm10 (font_path:eurm10.pfa) ;
+/eurm5 (font_path:eurm5.pfa) ;
+/eurm7 (font_path:eurm7.pfa) ;
+/eusb10 (font_path:eusb10.pfa) ;
+/eusb5 (font_path:eusb5.pfa) ;
+/eusb7 (font_path:eusb7.pfa) ;
+/eusm10 (font_path:eusm10.pfa) ;
+/eusm5 (font_path:eusm5.pfa) ;
+/eusm7 (font_path:eusm7.pfa) ;
+/lasy10 (font_path:lasy10.pfa) ;
+/lasy5 (font_path:lasy5.pfa) ;
+/lasy6 (font_path:lasy6.pfa) ;
+/lasy7 (font_path:lasy7.pfa) ;
+/lasy8 (font_path:lasy8.pfa) ;
+/lasy9 (font_path:lasy9.pfa) ;
+/lasyb10 (font_path:lasyb10.pfa) ;
+/lcircle10 (font_path:lcircle1.pfa) ;
+/lcirclew10 (font_path:lcirclew.pfa) ;
+/line10 (font_path:line10.pfa) ;
+/linew10 (font_path:linew10.pfa) ;
+/logo10 (font_path:logo10.pfa) ;
+/logo8 (font_path:logo8.pfa) ;
+/logo9 (font_path:logo9.pfa) ;
+/logobf10 (font_path:logobf10.pfa) ;
+/logosl10 (font_path:logosl10.pfa) ;
+/msam10 (font_path:msam10.pfa) ;
+/msbm10 (font_path:msbm10.pfa) ;
diff --git a/fonts/utilities/fontload/vms/init.com b/fonts/utilities/fontload/vms/init.com
new file mode 100644
index 0000000000..53208b4209
--- /dev/null
+++ b/fonts/utilities/fontload/vms/init.com
@@ -0,0 +1,7 @@
+$!
+$! Determine directory in which all programs are ...
+$ cf = F$ENV("PROCEDURE")
+$ root=f$parse(cf,,,"DEVICE") + f$parse(cf,,,"DIRECTORY")
+$ fload == "@" + root + "fload.com"
+$ subfont == "$" + root + "subfont.exe-" + f$getsy("ARCH_NAME")
+$ exit
diff --git a/fonts/utilities/fontload/vms/install.txt b/fonts/utilities/fontload/vms/install.txt
new file mode 100644
index 0000000000..53e72c7d5b
--- /dev/null
+++ b/fonts/utilities/fontload/vms/install.txt
@@ -0,0 +1,77 @@
+
+To install Partial font downloading utility for VMS make following:
+
+1. Copy system independent file from distribution subdirectory 'lib'
+ into any one directory (For example USER$PLUS:[MINUS]).
+
+2. Copy system dependent files from distribution subdirectory 'vms'
+ into the same directory.
+
+3. Edit head of the file fload.com.
+ Have attension for following items:
+
+ $ gs="$usr_local:[exe]gs.exe"
+ It symbol which must call ghostscript interpreter.
+ Not command file, which call interpreter !
+
+ $ define/nolog gs_path usr_local:[lib.gs]
+ This logical name must refer to directory with standard
+ GhostScript library files.
+
+ $ define/nolog font_path disk$et:[tex.newtex.xps],disk$et:[tex.newtex.ps]
+ This logical name must contains list of directories with
+ fonts which are required by your documents.
+
+ Note, that variable 'fload_lib' is determined automatically.
+ However old versions of VMS system do not supports F$ENV("PROCEDURE")
+ call. In this case you must correct definition of the 'fload_lib'
+ variable.
+
+4. SET DEFAULT USER$PLUS:[MINUS]
+
+5. Issue command
+ $ @INIT.COM
+ This command will define symbols for calling commands 'fload' & 'subfont'
+
+6. Issue command
+ $ FLOAD -updatefontmap
+ This command will scans all fonts in 'font_path' and build map.
+ Map will be saved in file 'Fontmap.t1'.
+
+Currently installation is completed.
+
+System command 'DIR' must shows following :
+
+Directory USER$PLUS:[MINUS]
+
+35.FS;1 2/4 27-JAN-1995 15:16:29.56 (RWED,RWED,RE,RE)
+CVTMAP.PS;1 1/4 27-JAN-1995 15:16:33.52 (RWED,RWED,RE,RE)
+FLOAD.COM;6 9/12 27-JAN-1995 16:37:13.91 (RWED,RWED,RE,RE)
+FONTMAP.T1;2 18/20 27-JAN-1995 16:37:22.75 (RWED,RWED,RE,RE)
+INIT.COM;2 1/4 27-JAN-1995 15:29:28.43 (RWED,RWED,RE,RE)
+INSTALL.TXT;1 6/8 27-JAN-1995 16:43:02.32 (RWED,RWED,RE,RE)
+MAKE.COM;4 1/4 27-JAN-1995 15:39:38.98 (RWED,RWED,RE,RE)
+PSFSTAT.PS;3 26/28 27-JAN-1995 16:18:38.18 (RWED,RWED,RE,RE)
+STANDARD.FS;1 1/4 27-JAN-1995 15:16:32.87 (RWED,RWED,RE,RE)
+SUBFONT.EXE-ALPHA;2
+ 94/96 27-JAN-1995 15:39:58.43 (RWED,RWED,RE,RE)
+SUBFONT.EXE-VAX;2 175/176 27-JAN-1995 15:41:01.54 (RWED,RWED,RE,RE)
+
+Total of 11 files, 333/360 blocks.
+
+To use program one must:
+
+1. issue command
+ $ @USER$PLUS:[MINUS]INIT.COM
+ At start of him session.
+ It will be more conviniently to add this line into user's 'LOGIN.COM'.
+
+2. Issue command
+ fload <source-PS-file> <destination-PS-file>
+ To make PS file with partially preloaded Type1 fonts.
+
+NOTE: Program will preloads only those fonts which are not in your source
+ PS file. So, you must configurate your software so that it will
+ write PS files without font preloading.
+
+Basil K. Malyshev, 27-Jan-1995.
diff --git a/fonts/utilities/fontload/vms/make.com b/fonts/utilities/fontload/vms/make.com
new file mode 100644
index 0000000000..5162ef2837
--- /dev/null
+++ b/fonts/utilities/fontload/vms/make.com
@@ -0,0 +1,11 @@
+$! This file compiles SUBFONT program on VMS system.
+$ arch = f$getsy("ARCH_NAME")
+$ if ( arch .eqs. "Alpha" )
+$ then
+$ cc subfont
+$ link/exe=subfont.exe-Alpha subfont
+$ else
+$ cc subfont
+$ link/exe=subfont.exe-vax subfont,sys$library:vaxcrtl/lib
+$ endif
+$ exit
diff --git a/fonts/utilities/fontload/vms/subfont.exe-alpha b/fonts/utilities/fontload/vms/subfont.exe-alpha
new file mode 100644
index 0000000000..03cc848756
--- /dev/null
+++ b/fonts/utilities/fontload/vms/subfont.exe-alpha
Binary files differ
diff --git a/fonts/utilities/fontload/vms/subfont.exe-vax b/fonts/utilities/fontload/vms/subfont.exe-vax
new file mode 100644
index 0000000000..19f6382972
--- /dev/null
+++ b/fonts/utilities/fontload/vms/subfont.exe-vax
Binary files differ