summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2017-05-12 08:42:31 +0100
committerKen Sharp <ken.sharp@artifex.com>2017-05-13 09:28:56 +0100
commite8750a73313d6083aa949bc5223a26ae55ef02dd (patch)
tree37858b998019be1360aeacb5164a310b2a3377f4 /lib
parent1497d65039885a52b598b137dd8622bd4672f9be (diff)
downloadghostpdl-e8750a73313d6083aa949bc5223a26ae55ef02dd.tar.gz
Renove or modify many files from lib and toolbin that are no longer useful
Remove unused packfile.ps and gs_pfile.ps file from lib -------------------------------------------------------- The PostScript claims to 'Pack groups of files together, with compression, for use in storage-scarce environments.' It also states that it 'must be kept consistent with gs_pfile.ps' which says it is 'Runtime support for minimum-space fonts and packed files' I've never heard of either of these being used, they aren't used in the ROM file system and it seems unlikely these days that there is a great deal of call for minimising file sizes. If these should need to be reinstated, note that they use .setglobal .currentglobal and .computecodes. At the time of this commit these operators were being deprecated and hidden though the C support is retained. If the C code is later removed then these library files will not work. Remove font2c.ps ----------------- If we want to build a font into C and link it, we have the ROM file system in place to do so. This no longer seems useful. remove font2c Remove impath.ps ----------------- The apparent purpose of this code is to take a bitmap (scan ?) of a glyph and turn it into a PostScript type 1 font form, presumably in order to make a font. This doesn't seem hugely useful, and seems to me at least borderline illegal depending on jurisdiction. We also want to remove, or at least disable, the .imagepath operator which this program (and only this program) relies upon. If we ever need to re-instate this program, we will also need to reinstate .imagepath Remove pdfinflt.ps and pdfwrite.ps ----------------------------------- pdfwrite is only (as far as I can see) used by pdfinflt.ps which says: % It is not yet ready for prime time, but it is available for anyone wants % to fix it. % % The main problem is: % % 1. Sometimes the PDF files that are written are broken. When they are % broken, GS gets an xref problem. % % This problem is actually due to lib/pdfwrite.ps since even % when no conversion is done, the file is may be bad. Since it doesn't work, and we can use MuPDF (which does work) for the same task, I've chosen to delete both these files. Remove unprot.ps wrfont.ps --------------------------- unprot.ps 'disables access checks' according to the comments in order to print out eexec-encrypted type 1 fonts. Since this could, presumably be used to read a noaccess dictionary and dump type 1 font outlines it is of dubious legality. (see the comments in wrfont.ps) wrfont.ps is used to decode a type 1 font, we have better tools for decoding fonts so this file seems mostly useless. By the same reasoning we don't need type1ops.ps or type1enc.ps Remove addxchar.ps ------------------- This was used to add extended Latin characters to a font. Our fonts now contain all the standard glyphs that Adobe fonts do, we don't want to go back down the route of adding (and maintaining) poor quality additional glyphs to the fonts. Remove decrypt.ps ------------------ Yet another way to decrypt a type 1 font. In addition to dubious legality we have better ways to do this. Remove pcharstr.ps ------------------- Again, we have better tools for doing this job and the legality of this tool is debatable. Remove markhint.ps ------------------- We believe we now have better tools for dealing with fonts than this. Delete level1.ps ----------------- A fairly pointless file. Remove smoke.ps from toolbin ----------------------------- Our current testing method is much more thorough. Remove bughunt.sh ------------------ A 'user contributed file that has not been kept current', since 1995 apparently. I can't believe this is still useful. Remove pstogsf.bat ------------------- I'm fairly certain this is long defunct. Remove showchar.ps ------------------- another font-related utility, we've deleted the programs it reliee on, so.... Remove wftopfa --------------- Wadalab fonts, given these were uploaded by Werner Lemberg I'm as sure as possible that we don't need these utilities to work with these fonts. Remove markpath.sh ------------------- seems like a moderately pointless file; since it uses flushpage, which I want to hide, remove it. Remove quit.ps --------------- Seriously ? A file which just contains 'quit' ? Modify various of our utilities to not use Ghostscript extension ops --------------------------------------------------------------------- We want to hide various of our extension operators, these files used .devicename, .rectappend, .currentglobal, .setglobal and .namestring Replaced .currentglobal/.setglobal with currenglobal/setglobal Replaced .rectappend with a simple PostScript path Replaced .devicename with currentdevice /Name get Replaced .namestring with 1024 string cvs Remove EndOfTask.ps -------------------- Just a Ctrl-D Remove gs_rdlin.ps ------------------- Linux 'readline' support, just sets prompt to nothing Remove showpage.ps ------------------- just contains 'showpage'!
Diffstat (limited to 'lib')
-rw-r--r--lib/EndOfTask.ps1
-rw-r--r--lib/addxchar.ps356
-rw-r--r--lib/decrypt.ps14
-rwxr-xr-xlib/font2c12
-rwxr-xr-xlib/font2c.bat4
-rwxr-xr-xlib/font2c.cmd6
-rw-r--r--lib/font2c.ps674
-rw-r--r--lib/font2pcl.ps6
-rw-r--r--lib/gs_pfile.ps126
-rw-r--r--lib/gs_rdlin.ps19
-rw-r--r--lib/impath.ps178
-rw-r--r--lib/level1.ps2
-rw-r--r--lib/markhint.ps129
-rw-r--r--lib/markpath.ps58
-rw-r--r--lib/packfile.ps332
-rw-r--r--lib/pcharstr.ps125
-rw-r--r--lib/pdfwrite.ps396
-rwxr-xr-xlib/pftogsf.bat20
-rw-r--r--lib/ps2ascii.ps12
-rw-r--r--lib/quit.ps1
-rw-r--r--lib/showchar.ps92
-rw-r--r--lib/showpage.ps1
-rw-r--r--lib/traceop.ps10
-rw-r--r--lib/type1enc.ps64
-rw-r--r--lib/type1ops.ps236
-rw-r--r--lib/unprot.ps66
-rw-r--r--lib/viewmiff.ps2
-rwxr-xr-xlib/wftopfa12
-rw-r--r--lib/wftopfa.ps302
-rw-r--r--lib/wrfont.ps664
30 files changed, 22 insertions, 3898 deletions
diff --git a/lib/EndOfTask.ps b/lib/EndOfTask.ps
deleted file mode 100644
index ce9a8a9d5..000000000
--- a/lib/EndOfTask.ps
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/lib/addxchar.ps b/lib/addxchar.ps
deleted file mode 100644
index d9027d604..000000000
--- a/lib/addxchar.ps
+++ /dev/null
@@ -1,356 +0,0 @@
-% Copyright (C) 2001-2012 Artifex Software, Inc.
-% All Rights Reserved.
-%
-% This software is provided AS-IS with no warranty, either express or
-% implied.
-%
-% This software is distributed under license and may not be copied,
-% modified or distributed except as expressly authorized under the terms
-% of the license contained in the file LICENSE in this distribution.
-%
-% Refer to licensing information at http://www.artifex.com or contact
-% Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael,
-% CA 94903, U.S.A., +1(415)492-9861, for further information.
-%
-
-% Add the Central European and other Adobe extended Latin characters to a
-% Type 1 font.
-% Requires -dWRITESYSTEMDICT to disable access protection.
-
-(type1ops.ps) runlibfile
-
-% ---------------- Utilities ---------------- %
-
-/addce_dict 50 dict def
-addce_dict begin
-
-% Define the added copyright notice.
-/addednotice (. Portions Copyright (C) 2012 Artifex Software Inc.) def
-
-% Open a font for modification by removing the FID and changing the
-% FontName. Removing UniqueID and XUID is not necessary, since we
-% will only be adding characters.
-/openfont { % <name> <font> openfont <name> <font'>
- dup length dict copy
- dup /FID undef
- dup /FontName 3 index put
-} def
-
-% Do the equivalent of false charpath for a glyph.
-% This should really be an operator!
-/glyphpath { % <glyph> glyphpath -
- currentfont /Encoding get 0 3 -1 roll put
- <00> false charpath
-} def
-
-% Do the equivalent of charpath + pathbbox for a glyph.
-/glyphbbox { % <glyph> glyphbbox <llx> <lly> <urx> <ury>
- % We cache this value, because it's expensive to compute.
- BBoxes 1 index .knownget {
- exch pop
- } {
- gsave newpath 0 0 moveto dup glyphpath [pathbbox] grestore
- BBoxes 3 -1 roll 2 index put
- } ifelse aload pop
-} def
-
-% Get the side bearing and width for a glyph.
-/glyphsbw { % <glyph> glyphsbw <lsbx> <wx>
- % We cache this value, because it's expensive to compute.
- SBW 1 index .knownget {
- exch pop
- } {
- dup glyphcs { dup /hsbw eq { pop exit } if } forall
- 2 array astore
- SBW 3 -1 roll 2 index put
- } ifelse aload pop
-} def
-
-% Get the CharString for a glyph, as an array.
-/glyphcs { % <glyph> glyphcs <array>
- CharStrings exch get
- 4330 exch dup length string .type1decrypt exch pop
- dup length lenIV sub lenIV exch getinterval
- 0 () /SubFileDecode filter [ exch charstack_read ]
-} def
-
-% Find an occurrence of a value in an array.
-/asearch { % <array> <value> asearch <index> true
- % <array> <value> asearch false
- false 0 4 2 roll exch {
- % Stack: false index value element
- 2 copy eq { pop pop exch not exch dup exit } if
- exch 1 add exch
- } forall pop pop
-} def
-
-% Convert an array back to a CharString.
-/csdef { % <glyph> <array> csdef -
- charproc_string
- 4330 exch dup .type1encrypt exch pop readonly
- CharStrings 3 1 roll put
-} def
-
-% Split an accented character name.
-/splitaccented { % <Baccent> splitaccented <Baccent> <B> <accent>
- dup =string cvs
- dup 0 1 getinterval cvn
- exch dup length 1 sub 1 exch getinterval cvn
-} def
-
-% Begin the definition of a 'seac' character.
-% Defines accent, base, abox, bbox.
-% The initial dx lines up the origins of the base and the accent.
-/beginseac { % <bchar> <achar> beginseac
- % -mark- <lsbx> <wx> /hsbw <asb> <dx>
- /accent exch def /base exch def
- /abox [accent glyphbbox] def
- /bbox [base glyphbbox] def
- [ base glyphsbw /hsbw accent glyphsbw pop
- dup 4 index sub
-} def
-
-% Center the accent over the base of a 'seac' character.
-/centeraccent { % <dx> centeraccent <adx>
- bbox 2 get bbox 0 get add 2 div
- abox 2 get abox 0 get add 2 div
- sub add
-} def
-
-% Finish the definition of a 'seac' character.
-/finishseac { % <charname> -mark- ... <adx> <ady> finishseac -
- exch cvi exch cvi
- charindex base get charindex accent get /seac ] csdef
-} def
-
-% ---------------- Main program ---------------- %
-
-% Define accented characters that can be made with seac,
-% with the accent centered over the character.
-/seacchars [
- /Abreve /Amacron
- /Cacute /Ccaron /Dcaron
- /Ecaron /Edotaccent /Emacron
- /Gbreve
- /Idotaccent /Imacron
- /Lacute
- /Nacute /Ncaron
- /Ohungarumlaut /Omacron
- /Racute /Rcaron
- /Sacute /Scedilla
- /Tcaron
- /Uhungarumlaut /Umacron /Uogonek /Uring
- /Zacute /Zdotaccent
- /abreve /amacron
- /cacute /ccaron
- /ecaron /edotaccent /emacron
- /gbreve
- /lacute
- /nacute /ncaron
- /ohungarumlaut /omacron
- /racute /rcaron
- /sacute /scedilla
- /uhungarumlaut /umacron /uring
- /zacute /zdotaccent
-] def
-
-% Define seac characters where the accent lines up with the right
-% edge of the character.
-/seacrightchars [
- /Aogonek /Eogonek /Iogonek /aogonek /eogonek /iogonek /uogonek
-] def
-
-% Define seac characters where the caron becomes an appended quoteright.
-/seaccaronchars [
- /dcaron /lcaron /tcaron
-] def
-
-% Define seac characters using commaaccent.
-/seaccommachars [
- /Gcommaaccent /Kcommaaccent /Lcommaaccent /Ncommaaccent /Rcommaaccent
- /Scommaaccent /Tcommaaccent
- /gcommaaccent /kcommaaccent /lcommaaccent /ncommaaccent /rcommaaccent
- /scommaaccent /tcommaaccent
-] def
-
-% Define the characters copied from the Symbol font.
-/symbolchars [
- /Delta /greaterequal /lessequal /lozenge /notequal /partialdiff
- /summation
-] def
-
-% Define the procedures for editing the commaaccent character.
-% Delete all the hints, since it's too hard to adjust them.
-/caedit mark
- /rmoveto { exch commatop sub cvi exch }
- /hstem { pop pop pop }
- /vstem 1 index
- /callothersubr {
- dup 3 eq { 4 { pop } repeat /skip true def } if
- }
- /pop { skip { pop /skip false def } if }
-.dicttomark def
-
-/addce { % <name> <font> addce <font'>
- 20 dict begin
- /origfont 1 index def
- openfont
- dup /CharStrings 2 copy get dup length dict copy put
- dup /Encoding 2 copy get dup length array copy put
- dup /FontInfo 2 copy get dup length dict copy put
- definefont /font exch def
- currentdict font end begin begin
- font 1000 scalefont setfont
- /symbolfont /Symbol findfont def
- /BBoxes CharStrings length dict def
- /SBW CharStrings length dict def
-
- /italfactor FontInfo /ItalicAngle .knownget {
- neg dup sin exch cos div
- } {
- 0
- } ifelse def
-
- % Invert the Encoding (needed for seac).
-
- /charindex 256 dict def
- 0 1 255 {
- charindex exch Encoding 1 index get exch put
- } for
-
- % Add the commaaccent character, by moving the comma downward.
-
- /comma glyphbbox /commatop exch def pop pop pop
- /comma glyphcs
- /skip false def
- [ exch { caedit 1 index .knownget { exec } if } forall ]
- /commaaccent exch csdef
-
- % Add the accented characters that can be made with seac.
-
- seacchars {
- splitaccented beginseac
- centeraccent
- % If the accent would collide with the base character,
- % raise it a little.
- abox 1 get bbox 3 get sub dup 0 le {
- % ... but not if the accent is in the low position.
- abox 1 get 0 gt {
- neg 60 add
- % Adjust the X position if italic.
- dup italfactor mul 3 -1 roll add exch
- } {
- pop 0
- } ifelse
- } {
- pop 0
- } ifelse
- finishseac
- } forall
-
- seacrightchars {
- splitaccented beginseac
- bbox 2 get abox 2 get sub add % line up right edges
- 0 finishseac
- } forall
-
- /dcroat /d /hyphen beginseac
- bbox 2 get abox 2 get sub add % line up right edges
- 0 finishseac
-
- /imacron /dotlessi /macron beginseac
- centeraccent
- 0 finishseac
-
- /Lcaron /L /quoteright beginseac
- bbox 2 get abox 2 get sub add % line up right edges
- 0 finishseac
-
- seaccaronchars {
- dup =string cvs 0 1 getinterval cvn /quoteright beginseac
- % Move the quote to the right of the character.
- bbox 2 get abox 0 get sub 50 add add
- % Adjust the character width as well.
- 4 -1 roll abox 2 get abox 0 get sub 50 add add cvi 4 1 roll
- 0 finishseac
- } forall
-
- seaccommachars {
- dup =string cvs 0 1 getinterval cvn /comma beginseac
- centeraccent
- commatop neg
- % Lower the accent if the character extends below
- % the baseline
- bbox 1 get 0 .min add
- finishseac
- } forall
-
- % Add the characters from the Symbol font.
- % We should scale them to match the FontBBox, but we don't.
-
- symbolchars {
- symbolfont /CharStrings get 1 index get
- CharStrings 3 1 roll put
- } forall
-
- % Add the one remaining character.
-
- CharStrings /Dcroat CharStrings /Eth get put
-
- % Recompute the FontBBox, since some of the accented characters
- % may have enlarged it.
-
- /llx 1000 def /lly 1000 def /urx 0 def /ury 0 def
- CharStrings {
- pop glyphbbox
- ury .max /ury exch def urx .max /urx exch def
- lly .min /lly exch def llx .min /llx exch def
- } forall
- /FontBBox llx cvi lly cvi urx ceiling cvi ury ceiling cvi 4 packedarray def
-
- % Restore the Encoding and wrap up.
-
- [/Copyright /Notice] {
- FontInfo 1 index .knownget {
- addednotice concatstrings FontInfo 3 1 roll put
- } {
- pop
- } ifelse
- } forall
- FontName font openfont
- dup /Encoding origfont /Encoding get put
- definefont
-
- end end
-} def
-
-currentdict end readonly pop % addce_dict
-
-/addce { addce_dict begin addce end } def
-
-% ---------------- Integration ---------------- %
-
-% We would like to patch the font loader so that it adds the extended
-% Latin characters automatically. We haven't done this yet.
-
-% ---------------- Test program ---------------- %
-
-/TEST where { pop TEST } { false } ifelse {
- /FONT where { pop } { /FONT /Palatino-Italic def } ifelse
- (unprot.ps) runlibfile
- unprot
- (wrfont.ps) runlibfile
- wrfont_dict begin
- /eexec_encrypt true def
- /binary_CharStrings true def
- end
- save
- FONT findfont
- /Latin-CE exch addce setfont
- (t.ce.pfb) (w) file dup writefont closefile
- restore
- (prfont.ps) runlibfile
- (t.ce.pfb) (r) file .loadfont
- /Latin-CE DoFont
- quit
-} if
diff --git a/lib/decrypt.ps b/lib/decrypt.ps
deleted file mode 100644
index 922491828..000000000
--- a/lib/decrypt.ps
+++ /dev/null
@@ -1,14 +0,0 @@
-%!
-% Decrypt an eexec-encoded file.
-
-(t.in) (r) file /in exch def
-(t.out) (w) file /out exch def
-256 string /buf exch def
-55665 % eexec encryption seed
- { in buf readhexstring /more exch def
- dup .type1decrypt out exch writestring
- more not { exit } if
- } loop
-in closefile
-out closefile
-quit
diff --git a/lib/font2c b/lib/font2c
deleted file mode 100755
index e1dd71775..000000000
--- a/lib/font2c
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-# This definition is changed on install to match the
-# executable name set in the makefile
-GS_EXECUTABLE=gs
-gs="`dirname \"$0\"`/$GS_EXECUTABLE"
-if test ! -x "$gs"; then
- gs="$GS_EXECUTABLE"
-fi
-GS_EXECUTABLE="$gs"
-
-exec "$GS_EXECUTABLE" -q -P- -dSAFER -dNODISPLAY -dWRITESYSTEMDICT -- font2c.ps "$@"
diff --git a/lib/font2c.bat b/lib/font2c.bat
deleted file mode 100755
index aee747b8f..000000000
--- a/lib/font2c.bat
+++ /dev/null
@@ -1,4 +0,0 @@
-@echo off
-
-call "%~dp0gssetgs.bat"
-%GSC% -P- -dSAFER -q -dNODISPLAY -dWRITESYSTEMDICT -- font2c.ps %1 %2 %3 %4 %5 %6 %7 %8 %9
diff --git a/lib/font2c.cmd b/lib/font2c.cmd
deleted file mode 100755
index 638710963..000000000
--- a/lib/font2c.cmd
+++ /dev/null
@@ -1,6 +0,0 @@
-/*
- * This file is maintained by a user: if you have any questions about it,
- * please contact Mark Hale (mark.hale@physics.org).
- */
-
-@gsos2 -q -dNODISPLAY -dWRITESYSTEMDICT -- font2c.ps %1 %2 %3 %4 %5 %6 %7 %8 %9
diff --git a/lib/font2c.ps b/lib/font2c.ps
deleted file mode 100644
index dffc24745..000000000
--- a/lib/font2c.ps
+++ /dev/null
@@ -1,674 +0,0 @@
-% Copyright (C) 2001-2012 Artifex Software, Inc.
-% All Rights Reserved.
-%
-% This software is provided AS-IS with no warranty, either express or
-% implied.
-%
-% This software is distributed under license and may not be copied,
-% modified or distributed except as expressly authorized under the terms
-% of the license contained in the file LICENSE in this distribution.
-%
-% Refer to licensing information at http://www.artifex.com or contact
-% Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael,
-% CA 94903, U.S.A., +1(415)492-9861, for further information.
-%
-
-% font2c.ps
-% Write out a PostScript Type 0 or Type 1 font as C code
-% that can be linked with the interpreter.
-% This even works on protected fonts, if you use the -dWRITESYSTEMDICT
-% switch in the command line. The code is reentrant and location-
-% independent and has no external references, so it can be put into
-% a sharable library even on VMS.
-
-/font2cdict 100 dict dup begin
-
-% Define the maximum string length that all compilers will accept.
-% This must be approximately
-% min(max line length, max string literal length) / 4 - 5.
-
-/max_wcs 50 def
-
-% Define a temporary file for writing out procedures.
-/wtempname (_.tmp) def
-
-% ------ Protection utilities ------ %
-
-% Protection values are represented by a mask:
-/a_noaccess 0 def
-/a_executeonly 1 def
-/a_readonly 3 def
-/a_all 7 def
-/prot_names
- [ (0) (a_execute) null (a_readonly) null null null (a_all)
- ] def
-/prot_opers
- [ {noaccess} {executeonly} {} {readonly} {} {} {} {}
- ] def
-
-% Get the protection of an object.
- /getpa
- { dup wcheck
- { pop a_all }
- { % Check for executeonly or noaccess objects in protected.
- dup protected exch known
- { protected exch get }
- { pop a_readonly }
- ifelse
- }
- ifelse
- } bind def
-
-% Get the protection appropriate for (all the) values in a dictionary.
- /getva
- { a_noaccess exch
- { exch pop
- dup type dup /stringtype eq 1 index /arraytype eq or
- exch /packedarraytype eq or
- { getpa a_readonly and or }
- { pop pop a_all exit }
- ifelse
- }
- forall
- } bind def
-
-% Keep track of executeonly and noaccess objects,
-% but don't let the protection actually take effect.
-.currentglobal
-false .setglobal % so protected can reference local objs
-/protected % do first so // will work
- systemdict wcheck { 1500 dict } { 1 dict } ifelse
-def
-systemdict wcheck not
- { (Warning: you will not be able to convert protected fonts.\n) print
- (If you need to convert a protected font, please\n) print
- (restart the program and specify the -dWRITESYSTEMDICT switch.\n) print
- flush
- (%end) .skipeof
- }
-if
-userdict begin
- /executeonly
- { dup //protected exch //a_executeonly put readonly
- } bind def
- /noaccess
- { dup //protected exch //a_noaccess put readonly
- } bind def
-end
-true .setglobal
-systemdict begin
- /executeonly
- { userdict /executeonly get exec
- } bind odef
- /noaccess
- { userdict /noaccess get exec
- } bind odef
-end
-%end
-.setglobal
-
-% ------ Output utilities ------ %
-
-% By convention, the output file is named cfile.
-
-% Define some utilities for writing the output file.
- /wtstring 100 string def
- /wb {cfile exch write} bind def
- /ws {cfile exch writestring} bind def
- /wl {ws (\n) ws} bind def
- /wt {wtstring cvs ws} bind def
-
-% Write a C string. Some compilers have unreasonably small limits on
-% the length of a string literal or the length of a line, so every place
-% that uses wcs must either know that the string is short,
-% or be prepared to use wcca instead.
- /wbx
- { 8#1000 add 8 (0000) cvrs dup 0 (\\) 0 get put ws
- } bind def
- /wcst
- [
- 32 { /wbx load } repeat
- 95 { /wb load } repeat
- 129 { /wbx load } repeat
- ] def
- ("\\) { wcst exch { (\\) ws wb } put } forall
- /wcs
- { (") ws { dup wcst exch get exec } forall (") ws
- } bind def
- /can_wcs % Test if can use wcs
- { length max_wcs le
- } bind def
- /wncs % name -> C string
- { wtstring cvs wcs
- } bind def
-% Write a C string as an array of character values.
-% We only need this because of line and literal length limitations.
- /wca % <string> <prefix> <suffix> wca -
- { 0 4 -2 roll exch
- { % Stack: suffix n prefix char
- exch ws
- exch dup 19 ge { () wl pop 0 } if 1 add
- exch dup 32 ge 1 index 126 le and
- { 39 wb dup 39 eq 1 index 92 eq or { 92 wb } if wb 39 wb }
- { wt }
- ifelse (,)
- } forall
- pop pop ws
- } bind def
- /wcca % <string> wcca -
- { ({\n) (}) wca
- } bind def
-
-% Write object protection attributes. Note that dictionaries and arrays are
-% the only objects that can be writable.
- /wpa
- { dup xcheck { (a_executable|) ws } if
- dup type dup /dicttype eq exch /arraytype eq or
- { getpa }
- { getpa a_readonly and }
- ifelse prot_names exch get ws
- } bind def
- /wva
- { getva prot_names exch get ws
- } bind def
-
-% ------ Object writing ------ %
-
- /wnstring 128 string def
-
-% Convert an object to a string to be scanned at a later time.
- /cvos % <obj> cvos <string>
- { % We'd like to use == and write directly to a string,
- % but we can't do the former because of operators,
- % and we can't do the latter because we can't predict
- % how long the string would have to be....
- wtempname (w) file dup 3 -1 roll wproc closefile
- wtempname status pop pop pop exch pop string
- wtempname (r) file dup 3 -1 roll readstring pop exch closefile
- } bind def
-
-% Write a string/name or null as an element of a string/name/null array.
-% Convert any other kind of value to a token to be read back in.
- /wsn
- { dup null eq
- { pop (\t255,255,) wl
- }
- { dup type /nametype eq { wnstring cvs } if
- dup type /stringtype ne { cvos (255,) ws } if
- dup length 256 idiv wt (,) ws
- dup length 256 mod wt
- (,) (,\n) wca
- }
- ifelse
- } bind def
-% Write a packed string/name/null array.
- /wsna % <name> <(string|name|null)*> wsna -
- { (\tstatic const unsigned char ) ws exch wt ([] = {) wl
- { wsn } forall
- (\t0\n};) wl
- } bind def
-
-% Write a number or an array of numbers, as refs.
-/isnumber
- { type dup /integertype eq exch /realtype eq or
- } bind def
-/wnums
- { dup isnumber
- { (real_v\() ws wt (\),) ws }
- { { wnums } forall }
- ifelse
- } bind def
-
-% Test whether a procedure or unusual array can be written (printed).
-/iswx 4 dict dup begin
- /arraytype { { iswproc } isall } def
- /nametype { pop true } def
- /operatortype { pop true } def % assume it has been bound in
- /packedarraytype /arraytype load def
-end def
-/iswnx 6 dict dup begin
- /arraytype { { iswproc } isall } def
- /integertype { pop true } def
- /nametype { pop true } def
- /realtype { pop true } def
- /stringtype { pop true } def
- /packedarraytype /arraytype load def
-end def
-/iswproc % <obj> iswproc <bool>
- { dup xcheck { iswx } { iswnx } ifelse
- 1 index type .knownget { exec } { pop false } ifelse
- } bind def
-
-% Write a printable procedure (one for which iswproc returns true).
-/wproca 3 dict dup begin
- /arraytype
- { 1 index ({) writestring
- { 1 index ( ) writestring 1 index exch wproc } forall
- (}) writestring
- } bind def
- /packedarraytype /arraytype load def
- /operatortype { .writecvs } bind def % assume binding would work
-end def
-/wproc % <file> <proc> wproc -
- { dup type wproca exch .knownget { exec } { write==only } ifelse
- } bind def
-
-% Write a named object. Return true if this was possible.
-% Legal types are: boolean, integer, name, real, string,
-% array of (integer, integer+real, name, null+string),
-% and certain procedures and other arrays (see iswproc above).
-% All other objects are either handled specially or ignored.
- /isall % <array> <proc> isall <bool>
- { true 3 -1 roll
- { 2 index exec not { pop false exit } if }
- forall exch pop
- } bind def
- /wott 8 dict dup begin
- /arraytype
- { woatt
- { aload pop 2 index 2 index exec
- { exch pop exec exit }
- { pop pop }
- ifelse
- }
- forall
- } bind def
- /booleantype
- { { (\tmake_true\(&) } { (\tmake_false\(&) } ifelse ws
- wt (\);) wl true
- } bind def
- /integertype
- { (\tmake_int\(&) ws exch wt (, ) ws
- wt (\);) wl true
- } bind def
- /nametype
- { (\tcode = (*pprocs->name_create)\(i_ctx_p, &) ws exch wt
- (, ) ws wnstring cvs wcs % OK, names are short
- (\);) wl
- (\tif ( code < 0 ) return code;) wl
- true
- } bind def
- /packedarraytype
- /arraytype load def
- /realtype
- { (\tmake_real\(&) ws exch wt (, (float)) ws
- wt (\);) wl true
- } bind def
- /stringtype
- { ({\tstatic const unsigned char s_[] = ) ws
- dup dup can_wcs { wcs } { wcca } ifelse
- (;) wl
- (\tmake_const_string\(&) ws exch wt
- (, a_readonly, ) ws length wt (, (const byte *)s_\);) wl
- (}) wl true
- } bind def
- end def
-% Write some other kind of object, if known.
- /wother
- { dup otherobjs exch known
- { otherobjs exch get (\t) ws exch wt ( = ) ws wt (;) wl true }
- { pop pop false }
- ifelse
- } bind def
-% Top-level procedure.
- /wo % name obj -> OK
- { dup type wott exch .knownget { exec } { wother } ifelse
- } bind def
-
-% Write an array (called by wo).
- /wap % <name> <array> wap -
- { dup xcheck not 1 index wcheck not and 1 index rcheck and
- { pop pop }
- { (\tr_set_attrs\(&) ws exch wt (, ) ws wpa (\);) wl }
- ifelse
- } bind def
- /wnuma { % <name> <array> <element_C_type> <<type>_v> wnuma -
- ({\tstatic const ref_\() ws exch ws (\) a_[] = {) wl exch
- % Stack: name type_v array
- dup length 0 eq {
- (\t) ws 1 index ws (\(0\)) wl
- } {
- dup {
- (\t) ws 2 index ws (\() ws wt (\),) wl
- } forall
- } ifelse exch pop
- % Stack: name array
- (\t};) wl
- dup wcheck {
- (\tcode = (*pprocs->scalar_array_create)\(i_ctx_p, &) ws exch wt
- (, (const ref *)a_, ) ws dup length wt
- (, ) ws wpa (\);) wl
- (\tif ( code < 0 ) return code;) wl
- } {
- (\tmake_const_array\(&) ws exch wt
- (, avm_foreign|) ws dup wpa (, ) ws length wt
- (, (const ref *)a_\);) wl
- } ifelse
- (}) wl
- } bind def
- /woatt [
- % Integers
- { { { type /integertype eq } isall }
- { (long) (integer_v) wnuma true }
- }
- % Integers + reals
- { { { type dup /integertype eq exch /realtype eq or } isall }
- { (float) (real_v) wnuma true }
- }
- % Strings + nulls
- { { { type dup /nulltype eq exch /stringtype eq or } isall }
- { ({) ws dup (sa_) exch wsna
- (\tcode = (*pprocs->string_array_create)\(i_ctx_p, &) ws exch wt
- (, \(const char *\)sa_, ) ws dup length wt (, ) ws wpa (\);) wl
- (\tif ( code < 0 ) return code;) wl
- (}) wl true
- }
- }
- % Names
- { { { type /nametype eq } isall }
- { ({) ws dup (na_) exch wsna
- (\tcode = (*pprocs->name_array_create)\(i_ctx_p, &) ws 1 index wt
- (, \(const char *\)na_, ) ws dup length wt (\);) wl
- (\tif ( code < 0 ) return code;) wl
- wap (}) wl true
- }
- }
- % Procedure
- { { iswproc }
- { dup cvos
- % Stack: name proc string
- ({\tstatic const unsigned char s_[] = ) ws
- dup dup can_wcs { wcs } { wcca } ifelse
- (;) wl
- (\tcode = (*pprocs->ref_from_string)\(i_ctx_p, &) ws 2 index wt
- (, \(const char *\)s_, ) ws length wt (\);) wl
- (\tif ( code < 0 ) return code;) wl
- wap (}) wl true
- wtempname deletefile
- }
- }
- % Default
- { { pop true }
- { wother }
- }
- ] def
-
-% Write a named dictionary. We assume the ref is already declared.
- /wd % <name> <dict> <extra> wd -
- { 3 1 roll
- ({) ws
- (\tref v_[) ws dup length wt (];) wl
- dup [ exch
- { counttomark 2 sub wtstring cvs
- (v_[) exch concatstrings (]) concatstrings exch wo not
- { (Skipping ) print ==only (....\n) print }
- if
- } forall
- ]
- % Stack: array of keys (names)
- ({) ws dup (str_keys_) exch wsna
- (\tstatic const cfont_dict_keys keys_ =) wl
- (\t { 0, 0, ) ws length wt (, ) ws 3 -1 roll wt (, ) ws
- dup wpa (, ) ws dup wva ( };) wl pop
- (\tcode = \(*pprocs->ref_dict_create\)\(i_ctx_p, &) ws wt
- (, &keys_, \(const char *\)str_keys_, v_\);) wl
- (\tif ( code < 0 ) return code;) wl
- (}) wl
- (}) wl
- } bind def
-
-% Write character dictionary keys.
-% We save a lot of space by abbreviating keys which appear in
-% StandardEncoding or ISOLatin1Encoding.
-% Writes code to declare and initialize enc_keys_, str_keys, and keys_.
-/wcdkeys % <dict> wcdkeys -
- { % Write keys present in StandardEncoding or ISOLatin1Encoding,
- % pushing other keys on the o-stack.
- (static const charindex enc_keys_[] = {) wl
- dup [ exch 0 exch
- { pop decoding 1 index known
- { decoding exch get ({) ws dup -8 bitshift wt
- (,) ws 255 and wt (}, ) ws
- 1 add dup 5 mod 0 eq { (\n) ws } if
- }
- { exch }
- ifelse
- }
- forall pop
- ]
- ({0,0}\n};) wl
- % Write other keys.
- (str_keys_) exch wsna
- % Write the declaration for keys_.
- (static const cfont_dict_keys keys_ = {) wl
- (\tenc_keys_, countof\(enc_keys_\) - 1,) wl
- (\t) ws dup length wt ( - \(countof\(enc_keys_\) - 1\), 0, ) ws
- dup wpa (, ) ws wva () wl
- (};) wl
- } bind def
-
-% Enumerate character dictionary values in the same order that
-% the keys appear in enc_keys_ and str_keys_.
-% <proc> is called with each value in turn.
-/cdforall % <dict> <proc> cdforall -
- { 2 copy
- { decoding 3 index known
- { 3 -1 roll pop exec }
- { pop pop pop }
- ifelse
- }
- /exec cvx 3 packedarray cvx
- /forall cvx
- 5 -2 roll
- { decoding 3 index known
- { pop pop pop }
- { 3 -1 roll pop exec }
- ifelse
- }
- /exec cvx 3 packedarray cvx
- /forall cvx
- 6 packedarray cvx exec
- } bind def
-
-% ------ Writers for special objects ------ %
-
-/writespecial 10 dict dup begin
-
- /FontInfo { 0 wd } def
-
- /Private { 0 wd } def
-
- /CharStrings
- { ({) wl
- dup wcdkeys
- (static const unsigned char values_[] = {) wl
- { wsn } cdforall
- (\t0\n};) wl
- (\tcode = \(*pprocs->string_dict_create\)\(i_ctx_p, &) ws wt
- (, &keys_, (const char *)str_keys_, \(const char *\)values_\);) wl
- (\tif ( code < 0 ) return code;) wl
- (}) wl
- } bind def
-
- /Metrics
- { ({) wl
- dup wcdkeys
- (static const ref_(float) values_[] = {) wl
- dup { (\t) ws wnums () wl } cdforall
- (\t0\n};) wl
- (static const unsigned char lengths_[] = {) wl
- { (\t) ws dup isnumber
- { pop 0 }
- { length 1 add }
- ifelse wt (,) wl
- } cdforall
- (\t0\n};) wl
- (\tcode = \(*pprocs->num_dict_create\)\(i_ctx_p, &) ws wt
- (, &keys_, str_keys_, (const ref *)values_, lengths_\);) wl
- (\tif ( code < 0 ) return code;) wl
- (}) wl
- } bind def
-
- /Metrics2 /Metrics load def
-
- /FDepVector pop % (converted to a list of font names)
-
-end def
-
-% ------ The main program ------ %
-
-% Construct an inverse dictionary of encodings.
-[ /StandardEncoding /ISOLatin1Encoding
- /SymbolEncoding /DingbatsEncoding
- /KanjiSubEncoding
-]
-dup length dict begin
- { mark exch dup { .findencoding exch def } stopped cleartomark
- } forall
-currentdict end /encodingnames exch def
-
-% Invert the StandardEncoding and ISOLatin1Encoding vectors.
-512 dict begin
- 0 1 255 { dup ISOLatin1Encoding exch get exch 256 add def } for
- 0 1 255 { dup StandardEncoding exch get exch def } for
-currentdict end /decoding exch def
-
-/writefont % cfilename procname -> [writes the current font]
- { (gsf_) exch concatstrings
- /fontprocname exch def
- /cfname exch def
- /cfile cfname (w) file def
-
-% Remove unwanted keys from the font.
- currentfont dup length dict begin { def } forall
- { /FID /MIDVector /CurMID } { currentdict exch undef } forall
- /Font currentdict end def
-
-% Replace the FDepVector with a list of font names.
- Font /FDepVector .knownget
- { [ exch { /FontName get } forall ]
- Font /FDepVector 3 -1 roll put
- }
- if
-
-% Find all the special objects we know about.
-% wo uses this to write out references to otherwise intractable objects.
- /otherobjs writespecial length dict dup begin
- writespecial
- { pop Font 1 index .knownget { exch def } { pop } ifelse
- }
- forall
- end def
-
-% Define a dummy FontInfo, in case the font doesn't have one.
- /FontInfo 0 dict def
-
-% Write out the boilerplate.
- Font begin
- (/****************************************************************) wl
- ( Portions of this file are subject to the following notice(s):) wl
- systemdict /copyright get wl
- FontInfo /Notice .knownget
- { (----------------------------------------------------------------) wl wl
- } if
- (****************************************************************/) wl
- () wl
- (/* ) ws cfname ws ( */) wl
- (/* This file was created by the ) ws product ws ( font2c utility. */) wl
- () wl
- (#undef DEBUG) wl
- (#include "ccfont.h") wl
- () wl
-
-% Write the procedure prologue.
- (#ifdef __PROTOTYPES__) wl
- (ccfont_proc\() ws fontprocname ws (\);) wl
- (int) wl
- fontprocname ws ((i_ctx_t *i_ctx_p, const cfont_procs *pprocs, ref *pfont)) wl
- (#else) wl
- (int) wl
- fontprocname ws ((i_ctx_p, pprocs, pfont) i_ctx_t *i_ctx_p; const cfont_procs *pprocs; ref *pfont;) wl
- (#endif) wl
- ({\tint code;) wl
- (\tref Font;) wl
- otherobjs
- { exch pop (\tref ) ws wt (;) wl }
- forall
-
-% Write out the special objects.
- otherobjs
- { exch writespecial 2 index get exec
- }
- forall
-
-% Write out the main font dictionary.
-% If possible, substitute the encoding name for the encoding;
-% PostScript code will fix this up.
- { /Encoding /PrefEnc }
- { Font 1 index .knownget
- { encodingnames exch .knownget { def } { pop } ifelse }
- { pop }
- ifelse
- }
- forall
- (Font) Font FontType 0 eq { 5 } { 1 } ifelse wd
-
-% Finish the procedural initialization code.
- (\t*pfont = Font;) wl
- (\treturn 0;) wl
- (}) wl
- end % Font
-
- cfile closefile
-
- } bind def
-
-end def % font2cdict
-
-% Compute the procedure name from the font name.
-% Replace all non-alphanumeric characters with '_'.
-/makefontprocnamemap 256 string
- 0 1 255 { 2 copy 95 put pop } for
- (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz)
- { 2 copy dup put pop } forall
-readonly def
-/makefontprocname % <fontname> makefontprocname <procnamestring>
- { dup length string cvs
- dup length 1 sub -1 0
- { % Stack: string index
- 2 copy 2 copy get //makefontprocnamemap exch get put pop
- }
- for
- } def
-
-/writefont { font2cdict begin writefont end } def
-
-% If the program was invoked from the command line, run it now.
-[ shellarguments
- { counttomark dup 2 eq exch 3 eq or
- { counttomark -1 roll cvn
- (Converting ) print dup =only ( font.\n) print flush
- % Ensure that we get a clean copy of the font from the
- % file system.
- 2 { % do both local and global
- currentglobal not setglobal
- dup undefinefont
- } repeat
- findfont setfont
- (FontName is ) print currentfont /FontName get ==only (.\n) print flush
- counttomark 1 eq
- { % Construct the procedure name from the file name.
- currentfont /FontName get makefontprocname
- }
- if
- writefont
- (Done.\n) print flush
- }
- { cleartomark
- (Usage: font2c fontname cfilename.c [shortname]\n) print
- ( e.g.: font2c Courier cour.c\n) print flush
- mark
- }
- ifelse
- }
-if pop
diff --git a/lib/font2pcl.ps b/lib/font2pcl.ps
index df0c92d72..bf0c903d6 100644
--- a/lib/font2pcl.ps
+++ b/lib/font2pcl.ps
@@ -399,7 +399,11 @@ currentdict readonly end pop % pcldict
dup dup 0 get exch 3 get negY sub abs 0.5 ge
{ (Only identical scaling in X and Y is supported:\n) print
exch flipY 3 array astore ==
- currentdevice .devicename ==
+%
+% .devicename has been deprecated
+% currentdevice .devicename ==
+%
+ currentpagedevice /Name get ==
matrix defaultmatrix == flush
saved end end end restore stop
}
diff --git a/lib/gs_pfile.ps b/lib/gs_pfile.ps
deleted file mode 100644
index 1118d8aa5..000000000
--- a/lib/gs_pfile.ps
+++ /dev/null
@@ -1,126 +0,0 @@
-% Copyright (C) 2001-2012 Artifex Software, Inc.
-% All Rights Reserved.
-%
-% This software is provided AS-IS with no warranty, either express or
-% implied.
-%
-% This software is distributed under license and may not be copied,
-% modified or distributed except as expressly authorized under the terms
-% of the license contained in the file LICENSE in this distribution.
-%
-% Refer to licensing information at http://www.artifex.com or contact
-% Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael,
-% CA 94903, U.S.A., +1(415)492-9861, for further information.
-%
-
-% Runtime support for minimum-space fonts and packed files.
-
-% ****** NOTE: This file must be kept consistent with
-% ****** packfile.ps and wrfont.ps.
-
-% ---------------- Packed file support ---------------- %
-
-% A packed file is the concatenation of several file groups, each of which
-% is the result of compressing several files concatenated together.
-% The packed file begins with a procedure that creates an appropriate
-% decoding filter for each file group, as follows:
-% <group-subfile-filter> -proc- <group-decode-filter>
-% Thus, accessing an individual file requires 4 parameters:
-% the starting address and length of the outer compressed file,
-% and the starting address and length of the inner file.
-/.packedfilefilter % <file> <ostart> <olength> <istart> <ilength>
- % .packedfilefilter <filter>
- { 4 index systemdict begin token pop end 6 1 roll
- % Stack: fproc file ostart olength istart ilength
- 4 index 5 -1 roll setfileposition
- % Stack: fproc file olength istart ilength
- 4 -2 roll () /SubFileDecode filter
- % Stack: fproc istart ilength ofilter
- 4 -1 roll exec
- % Filters don't support setfileposition, so we must skip data
- % by reading it into a buffer. We rely on the fact that
- % save/restore don't affect file positions.
- % Stack: istart ilength dfilter
- save exch 64000 string
- % Stack: istart ilength save dfilter scratch
- 4 index 1 index length idiv { 2 copy readstring pop pop } repeat
- 2 copy 0 8 -1 roll 2 index length mod getinterval readstring pop pop pop
- % Stack: ilength save dfilter
- exch restore exch () /SubFileDecode filter
- } bind def
-
-% Run a packed library file.
-/.runpackedlibfile % <filename> <ostart> <olength> <istart> <ilength>
- % .runpackedlibfile
- { 5 -1 roll findlibfile
- { exch pop dup 6 2 roll .packedfilefilter
- currentobjectformat exch 1 setobjectformat run
- setobjectformat closefile
- }
- { 5 1 roll /findlibfile .systemvar /undefinedfilename signalerror
- }
- ifelse
- } bind def
-
-% ---------------- Compacted font support ---------------- %
-
-% Compacted fonts written by wrfont.ps depend on the existence and
-% specifications of the procedures and data in this section.
-
-/.compactfontdefault mark
- /PaintType 0
- /FontMatrix [0.001 0 0 0.001 0 0] readonly
- /FontType 1
- /Encoding StandardEncoding
-.dicttomark readonly def
-
-/.checkexistingfont % <fontname> <uid> <privatesize> <fontsize>
- % .checkexistingfont
- % {} (<font> on d-stack)
- % <fontname> <uid> <privatesize> <fontsize>
- % .checkexistingfont
- % -save- --restore-- (<font> on d-stack)
- { FontDirectory 4 index .knownget
- { dup /UniqueID .knownget
- { 4 index eq exch /FontType get 1 eq and }
- { pop false }
- ifelse
- }
- { false
- }
- ifelse
- { save /restore load 6 2 roll }
- { {} 5 1 roll }
- ifelse
- dict //.compactfontdefault exch .copydict begin
- dict /Private exch def
- Private begin
- /MinFeature {16 16} def
- /Password 5839 def
- /UniqueID 1 index def
- end
- /UniqueID exch def
- /FontName exch def
- } bind def
-
-/.knownEncodings [
- ISOLatin1Encoding
- StandardEncoding
- SymbolEncoding
-] readonly def
-
-/.readCharStrings % <count> <encrypt> .readCharStrings <dict>
- { exch dup dict dup 3 -1 roll
- { currentfile token pop dup type /integertype eq
- { dup -8 bitshift //.knownEncodings exch get exch 255 and get } if
- currentfile token pop dup type /nametype eq
- { 2 index exch get
- }
- { % Stack: encrypt dict dict key value
- 4 index { 4330 exch dup .type1encrypt exch pop } if
- readonly
- }
- ifelse put dup
- }
- repeat pop exch pop
- } bind def
diff --git a/lib/gs_rdlin.ps b/lib/gs_rdlin.ps
deleted file mode 100644
index aefd6d004..000000000
--- a/lib/gs_rdlin.ps
+++ /dev/null
@@ -1,19 +0,0 @@
-% Copyright (C) 2001-2012 Artifex Software, Inc.
-% All Rights Reserved.
-%
-% This software is provided AS-IS with no warranty, either express or
-% implied.
-%
-% This software is distributed under license and may not be copied,
-% modified or distributed except as expressly authorized under the terms
-% of the license contained in the file LICENSE in this distribution.
-%
-% Refer to licensing information at http://www.artifex.com or contact
-% Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael,
-% CA 94903, U.S.A., +1(415)492-9861, for further information.
-%
-
-% Patch for systems with readline support in the interpreter.
-
-% Disable the prompt message, since readline will generate it.
-/.promptmsg { } def
diff --git a/lib/impath.ps b/lib/impath.ps
deleted file mode 100644
index 8ddc1ef1a..000000000
--- a/lib/impath.ps
+++ /dev/null
@@ -1,178 +0,0 @@
-% Copyright (C) 2001-2012 Artifex Software, Inc.
-% All Rights Reserved.
-%
-% This software is provided AS-IS with no warranty, either express or
-% implied.
-%
-% This software is distributed under license and may not be copied,
-% modified or distributed except as expressly authorized under the terms
-% of the license contained in the file LICENSE in this distribution.
-%
-% Refer to licensing information at http://www.artifex.com or contact
-% Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael,
-% CA 94903, U.S.A., +1(415)492-9861, for further information.
-%
-
-% impath.ps
-% Reverse-rasterize a bitmap to produce a Type 1 outline.
-% (This was formerly a Ghostscript operator implemented in C.)
-
-% <image> <width> <height> <wx> <wy> <ox> <oy> <string>
-% type1imagepath <substring>
-% Converts an image (bitmap) description of a character into
-% a scalable description in Adobe Type 1 format. The
-% current transformation matrix should be the same as the
-% FontMatrix of the font in which this character will be
-% used: this establishes the scaling relationship between
-% image pixels (the image is assumed to be 1 unit high in
-% user space) and the character coordinate system used in
-% the scalable description. wx and wy are the character
-% width, and ox and oy are the character origin relative
-% to the lower left corner of the bitmap, in *pixels*.
-% The image is assumed to be stored in left-to-right,
-% top-to-bottom order. Note that this is not consistent
-% with the `image' operator's interpretation of the CTM.
-% All coordinates in the scalable description are rounded to
-% integers, so the coefficients in the FontMatrix should
-% be on the order of 1/N for some value of N that is
-% either a multiple of the height/width or is large
-% compared to the width and height. (There is a
-% convention, which some PostScript programs rely on, that
-% N=1000.)
-% Note that the encoded description has *not* been subjected
-% to CharString encryption, which is necessary before the
-% description can be given to type1addpath: to do this,
-% follow the type1imagepath with
-% 4330 exch dup .type1encrypt exch pop
-% If the description is too complex to fit into the supplied
-% string, a limitcheck error results. A good rule of
-% thumb is that the size of the string should be about 6
-% times the number of 1-bits in the image that are not
-% completely surrounded by other 1-bits.
-
-% Import the Type 1 opcodes.
-(type1ops.ps) runlibfile
-
-100 dict
-dup /type1imagepath_dict exch def
-begin
-
-/rc { round cvi } bind def
-/moving [/rmoveto /hmoveto /vmoveto] def
-/drawing [/rlineto /hlineto /vlineto] def
-
-% Convert the current path to a Type 1 token array.
-/putxy % x y ops -> cs_elements
- { 3 -1 roll dup x sub rc exch /x exch def
- 3 -1 roll dup y sub rc exch /y exch def
- % stack: ops dx dy
- dup 0 eq
- { % dy = 0, use hmoveto/lineto
- pop exch 1 get
- }
- { 1 index 0 eq
- { % dx = 0, use vmoveto/lineto
- exch pop exch 2 get
- }
- { % use rmoveto/rlineto
- 3 -1 roll 0 get
- }
- ifelse
- }
- ifelse
- } bind def
-/pathtotype1 % -> charstack
- { 3 dict begin /x 0 def /y 0 def
- mark
- { moving putxy
- }
- { drawing putxy
- }
- { % Convert curve to relative form
- x y 3
- { exch neg 7 index add rc
- exch neg 6 index add rc
- 8 -2 roll
- }
- repeat /y exch def /x exch def
- 1 index 0 eq 5 index 0 eq and % dy1=dx3=0, hv
- { 5 -1 roll pop exch pop /hvcurveto
- }
- { dup 0 eq 6 index 0 eq and % dx1=dy3=0, vh
- { 6 -1 roll pop pop /vhcurveto
- }
- { /rrcurveto % none of the above
- }
- ifelse
- }
- ifelse
- }
- { /closepath
- }
- pathforall end
- } bind def
-
-end % type1imagepath_dict
-
-% The main program
-/type1imagepath % image width height wx wy ox oy string ->
- % substring
- { type1imagepath_dict begin
- /tsave save def
- /ostring exch def
- /oy exch def /ox exch def
- /wy exch def /wx exch def
- /height exch def /width exch def
- /data exch def
-
- /ofilter ostring /NullEncode filter def
- /raster width 7 add 8 idiv def
-
-% Construct the coordinate transformation.
- height dup scale
- matrix currentmatrix matrix invertmatrix setmatrix
-
-% Determine the left side bearing.
- /lsbx width
- 0 1 width 1 sub
- { dup dup 8 idiv 0 exch
- raster raster height mul 1 sub
- { data exch get or }
- for exch 8 mod bitshift 128 and 0 ne
- { exch pop exit }
- if pop
- }
- for def
-
-% Compute and encode the origin, width, and side bearing.
- mark
- ox oy dtransform
- rc /opty exch def rc /optx exch def
- wx wy dtransform
- rc /iwy exch def rc /iwx exch def
- lsbx ox sub 0 dtransform
- rc /ilsby exch def rc /ilsbx exch def
- ilsbx
- iwy 0 ne ilsby 0 ne or
- { ilsby iwx iwy /sbw }
- { iwx /hsbw }
- ifelse
- ofilter charstack_write
-
-% Flip over the Y axis, because the image is stored top-to-bottom.
- [1 0 0 -1 0 height] concat
-% Account for the character origin.
- lsbx oy translate
-% Trace the outline.
- newpath
- width height data .imagepath
- gsave matrix setmatrix pathtotype1 grestore
- ofilter charstack_write
-% Terminate the output
- mark /endchar ofilter charstack_write
-
- ofilter .fileposition ofilter closefile % flush buffers
- ostring 0 3 -1 roll getinterval
- tsave restore
- end
- } bind def
diff --git a/lib/level1.ps b/lib/level1.ps
deleted file mode 100644
index b4c53c1a4..000000000
--- a/lib/level1.ps
+++ /dev/null
@@ -1,2 +0,0 @@
-%!
-/.setlanguagelevel where { pop 1 .setlanguagelevel } if
diff --git a/lib/markhint.ps b/lib/markhint.ps
deleted file mode 100644
index f83d62d85..000000000
--- a/lib/markhint.ps
+++ /dev/null
@@ -1,129 +0,0 @@
-% Copyright (C) 2001-2012 Artifex Software, Inc.
-% All Rights Reserved.
-%
-% This software is provided AS-IS with no warranty, either express or
-% implied.
-%
-% This software is distributed under license and may not be copied,
-% modified or distributed except as expressly authorized under the terms
-% of the license contained in the file LICENSE in this distribution.
-%
-% Refer to licensing information at http://www.artifex.com or contact
-% Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael,
-% CA 94903, U.S.A., +1(415)492-9861, for further information.
-%
-
-% markhint.ps
-% Draw the hints for a Type 1 font.
-
-(type1ops.ps) runlibfile
-
-/mhsetup % <matrix> <print> mhsetup -
- { /mhprint exch def
- /mhmx exch def
- /mhdash 0 9 gsave initmatrix dtransform grestore idtransform add abs def
- gsave
- clippath pathbbox
- 2 index sub /bbh exch def
- 2 index sub /bbw exch def
- /bby exch def
- /bbx exch def
- grestore
- } def
-
-/markfonthints % <matrix> <print> markfonthints -
- { mhsetup
- } def
-
-/hmark % <y> hmark -
- { bbx exch moveto bbw 0 rlineto stroke
- } def
-/hsmark % <y0> <dy> hsmark -
- { 1 index add exch gsave
- [mhdash] 0 setdash 0 exch mhmx transform exch pop hmark
- [mhdash 2 div dup 2 mul] 0 setdash 0 exch mhmx transform exch pop hmark
- grestore
- } def
-/vmark % <x> vmark -
- { bby moveto 0 bbh rlineto stroke
- } def
-/vsmark % <x0> <dx> vsmark -
- { 1 index add exch gsave
- [mhdash] mhdash setdash 0 mhmx transform pop vmark
- [mhdash 2 div dup 2 mul] 0 setdash 0 mhmx transform pop vmark
- grestore
- } def
-/pmark % <x> <y> pmark -
- { newpath 0 4.5 gsave initmatrix dtransform grestore idtransform add abs
- 0 360 arc stroke
- } def
-/mchdict mark
- /hsbw { pop 0 mhmx transform translate 0 0 pmark }
- /sbw { pop pop mhmx transform translate 0 0 pmark }
- /hstem
- { mhprint { (hstem ) print 2 copy 2 packedarray == } if
- hsmark
- }
- /vstem
- { mhprint { (vstem ) print 2 copy 2 packedarray == } if
- vsmark
- }
- /hstem3
- { mhprint { (hstem3 ) print 6 copy 6 packedarray == } if
- 3 { hsmark } repeat
- }
- /vstem3
- { mhprint { (vstem3 ) print 6 copy 6 packedarray == } if
- 3 { vsmark } repeat
- }
- /div
- { div
- }
- /callothersubr
- { 3 eq
- { pop
- mhprint { (replace) = } if
- % We're replacing hints; lighten the color.
- currentrgbcolor 3 { 2 mul 3 div 3 1 roll } repeat setrgbcolor
- }
- { { pop } repeat
- } ifelse
- }
- /callsubr
- { Private /Subrs get exch get mchinterp
- }
- /pop
- {
- }
- /return
- {
- }
-.dicttomark def
-
-/mchinterp % <charstring> mchinterp -
- { 4330 exch dup length string .type1decrypt exch pop
- dup length lenIV sub lenIV exch getinterval
- 0 () /SubFileDecode filter
- mark exch charstack_read ]
- { dup type /nametype eq
- { mchdict exch .knownget { exec } { cleartomark mark } ifelse
- }
- if
- }
- forall
- } def
-
-/markcharhints % <charname> <matrix> <print> markcharhints -
- { mhsetup
- gsave mark
- /Private currentfont /Private get def
- Private rcheck % make sure we won't get an access error
- { /lenIV Private /lenIV .knownget not { 4 } if def
- currentfont /CharStrings get 3 -1 roll get mchinterp
- }
- { (Sorry, this font is protected; I can't show the hints.\n) print flush
- exch
- }
- ifelse
- cleartomark grestore
- } def
diff --git a/lib/markpath.ps b/lib/markpath.ps
deleted file mode 100644
index 4aec660c1..000000000
--- a/lib/markpath.ps
+++ /dev/null
@@ -1,58 +0,0 @@
-% Copyright (C) 2001-2012 Artifex Software, Inc.
-% All Rights Reserved.
-%
-% This software is provided AS-IS with no warranty, either express or
-% implied.
-%
-% This software is distributed under license and may not be copied,
-% modified or distributed except as expressly authorized under the terms
-% of the license contained in the file LICENSE in this distribution.
-%
-% Refer to licensing information at http://www.artifex.com or contact
-% Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael,
-% CA 94903, U.S.A., +1(415)492-9861, for further information.
-%
-
-% markpath.ps
-% Mark the corners of a path, drawing it slowly if desired.
-
-/Delay where { pop } { /Delay 0 def } ifelse
-/setxy0
- { currentpoint /y0 exch def /x0 exch def
- } def
-/bip
- { epsx epsy idtransform /ey exch def /ex exch def
- currentpoint ex 2 div ey 2 div rlineto currentpoint 0 ey neg rlineto
- ex neg 0 rlineto 0 ey rlineto lineto lineto
- stroke
- } def
-/dally
- { Delay { } repeat
- Delay 0 ne { flushpage } if
- } def
-/movebip
- { /xs 2 index def /ys 1 index def
- gsave newpath mpmx transform moveto setxy0 bip grestore
- } def
-/linebip
- { gsave newpath x0 y0 moveto mpmx transform lineto setxy0 bip dally grestore
- } def
-/curvebip
- { gsave newpath x0 y0 moveto 5 index 5 index mpmx transform lineto bip
- 2 copy mpmx transform moveto 3 index 3 index mpmx transform lineto bip
- x0 y0 moveto
- 3 { mpmx transform 6 2 roll } repeat
- curveto setxy0 bip dally grestore
- } def
-/closebip
- { xs ys linebip
- } def
-
-/markpath % <matrix> markpath -
- { /mpmx exch def
- gsave initgraphics 9 dup dtransform grestore
- /epsy exch def /epsx exch def
- gsave 0 setlinewidth
- { movebip } { linebip } { curvebip } { closebip } pathforall
- grestore
- } def
diff --git a/lib/packfile.ps b/lib/packfile.ps
deleted file mode 100644
index 8bad56f6d..000000000
--- a/lib/packfile.ps
+++ /dev/null
@@ -1,332 +0,0 @@
-% Copyright (C) 2001-2012 Artifex Software, Inc.
-% All Rights Reserved.
-%
-% This software is provided AS-IS with no warranty, either express or
-% implied.
-%
-% This software is distributed under license and may not be copied,
-% modified or distributed except as expressly authorized under the terms
-% of the license contained in the file LICENSE in this distribution.
-%
-% Refer to licensing information at http://www.artifex.com or contact
-% Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael,
-% CA 94903, U.S.A., +1(415)492-9861, for further information.
-%
-
-% packfile.ps
-% Pack groups of files together, with compression, for use in
-% storage-scarce environments.
-
-% ****** NOTE: This file must be kept consistent with gs_pfile.ps.
-
-% ---------------- Huffman coding utilities ---------------- %
-
-% We count runs of zeros, and individual byte frequencies separately
-% depending on whether they follow or do not follow a run of zeros.
-/zruns 256 array def
-/zfreq 256 array def
-/nzfreq 256 array def
-/maxcode 13 def % max code length, must be between 10 and 16
-/maxzrun 100 def % max length of zero run, must be <= 100
-/statbuf 10000 string def
-
-% Initialize statistics.
-/initstats % - initstats -
- { 0 1 255 { zruns exch 0 put } for
- 0 1 255 { zfreq exch 0 put } for
- 0 1 255 { nzfreq exch 0 put } for
- } bind def
-
-% Accumulate statistics from an individual file.
-/addstats % <file> addstats -
- { 0
- { 1 index //statbuf readstring 3 1 roll
- % Stack: file eof numzeros data
- { dup 0 eq
- { pop 1 add
- }
- { 1 index 0 ne
- { exch 255 .min
- //zruns exch 2 copy get 1 add put
- 0 exch //zfreq
- }
- { //nzfreq
- }
- ifelse
- exch 2 copy get 1 add put
- }
- ifelse
- } forall
- exch not { exit } if (.) print flush
- } loop
- pop closefile
- } bind def
-
-% Compute the Huffman codes from the statistics.
-/statcodes % - statcodes <array>
- { maxcode 1 add 256 add maxzrun 2 sub add 1 add array % full array
- dup maxcode 1 add dup 2 index length exch sub getinterval % data
- % Put statistics into array
- dup 0 1 255
- { zfreq 1 index get nzfreq 2 index get add put dup
- } for
- 0 zruns 1 get put
- 256 zruns 2 maxzrun 2 sub getinterval putinterval
- dup dup length 1 sub 1 put % EOD
- maxcode .computecodes
- } bind def
-
-% ---------------- File handling ---------------- %
-
-% Copy one file to another.
-% Close the input file, but not the output file.
-/copyfile % <infile> <outfile> copyfile <outfile> <length>
- { 0 mark statbuf
- { 4 index 1 index readstring
- exch 5 index 1 index writestring
- length 5 -1 roll add 4 1 roll
- not { exit } if (.) print flush
- } loop
- cleartomark 3 -1 roll closefile dup == flush
- } bind def
-
-% Represent a Type 1 font in its most compressed format.
-% Requires -dWRITESYSTEMDICT to run.
-% Does not close the output file.
-(wrfont.ps) runlibfile
-/compressfont % <fontname> <outfile> compressfont <outfile>
- { exch save
- systemdict /executeonly /readonly load put
- systemdict /noaccess /readonly load put
- systemdict readonly pop
- wrfont_dict begin
- /binary_CharStrings true def
- /binary_tokens true def
- /encrypt_CharStrings false def
- /standard_only false def
- /use_lenIV 0 def
- /smallest_output true def
- end
- exch findfont setfont
- 1 index writefont
- restore
- } bind def
-
-% ---------------- Main program ---------------- %
-
-% Find the length of a file.
-/filelength % <filename> filelength <length>
- { status { pop pop exch pop } { -1 } ifelse
- } bind def
-
-% Define the header string for a compressed file.
-/beginfilestring
-({dup token pop exch[/MaxCodeLength 2 index token pop/Tables 4 index token pop
-/EndOfData true/EncodeZeroRuns 256 .dicttomark
-/BoundedHuffmanDecode filter/MoveToFrontDecode filter
-[/BlockSize 4 -1 roll .dicttomark/BWBlockSortDecode filter
-}) readonly def
-
-% Write a 16-bit big-endian non-negative integer on a file.
-/write16 % <file> <int> write16 -
- { 2 copy -8 bitshift write 255 and write
- } bind def
-
-% Compress a group of files together.
-% Return a dictionary in which the keys are the input file names
-% and the values are [startpos length] in the uncompressed concatenation.
-% Does not open or close the output file.
-/tempname (t.em) def
-/packfiles % <filenames> <outfile> packfiles <outfile> <posdict>
- { % Concatenate files to a temporary file.
- tempname (w) file
- dup /MoveToFrontEncode filter
- dup <<
- /BlockSize 1000000
- >> /BWBlockSortEncode filter
- % Stack: filenames outfile tempfile mtfe bwe
- 5 -1 roll dup length dict 0 6 2 roll
- { % Stack: outfile posdict pos tempfile mtfe bwe infilename
- dup ==only dup (r) file 2 index copyfile exch pop
- dup 7 index 4 2 roll 7 index exch 2 array astore put
- 5 -1 roll add 4 1 roll
- } forall
- closefile closefile closefile pop exch
- % Stack: posdict outfile
- % Compute an optimal Huffman code.
- initstats
- tempname (r) file addstats
- % Actually compress the file.
- % Write the decompression information on the output first.
- dup tempname filelength write==
- dup maxcode write==
- % Write the code table as a homogenous number array.
- statcodes exch
- dup 149 write dup 32 write dup 2 index length write16
- exch { 2 copy write16 pop } forall
- dup <<
- /MaxCodeLength maxcode
- /EndOfData true
- /EncodeZeroRuns 256
- /Tables statcodes
- >> /BoundedHuffmanEncode filter
- tempname (r) file exch copyfile pop closefile
- exch
- } bind def
-
-% Squeeze a font to a .cpf file in anticipation of compression.
-/squeezefont % <fontname> squeezefont <filename.cpf>
- { dup type /nametype ne { cvn } if
- dup
- { dup type /stringtype eq { exit } if
- Fontmap exch get
- }
- loop
- % Stack: fontname filename
- dup dup
- { (.) search not { exit } if
- exch pop exch 3 -1 roll pop
- }
- loop
- % Stack: fontname filename noextname extension
- exch
- { (/) search not { (\\) search not { exit } if } if
- pop pop
- }
- loop
- % If the font extension is anything other than
- % .pfa or .pfb, we assume it can't be rewritten
- % using compressfont.
- % Stack: fontname filename extension basename
- (.cpf) concatstrings dup 5 1 roll (w) file
- % Stack: outfilename fontname filename extension outfile
- exch dup (pfa) eq exch (pfb) eq or
- % Stack: outfilename fontname filename outfile bool
- { exch pop compressfont
- }
- { 3 -1 roll pop
- exch findlibfile pop exch pop
- exch copyfile pop
- }
- ifelse closefile
- } bind def
-
-% ---------------- Production code ---------------- %
-
-% The following code constructs a packed version of the commercial-quality
-% fonts available from Artifex Software Inc. To use this code:
-% - If desired, change the output file names below.
-% - Make sure you have the synthetic font data (fontmap.shs and the
-% *.ps files for the commercial fonts) in a directory that is on
-% Ghostscript's search path.
-% - Construct the packed fonts by running
-% gs -dNODISPLAY -dWRITESYSTEMDICT packfile.ps
-% - If desired, move the output files to the directory that will be
-% used at run time. You no longer need the *.pfb or *.ps files
-% for the original fonts; however, you do still need the Fontmap
-% for these fonts, because it defines the font name aliases.
-% - Add the following line to the end of gs_fonts.ps:
-% (ALL.cmp) run
-% (substituting the definition of allmapname if you changed it).
-
-% Define the output file names. The extensions are arbitrary;
-% any legal file name is allowed.
-/allname (ALL.cff) def % the compressed font file
-/allmapname (ALL.cmp) def % the Fontmap override file
-
-% Load an alternate Fontmap that references the synthetic oblique and
-% narrow fonts.
-true .setglobal
-(fontmap.shs) findlibfile pop exch pop .loadFontmap
-false .setglobal
-
-% Define the packaging of fonts into font groups.
-% Fewer larger groups compress better, but make decompression slower.
-/Lists [
-[ % The oblique and narrow fonts are synthetic,
- % and take very little space.
- /AvantGarde-BookOblique /AvantGarde-DemiOblique
- /Courier-Oblique /Courier-BoldOblique
- /Helvetica-Oblique /Helvetica-BoldOblique
- /Helvetica-Narrow /Helvetica-Narrow-Oblique
- /Helvetica-Narrow-Bold /Helvetica-Narrow-BoldOblique
-]
-[/AvantGarde-Book /AvantGarde-Demi
- /Bookman-Light] [/Bookman-LightItalic
- /Bookman-Demi /Bookman-DemiItalic
- /Courier] [/Courier-Bold
- /Helvetica /Helvetica-Bold]
-[/NewCenturySchlbk-Roman /NewCenturySchlbk-Italic
- /NewCenturySchlbk-Bold /NewCenturySchlbk-BoldItalic]
-[/Palatino-Roman /Palatino-Italic
- /Palatino-Bold /Palatino-BoldItalic]
-[/Times-Roman /Times-Italic
- /Times-Bold /Times-BoldItalic]
-[/Symbol
- /ZapfChancery-MediumItalic
- /ZapfDingbats]
-] def
-
-% We need to register the fonts under their true names, not aliases.
-/Lists Lists mark exch
- { mark exch
- { { Fontmap 1 index get dup type /nametype ne { pop exit } if
- exch pop
- }
- loop
- }
- forall ]
- }
-forall ] def
-
-% Squeeze the fonts to their .cpf format.
-(Squeezing... ) print flush
-/fdict mark
-Lists
- { { dup squeezefont } forall } forall
-.dicttomark def
-(done.\n) print flush
-
-% Invert fdict.
-/f2dict fdict length dict def
-fdict { exch f2dict 3 1 roll put } forall
-
-% Construct the compressed font file.
-(Creating ) print allname print (... ) print flush
-/posdict fdict length dict def
-/all allname (w) file def
-all beginfilestring writestring
-Lists
- { dup == flush
- /fbegin all fileposition def
- mark exch { fdict exch get } forall ]
- all packfiles exch pop
- /flength all fileposition fbegin sub def
- { fbegin flength 3 -1 roll aload pop 4 packedarray
- exch f2dict exch get exch posdict 3 1 roll put
- }
- forall
- }
-forall
-all closefile
-(done.\n) print flush
-
-% Write the Fontmap addendum for accessing compressed fonts.
-(Writing ) print allmapname print (... ) print flush
-allmapname (w) file
-dup (%!
-/.runpackedlibfile where{pop}{(gs_pfile.ps)runlibfile}ifelse
-.currentglobal true .setglobal
-) writestring
-posdict
- { exch 2 index exch write==only exch dup ({) writestring
- dup allname write==only
- exch { 1 index dup ( ) writestring exch write==only } forall
- dup ( .runpackedlibfile}bind .definefontmap
-) writestring
- }
-forall
-dup (.setglobal
-) writestring
-closefile
-(done.\n) print flush
diff --git a/lib/pcharstr.ps b/lib/pcharstr.ps
deleted file mode 100644
index 7f38fc966..000000000
--- a/lib/pcharstr.ps
+++ /dev/null
@@ -1,125 +0,0 @@
-% Copyright (C) 2001-2012 Artifex Software, Inc.
-% All Rights Reserved.
-%
-% This software is provided AS-IS with no warranty, either express or
-% implied.
-%
-% This software is distributed under license and may not be copied,
-% modified or distributed except as expressly authorized under the terms
-% of the license contained in the file LICENSE in this distribution.
-%
-% Refer to licensing information at http://www.artifex.com or contact
-% Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael,
-% CA 94903, U.S.A., +1(415)492-9861, for further information.
-%
-
-% pcharstr.ps
-% Print the CharStrings and Subrs (if present) from a Type 1 font,
-% in either a PostScript-like or a C-compatible form,
-% depending on whether CSFormat is defined as /PS or /C.
-
-% Load the Type 1 utilities.
-(type1ops.ps) runlibfile
-
-% Define the printing procedures for PostScript-like output.
-/pcs_ps_dict mark
- /, {( ) print}
- /charname {==only}
- /csbegin {}
- /beginchars {(%---------------- CharStrings\n) print}
- /charbegin {==only}
- /char1 {( ) print ==only}
- /endchars {}
- /beginsubrs {(%---------------- Subrs\n) print}
- /subrbegin {=only}
- /endsubrs {}
- /beginboxes {(%---------------- Encoding & metrics\n) print}
- /notdefbox {}
- /boxbegin {=only ( ) print}
- /boxend {(\n) print}
- /endboxes {(%----------------\n) print}
-.dicttomark readonly def
-
-% Define the printing procedures for C-like output.
-/pcs_c_dict mark
- /, {(, ) print}
- /charname {(") print =only (") print}
- /csbegin {counttomark =only ,}
- /beginchars {(\nconstdata int CSCharData[] = {\n) print}
- /charbegin {pop}
- /char1 {=only ,}
- /endchars {
- (-1\n};\nconstdata char *CSCharNames[] = {\n) print
- CharStrings {pop charname ,} forall (0\n};\n) print
- }
- /beginsubrs {(\nconstdata int CSSubrs[] = {\n) print}
- /subrbegin {pop}
- /endsubrs {(-1\n};\n) print}
- /beginboxes {(\nconstdata type1_box CSboxes[] = {\n) print}
- /notdefbox {( {""},\n) print}
- /boxbegin {pop ( {) print}
- /boxend {(},) =}
- /endboxes {( {0}\n};\n) print}
-.dicttomark readonly def
-
-/printcs
- { dup type /stringtype eq
- { printcs1 (\n) print }
- { ( ) print == }
- ifelse
- } bind def
-/printcs1
- { save exch
- lenIV 0 ge {
- 4330 exch dup length string .type1decrypt exch pop
- dup length lenIV sub lenIV exch getinterval
- } if
- 0 () /SubFileDecode filter
- mark exch charstack_read csbegin
- counttomark 1 sub -1 0 { index char1 } for
- cleartomark restore
- } bind def
-
-/printfont
- { pcs_ps_dict
- /CSFormat where { pop CSFormat /C eq { pop pcs_c_dict } if } if
- begin
- currentfont begin Private begin 10 dict begin
-
- % Print the CharStrings and Subrs
-
- beginchars
- CharStrings { exch charbegin printcs } forall
- endchars
- /Subrs where
- { pop % the dictionary
- beginsubrs
- 0 1 Subrs length 1 sub
- { dup subrbegin
- Subrs exch get printcs
- } for
- endsubrs
- } if
-
- % Print the bounding boxes
-
- gsave nulldevice FontMatrix matrix invertmatrix concat
- beginboxes
- 0 1 Encoding length 1 sub
- { dup Encoding exch get dup /.notdef eq
- { pop pop notdefbox
- }
- { 1 index boxbegin charname ,
- ( ) dup 0 4 -1 roll put
- newpath 0 0 moveto false charpath
- pathbbox ({) print 4 -1 roll =only ,
- 3 -1 roll =only , exch =only , =only (}) print
- boxend
- }
- ifelse
- } for
- endboxes
- grestore
-
- end end end end
- } bind def
diff --git a/lib/pdfwrite.ps b/lib/pdfwrite.ps
deleted file mode 100644
index 8aa9dca1d..000000000
--- a/lib/pdfwrite.ps
+++ /dev/null
@@ -1,396 +0,0 @@
-% Copyright (C) 2001-2012 Artifex Software, Inc.
-% All Rights Reserved.
-%
-% This software is provided AS-IS with no warranty, either express or
-% implied.
-%
-% This software is distributed under license and may not be copied,
-% modified or distributed except as expressly authorized under the terms
-% of the license contained in the file LICENSE in this distribution.
-%
-% Refer to licensing information at http://www.artifex.com or contact
-% Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael,
-% CA 94903, U.S.A., +1(415)492-9861, for further information.
-%
-
-% Writer for transmuting PDF files.
-
-% NOTES:
-% We do editing by replacing objects (in the cache) and then doing a
-% simple recursive walk with object renumbering.
-% Free variables:
-% RMap [per input file] (dict): input_obj# => output_obj#
-% PDFfile (file): current input file
-% OFile (file): current output file
-% XRef (dict): output_obj# => output_file_pos
-% ToWrite: 0..N-1 => [obj# gen#]
-
-.languagelevel 2 .setlanguagelevel
-.currentglobal true .setglobal
-
-/PDFWRDEBUG where { pop } { /PDFWRDEBUG false def } ifelse
-
-% ======== Long dictionary support =============== %
-
-% The key must be a non-negative iteger.
-
-/ld_dict { % <len> ld_dict <ldict>
- pop << 0 <<>> >>
-} bind def
-
-/ld_length { % <ldict> ld_length <length>
- 0 exch { exch pop length add } forall
-} bind def
-
-/ld_get { % <ldict> <key> ld_get <any>
- dup 3 1 roll -15 bitshift get exch get
-} bind def
-
-/ld_put { % <ldict> <key> <any> ld_put -
- 3 1 roll dup % any ldict key key
- 4 1 roll -15 bitshift % key any ldict key>>15
- 2 copy known {
- get % key any subdict
- 3 1 roll put % -
- } {
- 64 dict dup 6 1 roll % <<>> key any ldict key>>15 <<>>
- put put
- } ifelse % -
-} bind def
-
-/ld_known { % <ldict> <key> ld_known <bool>
- dup 3 1 roll -15 bitshift % key <<>> key<<15
- 2 copy known {
- get exch known
- } {
- pop pop pop //false
- } ifelse
-} bind def
-
-/ld_knownget { % <ldict> <key> ld_known false | <any> true
- dup 3 1 roll -15 bitshift % key <<>> key<<15
- 2 copy known {
- get exch .knownget
- } {
- pop pop pop //false
- } ifelse
-} bind def
-
-/ld_def { % <key> <any> ld_def -
- currentdict 3 1 roll ld_put
-} bind def
-
-/ld_forall { % <ldict> <proc} ld_forall -
- { forall exch pop } aload pop
- 4 2 roll 4 packedarray cvx forall
-} bind def
-
-/ld_clone { % <ldict> ld_clone <ldict copy>
- << exch { dup length dict copy } forall >>
-} bind def
-
-% ================ Object mapping ================ %
-
-% Initialize the object number and location map.
-/omapinit { % - omapinit -
- /RMap 100 ld_dict def
- /XRef 100 ld_dict def
- PDFWRDEBUG { (omapinit) = } if
-} bind def
-
-% Map an object number.
-/omapnew { % <oldobj#> omap <newobj#> <isnew>
- RMap 1 index ld_knownget {
- exch pop //false
- } {
- PDFWRDEBUG { (omap\() print dup =only } if
- RMap dup ld_length 1 add % old# <<>> len+1
- 2 index exch dup % old# <<>> old# len+1 len+1
- 5 1 roll % len+1 old# <<>> old# len+1
- ld_put pop //true % len+1 true
- PDFWRDEBUG { (\) = ) print 1 index = } if
- } ifelse
-} bind def
-/omap { % <oldobj#> omap <newobj#>
- omapnew pop
-} bind def
-
-% Save and restore the object map.
-% Note that currentomap either returns a copy or calls omapinit.
-/currentomap { % <copy> currentomap <omap>
- {
- [RMap ld_clone XRef ld_clone]
- } {
- [RMap XRef] omapinit
- } ifelse
-} bind def
-/setomap { % <omap> setomap -
- aload pop /XRef exch def /RMap exch def
- PDFWRDEBUG {
- (setomap: #Xref = ) print XRef ld_length =only
- (, #RMap = ) print RMap ld_length =
- } if
-} bind def
-
-% ================ Writing ================ %
-
-% ---------------- Low-level output ---------------- %
-
-% Write a string on the output file.
-/ows { % <string> ows -
- OFile exch writestring
-} bind def
-
-% ---------------- Scalars ---------------- %
-
-% Note that the '#' character isn't legal in a name unless it is a prefix
-% for a hex encoded character (for PDF 1.2 and later). The following assumes
-% that the names are already valid PDF 1.2+ names so that we can treat the
-% '#' as a legal character. The next two hex characters are already in the
-% set of valid name characters. PDF 1.1 and earlier allowed spaces in names
-% which probably wouldn't make it past the tokenizer anyway.
-/pdfnamechars
- (!"$&'*+,-.0123456789:;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\^_`abcdefghijklmnopqrstuvwxyz|~)
-readonly def
-/pdfwritename { % <name> pdfwritename -
- (/) ows .namestring {
- ( ) dup 0 4 -1 roll put
- //pdfnamechars 1 index search {
- pop pop pop
- } {
- pop 0 get 256 add 16 =string cvrs
- dup 0 (#) 0 get put
- } ifelse ows
- } forall
-} bind def
-
-% ---------------- Composite objects ---------------- %
-
-/pdfwriteprocs mark
- /resolveR { pdfwriteref }
- /O { pdfwritenewref }
-.dicttomark readonly def
-/pdfwritearray { % <array> pdfwritearray -
- dup xcheck {
- aload pop //pdfwriteprocs exch get exec
- } {
- % Because of a bug in Acrobat's parser for linearization parameters,
- % we have to include some whitespace after the opening [ (!).
- ([ ) ows { pdfwritevalue (\n) ows } forall (]) ows
- } ifelse
-} bind def
-
-/pdfwritedict { % <dict> pdfwritedict -
- dup xcheck {
- pdfwritestream
- } {
- (<<) ows {
- exch pdfwritevalue ( ) ows pdfwritevalue (\n) ows
- } forall (>>) ows
- } ifelse
-} bind def
-
-% ---------------- References ---------------- %
-
-/pdfwritenewref { % <newobj#> pdfwritenewref -
- OFile exch write=only ( 0 R) ows
-} bind def
-
-/pdfwriteref { % <obj#> <gen#> pdfwriteref -
- 1 index omapnew {
- ToWrite dup length 5 -2 roll 2 packedarray put
- } {
- exch pop exch pop
- } ifelse
- pdfwritenewref
-} bind def
-
-/pdfcopystring 200 string def
-/pdfwritestream { % <streamdict> pdfwritestream -
- % Remove File, FilePosition, and StreamKey;
- % optimize by replacing an indirect Length.
- dup dup length dict copy
- % Stack: origdict dict
- dup /File undef dup /FilePosition undef dup /StreamKey undef
- dup /Length known {
- dup /Length get dup oforce ne {
- dup /Length 2 copy oget put
- } if
- } {
- 1 index /File get dup
- 3 index /FilePosition get setfileposition
- dup 0 (endstream) /SubFileDecode filter flushfile
- .fileposition 9 sub
- 2 index /FilePosition get sub
- 1 index exch /Length exch put
- } ifelse
- exch dup /File get dup 3 -1 roll /FilePosition get setfileposition
- pdfcopystream
-} bind def
-
-% We put copying the stream contents in separate procedures so that we
-% can replace this function if desired.
-/pdfcopybytes { % <fromfile> <tofile> <length> pdfcopybytes -
- {
- dup 0 eq { exit } if
- //pdfcopystring 0 2 index 2 index length .min getinterval
- 3 index exch readstring 3 1 roll
- 3 index 1 index writestring length sub exch not { exit } if
- } loop pop pop pop
-} bind def
-/pdfcopystream { % <newstreamdict> <file> pdfcopystream -
- % (file has been positioned)
- 1 index pdfwritevalue (stream\n) ows
- exch /Length get OFile exch pdfcopybytes
- (endstream) ows
-} bind def
-
-% ---------------- General values/objects ---------------- %
-
-/pdfwritetypes mark
- % Scalars
- /nulltype { pop (null) ows } bind
- /integertype { =string cvs ows } bind
- /booleantype 1 index
- /realtype {
- =string cvs
- (e) search { % PDF has no exponential format
- exch pop % exp pre
- exch cvi exch
- (-) anchorsearch { ows } if
- (.) search {
- exch pop % exp (frac) (int)
- 1 index length % exp (frac) (int) len
- 3 1 roll % exp len (frac) (int)
- exch concatstrings % exp len (int_frac)
- 3 1 roll sub % (int_frac) exp-len
- exch % exp-len (int_frac)
- } if % exp (mant)
- 1 index 0 ge {
- ows { (0) ows } repeat (.) ows
- } {
- dup length % exp (mant) len
- 3 -1 roll add % (mant) exp+len
- dup 0 le {
- (0.) ows neg { (0) ows } repeat ows
- } {
- 2 copy 0 exch getinterval ows
- (.) ows
- 1 index length 1 index sub getinterval ows
- } ifelse
- } ifelse
- } {
- ows
- } ifelse
- } bind
- /stringtype { OFile exch write===only } bind
- /nametype { pdfwritename } bind
- % Composite/reference objects
- /arraytype { pdfwritearray } bind
- /packedarraytype 1 index
- /dicttype { pdfwritedict } bind
-.dicttomark readonly def
-
-/pdfwritevalue { % <obj> pdfwritevalue -
- PDFWRDEBUG { (****Writing: ) print dup === flush } if
- //pdfwritetypes 1 index type get exec
-} bind def
-
-% We make pdfwriteobjdef a separate procedure for external use.
-/pdfwriteobjheader { % <newobj#> pdfwriteobjheader -
- XRef 1 index OFile .fileposition ld_put
- PDFWRDEBUG { (XRef\() print dup =only (\) = ) print XRef 1 index ld_get = } if
- OFile exch write=only ( 0 obj\n) ows
-} bind def
-/pdfwriteobjdef { % <newobj#> <value> pdfwriteobjdef -
- exch pdfwriteobjheader
- pdfwritevalue (\nendobj\n) ows
-} bind def
-/pdfwriteobj { % <obj#> <gen#> pdfwriteobj -
- 1 index exch resolveR exch omap exch pdfwriteobjdef
-} bind def
-
-% ---------------- File-level entities ---------------- %
-
-% Write a PDF file header.
-% Free variables: OFile, PDFversion.
-/pdfwriteheader { % - pdfwriteheader -
- (%PDF-) ows OFile PDFversion write=
- (%\347\363\317\323\n) ows
-} bind def
-
-% Write a cross-reference table and trailer.
-/pdfwritexref { % <firstobj#> <#objs> pdfwritexref -
- (xref\n) ows
- OFile 2 index write=only ( ) ows OFile 1 index write=
- 1 index add 1 sub 1 exch {
- dup 0 eq {
- pop (0000000000 65535 f \n) ows
- } {
- XRef exch ld_get 1000000000 add =string cvs
- dup 0 (0) 0 get put
- ows ( 00000 n \n) ows
- } ifelse
- } for
-} bind def
-/pdfwritetrailer { % <trailer> pdfwritetrailer -
- (trailer\n) ows
- % Since we always write a complete "classic" xref, the Trailer may need to be adjusted:
- % - remove keys that pertain to xref-streams and hybrid-xref PDFs;
- % - if it's a PDF stream, turn it into a PDF dict by removing keys used for
- % PDF streams (both standard and GS-specific), and the executable attribute
- dup /XRefStm known 1 index xcheck or {
- dup length dict copy
- dup {/Type/Index/W /XRefStm /Filter/DecodeParms/Length/File/FilePosition} {
- undef dup
- } forall pop
- % note: the executable attribute is "removed" by not being copied
- } if
- pdfwritevalue
- (\n) ows
-} bind def
-/pdfwritestartxref { % <startpos> pdfwritestartxref -
- (startxref\n) ows OFile exch write=
- (%%EOF\n) ows
-} bind def
-
-% ================ Top-level control ================ %
-
-/pdfwrite { % <file> <trailer> pdfwrite -
- 10 dict begin
- /trailer exch def
- /OFile exch def
- /ToWrite 100 dict def
- omapinit
-
- % Write the PDF file header.
-
- pdfwriteheader
-
- % Write the objects.
-
- trailer {
- exch pop dup xcheck { % The only executable objects are references.
- aload pop pop pdfwriteobj
- } {
- pop
- } ifelse
- } forall
- % Walk the object graph.
- {
- ToWrite dup length dup 0 eq { pop pop exit } if
- 1 sub 2 copy get 3 1 roll undef aload pop pdfwriteobj
- } loop
-
- % Write the xref table and trailer.
-
- /xref OFile fileposition def
- 0 XRef ld_length 1 add pdfwritexref
- trailer dup length 1 add dict copy trailer xcheck { cvx } if
- dup /Size XRef ld_length 1 add put pdfwritetrailer
- xref pdfwritestartxref
-
- end
-} bind def
-
-.setglobal .setlanguagelevel
diff --git a/lib/pftogsf.bat b/lib/pftogsf.bat
deleted file mode 100755
index 2b6dd8ef4..000000000
--- a/lib/pftogsf.bat
+++ /dev/null
@@ -1,20 +0,0 @@
-@echo off
-
-rem ******************************
-rem * Convert .pf? files to .gsf *
-rem ******************************
-
-call "%~dp0gssetgs.bat"
-echo (wrfont.ps) run (unprot.ps) run unprot >"%TEMP%\_temp_.ps"
-echo systemdict /definefont. /definefont load put >>"%TEMP%\_temp_.ps"
-echo systemdict /definefont { userdict /LFN 3 index put definefont. } bind put >>"%TEMP%\_temp_.ps"
-echo ARGUMENTS 0 get (r) file .loadfont LFN findfont setfont prunefont reprot >>"%TEMP%\_temp_.ps"
-echo ARGUMENTS 1 get (w) file dup writefont closefile quit >>"%TEMP%\_temp_.ps"
-rem for %%f in (cyr cyri) do %GSC% -P- -dSAFER -q -dNODISPLAY -dWRITESYSTEMDICT -- _temp_.ps fonts\pfa\%%f.pfa fonts\%%f.gsf
-rem for %%f in (ncrr ncrb ncrri ncrbi) do %GSC% -P- -dSAFER -q -dNODISPLAY -dWRITESYSTEMDICT -- _temp_.ps fonts\pfa\%%f.pfa fonts\%%f.gsf
-rem for %%f in (bchr bchb bchri bchbi) do %GSC% -P- -dSAFER -q -dNODISPLAY -dWRITESYSTEMDICT -- _temp_.ps fonts\pfa\%%f.pfa fonts\%%f.gsf
-rem for %%f in (putr putb putri putbi) do %GSC% -P- -dSAFER -q -dNODISPLAY -dWRITESYSTEMDICT -- _temp_.ps fonts\pfa\%%f.pfa fonts\%%f.gsf
-rem for %%f in (n019003l n021003l u003043t u004006t) do %GSC% -P- -dSAFER -q -dNODISPLAY -dWRITESYSTEMDICT -- _temp_.ps fonts\%%f.gsf %%f.gsf
-for %%f in (hig_____ kak_____) do %GSC% -P- -dSAFER -q -dNODISPLAY -dWRITESYSTEMDICT -- "%TEMP%\_temp_.ps" fonts\pfb\%%f.pfb %%f.gsf
-rem %GSC% -P- -dSAFER -q -dNODISPLAY -dWRITESYSTEMDICT -- _temp_.ps allfonts\baxter.pfb baxter.gsf
-if exist "%TEMP%\_temp_.ps" erase "%TEMP%\_temp_.ps"
diff --git a/lib/ps2ascii.ps b/lib/ps2ascii.ps
index 2b0e2d581..2eadce2e4 100644
--- a/lib/ps2ascii.ps
+++ b/lib/ps2ascii.ps
@@ -250,7 +250,17 @@ ifelse
} odef
/eofill { COMPLEX { .fillcomplex } if newpath } codef
/fill { COMPLEX { .fillcomplex } if newpath } codef
-/rectfill { gsave newpath .rectappend fill grestore } codef
+/rectfill { gsave newpath
+ % .rectappend is deprecated, build the path from scratch
+ %.rectappend
+
+ 3 index 3 index moveto
+ 3 index 3 index 2 index add lineto
+ 3 index 2 index add 3 index 2 index add lineto
+ 3 index 2 index add 3 index lineto
+ pop pop lineto closepath
+
+ fill grestore } codef
/ueofill { gsave newpath uappend eofill grestore } codef
/ufill { gsave newpath uappend fill grestore } codef
diff --git a/lib/quit.ps b/lib/quit.ps
deleted file mode 100644
index ff604669b..000000000
--- a/lib/quit.ps
+++ /dev/null
@@ -1 +0,0 @@
-quit
diff --git a/lib/showchar.ps b/lib/showchar.ps
deleted file mode 100644
index 32a71c686..000000000
--- a/lib/showchar.ps
+++ /dev/null
@@ -1,92 +0,0 @@
-% Copyright (C) 2001-2012 Artifex Software, Inc.
-% All Rights Reserved.
-%
-% This software is provided AS-IS with no warranty, either express or
-% implied.
-%
-% This software is distributed under license and may not be copied,
-% modified or distributed except as expressly authorized under the terms
-% of the license contained in the file LICENSE in this distribution.
-%
-% Refer to licensing information at http://www.artifex.com or contact
-% Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael,
-% CA 94903, U.S.A., +1(415)492-9861, for further information.
-%
-
-% showchar.ps
-% Show the outline and rasterized forms of a character.
-
-/F where { pop } { /F /Times-Roman def } ifelse
-/P where { pop } { /P 16 def } ifelse
-/Rx where { pop } { /Rx 100 def } ifelse
-/Ry where { pop } { /Ry 100 def } ifelse
-/Cs where { pop } { /Cs (M) def } ifelse
-/Pr where { pop } { /Pr false def } ifelse
-/Delay where { pop } { /Delay 0 def } ifelse
-
-0 setgray
-(markpath.ps) runlibfile
-(markhint.ps) runlibfile
-/mmx [1 0 0 1 0 0] def
-/getpath % - getpath <pathproc>
- { [
- { /moveto cvx } { /lineto cvx } { /curveto cvx } { /closepath cvx }
- pathforall
- ] cvx
- } def
-/bitselectfont % <fontname> <scale> bitselectfont -
- { exch findfont exch scalefont setfont
- % Compute the bounding box in device coordinates.
- gsave [Rx 72 div 0 0 Ry 72 div 0 0] setmatrix
- currentfont /FontMatrix get concat
- currentfont /FontBBox get aload pop
- transform ceiling cvi /ury exch def ceiling cvi /urx exch def
- transform floor cvi /lly exch def floor cvi /llx exch def
- /bbx urx llx sub def /bby ury lly sub def
- grestore
- } def
-/bitshow % <string> bitshow -
- { /S exch def gsave
- /W bbx 8 add 7 or 1 add def
- /H bby 8 add def
- /buf W 8 idiv string def
- /M [Rx 72 div 0 0 Ry -72 div 4 llx sub H 4 sub] def
- M W H <ff 00> makeimagedevice
- /dev exch def
- gsave dev setdevice
- newpath 0 lly idtransform moveto
- 0 setgray
- gsave
- /hpath S false charpath getpath def
- grestore
- S show grestore
- 20 20 translate
- 50000 Rx Ry .max P mul div dup scale
- 0.7 setgray
- 0 W H true M
- { dup 1 add exch dev exch buf copyscanlines
- } imagemask pop
- 0 setlinewidth
- gsave 0.5 1 0.5 setrgbcolor hpath exec mmx markpath grestore
- 0 0.5 1 setrgbcolor hpath exec stroke
- % Show the hints for Type 1 fonts also.
- currentfont /FontType get 1 eq
- { gsave 1 0 0 setrgbcolor
- 0 lly M idtransform translate
- currentfont /FontMatrix get
- dup Pr markfonthints
- currentfont /Encoding get S 0 get get exch Pr markcharhints
- grestore
- }
- if
- } def
-F P bitselectfont
-/S1 1 string def
-Cs
- { /C exch def
- currentfont /Encoding get C get /.notdef ne
- { save S1 0 C put S1 bitshow
- showpage restore
- } if
- } forall
-quit
diff --git a/lib/showpage.ps b/lib/showpage.ps
deleted file mode 100644
index 97a4789f7..000000000
--- a/lib/showpage.ps
+++ /dev/null
@@ -1 +0,0 @@
-showpage
diff --git a/lib/traceop.ps b/lib/traceop.ps
index 0b655df04..6d5509b10 100644
--- a/lib/traceop.ps
+++ b/lib/traceop.ps
@@ -25,7 +25,7 @@
/traceflush true def
currentpacking true setpacking
-.currentglobal true .setglobal
+currentglobal true setglobal
% Define the default "before" action
/tracebefore { vmstatus 3 traceprint pop pop pop } def
@@ -56,7 +56,7 @@ currentpacking true setpacking
pop userdict
} if
/.tddict exch def /.tdict exch def /.tname exch cvlit def
- .currentglobal [
+ currentglobal [
.tname /=only cvx ( ) /print cvx
/.tpre load /traceprint cvx /traceend cvx
.tdict .tname get /.tdef 1 index cvlit def
@@ -66,17 +66,17 @@ currentpacking true setpacking
} if
} if
/.tpost load /traceprint cvx () /= cvx /traceend cvx
- .tdef gcheck /.tpre load gcheck and /.tpost load gcheck and .setglobal
+ .tdef gcheck /.tpre load gcheck and /.tpost load gcheck and setglobal
] cvx
.tdef type /operatortype eq {
.tname exch .makeoperator
} if
- exch .setglobal
+ exch setglobal
.tddict exch .tname exch put
end % userdict
} bind def
/tracebind /bind load def % in case someone wants to put it back
/bind { } def % disable
-.setglobal
+setglobal
setpacking
diff --git a/lib/type1enc.ps b/lib/type1enc.ps
deleted file mode 100644
index 42be0cfb2..000000000
--- a/lib/type1enc.ps
+++ /dev/null
@@ -1,64 +0,0 @@
-% Copyright (C) 2001-2012 Artifex Software, Inc.
-% All Rights Reserved.
-%
-% This software is provided AS-IS with no warranty, either express or
-% implied.
-%
-% This software is distributed under license and may not be copied,
-% modified or distributed except as expressly authorized under the terms
-% of the license contained in the file LICENSE in this distribution.
-%
-% Refer to licensing information at http://www.artifex.com or contact
-% Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael,
-% CA 94903, U.S.A., +1(415)492-9861, for further information.
-%
-
-% type1enc.ps
-% PostScript language versions of the Type 1 encryption/decryption algorithms.
-
-% This file is normally not needed with Ghostscript, since Ghostscript
-% implements these algorithms in C. For the specifications, see Chapter 7 of
-% "Adobe Type 1 Font Format," ISBN 0-201-57044-0, published by Addison-Wesley.
-
-/.type1crypt % <R> <from> <to> <proc> .type1crypt <R'> <to>
- % (auxiliary procedure)
- { 4 1 roll
- 0 2 index length getinterval
- 0 1 2 index length 1 sub
- { % Stack: proc R from to index
- 2 index 1 index get % proc R from to index C/P
- 4 index -8 bitshift xor 3 copy put % proc R from to index P/C
- 5 index exec % proc R from to C
-
-% Compute R' = ((R + C) * 52845 + 22719) mod 65536
-% without exceeding a 31-bit integer magnitude, given that
-% 0 <= R <= 65535 and 0 <= C <= 255.
-
- 4 -1 roll add
- dup 20077 mul % 52845 - 32768
- exch 1 and 15 bitshift add % only care about 16 low-order bits
- 22719 add 65535 and 3 1 roll
- }
- for exch pop 3 -1 roll pop
- } bind def
-
-% <state> <fromString> <toString> .type1encrypt <newState> <toSubstring>
-% Encrypts fromString according to the algorithm for Adobe
-% Type 1 fonts, writing the result into toString.
-% toString must be at least as long as fromString or a
-% rangecheck error occurs. state is the initial state of
-% the encryption algorithm (a 16-bit non-negative
-% integer); newState is the new state of the algorithm.
-
-/.type1encrypt
- { { exch pop } .type1crypt
- } bind def
-
-% <state> <fromString> <toString> .type1decrypt <newState> <toSubstring>
-% Decrypts fromString according to the algorithm for Adobe
-% Type 1 fonts, writing the result into toString. Other
-% specifications are as for type1encrypt.
-
-/.type1decrypt
- { { pop 2 index exch get } .type1crypt
- } bind def
diff --git a/lib/type1ops.ps b/lib/type1ops.ps
deleted file mode 100644
index ce9d8d943..000000000
--- a/lib/type1ops.ps
+++ /dev/null
@@ -1,236 +0,0 @@
-% Copyright (C) 2001-2012 Artifex Software, Inc.
-% All Rights Reserved.
-%
-% This software is provided AS-IS with no warranty, either express or
-% implied.
-%
-% This software is distributed under license and may not be copied,
-% modified or distributed except as expressly authorized under the terms
-% of the license contained in the file LICENSE in this distribution.
-%
-% Refer to licensing information at http://www.artifex.com or contact
-% Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael,
-% CA 94903, U.S.A., +1(415)492-9861, for further information.
-%
-
-% type1ops.ps
-% Define the Type 1 and Type 2 font opcodes for use by Ghostscript utilities.
-
-% Define the default value of lenIV.
-% Note that this expects the current font to be on the dictionary stack.
-
-/lenIV { FontType 2 eq { -1 } { 4 } ifelse } def
-
-% ---------------- Encoding ---------------- %
-
-/Type1encode 70 dict
-
- % Data types
-
-dup /nulltype {
- pop ()
-} put
-dup /nametype {
- Type1encode exch get
-} put
-dup /stringtype {
-} put
-dup /integertype {
- dup dup -107 ge exch 107 le and {
- 139 add (x) dup 0 4 -1 roll put
- } {
- dup dup -1131 ge exch 1131 le and {
- dup 0 ge { 16#f694 } { neg 16#fa94 } ifelse add
- (xx) dup dup 0 4 index -8 bitshift put
- 1 4 -1 roll 255 and put
- } {
- (\377xxxx) 1 1 4 {
- dup 8 mul 32 sub 3 index exch bitshift 255 and
- 2 index 3 1 roll put
- } for exch pop
- } ifelse
- } ifelse
-} put
-
- % Operators
-
-% Identical or similar in Type 1 and Type 2.
-/c_hstem 1 def dup /hstem <01> put
-/c_vstem 3 def dup /vstem <03> put
-/c_vmoveto 4 def dup /vmoveto <04> put
-/c_rlineto 5 def dup /rlineto <05> put
-/c_hlineto 6 def dup /hlineto <06> put
-/c_vlineto 7 def dup /vlineto <07> put
-/c_rrcurveto 8 def dup /rrcurveto <08> put
-/c_callsubr 10 def /s_callsubr <0a> def dup /callsubr s_callsubr put
-/c_return 11 def dup /return <0b> put
-/c_escape 12 def
- /ce_div 12 def /s_div <0c0c> def dup /div s_div put
-/c_endchar 14 def /s_endchar <0e> def dup /endchar s_endchar put
-/c_rmoveto 21 def dup /rmoveto <15> put
-/c_hmoveto 22 def dup /hmoveto <16> put
-/c_vhcurveto 30 def dup /vhcurveto <1e> put
-/c_hvcurveto 31 def dup /hvcurveto <1f> put
-% Only in Type 1.
-/c_closepath 9 def dup /closepath <09> put
-/c_hsbw 13 def /s_hsbw <0d> def dup /hsbw s_hsbw put
- /ce_dotsection 0 def /s_dotsection <0c06> def dup /dotsection s_dotsection put
- /ce_vstem3 1 def /s_vstem3 <0c01> def dup /vstem3 s_vstem3 put
- /ce_hstem3 2 def /s_hstem3 <0c02> def dup /hstem3 s_hstem3 put
- /ce_seac 6 def /s_seac <0c06> def dup /seac s_seac put
- /ce_sbw 7 def /s_sbw <0c07> def dup /sbw s_sbw put
- /ce_callothersubr 16 def /s_callothersubr <0c10> def dup /callothersubr s_callothersubr put
- /ce_pop 17 def /s_pop <0c11> def dup /pop s_pop put
- /ce_setcurrentpoint 33 def /s_setcurrentpoint <0c21> def dup /setcurrentpoint s_setcurrentpoint put
- /s_setcurrentpoint_hmoveto s_setcurrentpoint <8b16> concatstrings def
-% Only in Type 2.
-dup /blend <10> put
-dup /hstemhm <12> put
-dup /hintmask <13> put
-dup /cntrmask <14> put
-dup /vstemhm <17> put
-dup /rcurveline <18> put
-dup /rlinecurve <19> put
-dup /vvcurveto <1a> put
-dup /hhcurveto <1b> put
-dup /callgsubr <1d> put
- dup /and <0c03> put
- dup /or <0c04> put
- dup /not <0c05> put
- dup /store <0c08> put
- dup /abs <0c09> put
- dup /add <0c0a> put
- dup /sub <0c0b> put
- dup /load <0c0d> put
- dup /neg <0c0c> put
- dup /eq <0c0f> put
- dup /drop <0c12> put
- dup /put <0c14> put
- dup /get <0c15> put
- dup /ifelse <0c16> put
- dup /random <0c17> put
- dup /mul <0c18> put
- dup /sqrt <0c1a> put
- dup /dup <0c1b> put
- dup /exch <0c1c> put
- dup /index <0c1d> put
- dup /roll <0c1e> put
- dup /hflex <0c22> put
- dup /flex <0c23> put
- dup /hflex1 <0c24> put
- dup /flex1 <0c25> put
-
-readonly def
-
-% ---------------- Decoding ---------------- %
-
-/Type1decode 512 array
-
-Type1encode {
- dup type /stringtype eq {
- dup length 1 eq { 0 get } { 1 get 256 add } ifelse
- % stack: array key code
- exch 2 index 3 1 roll put
- } {
- pop pop
- } ifelse
-} forall
-
-dup 12 {
- dup read pop dup Type1decode exch 256 add get dup null ne
- { exch pop }
- { pop 2 string dup 0 12 put dup 1 4 -1 roll put }
- ifelse
-} put
-dup 28 { % Type 2 only
- dup read pop 128 xor 128 sub 8 bitshift
- 1 index read pop add
-} put
-32 1 246 { 2 copy dup 139 sub put pop } for
-dup 247 { dup read pop 108 add } put
-dup 248 { dup read pop 364 add } put
-dup 249 { dup read pop 620 add } put
-dup 250 { dup read pop 876 add } put
-dup 251 { dup read pop 108 add neg } put
-dup 252 { dup read pop 364 add neg } put
-dup 253 { dup read pop 620 add neg } put
-dup 254 { dup read pop 876 add neg } put
-dup 255 { % Different for Type 1 and Type 2
- dup read pop 128 xor 128 sub
- 3 { 8 bitshift 1 index read pop add } repeat
- FontType 2 eq { 65536.0 div } if
-} put
-
-readonly def
-
-% ---------------- Procedures ---------------- %
-
-% For these utilities, a CharString is represented by a sequence of
-% integers, reals, strings, and names, either in an array or on the stack.
-% Integers and reals represent themselves; strings are other data that
-% appears in the CharString; names are CharString operator names.
-% A CharString in an array is called a "charproc"; a CharString on
-% the stack is called a "charstack", and is delimited by a mark.
-% Individual elements are called "chartokens".
-
-% ------ Encoding ------ %
-
-% Get the string for a chartoken.
-% Note that this string may be overwritten by the next call.
-/chartoken_string { % <chartoken> chartoken_string <string>
- dup type Type1encode exch get exec
-} bind def
-% Compute the length of a CharString.
-/chartoken_length { % <chartoken> chartoken_length <length>
- chartoken_string length
-} bind def
-/charproc_length { % <charproc> charproc_length <length>
- 0 exch { chartoken_length add } forall
-} bind def
-/charstack_length { % <charstack> charstack_length <charstack> <length>
- counttomark 0 exch -1 1 { index chartoken_length add } for
-} bind def
-
-% Write a CharString to a file. Normally this will be a NullEncode filter
-% writing on a string of the correct length.
-/chartoken_write { % <file> <chartoken> chartoken_write -
- chartoken_string writestring
-} bind def
-/charproc_write { % <file> <charproc> charproc_write -
- { 1 index exch chartoken_write } forall pop
-} bind def
-% Note that the arguments of charstack_write are backwards.
-/charstack_write { % <charstack> <file> charstack_write -
- counttomark 1 sub -1 1 { index 1 index exch chartoken_write } for
- cleartomark
-} bind def
-
-% Convert a charproc or charstack to an *un*encrypted CharString.
-/charproc_string { % <charproc> charproc_string <string>
- mark exch aload pop charstack_string
-} bind def
-/charstack_string { % <charstack> charstack_string <string>
- charstack_length lenIV 0 gt {
- lenIV add string
- dup dup length lenIV sub lenIV exch getinterval % skip lenIV
- } {
- string
- } ifelse
- /NullEncode filter
- exch 1 index counttomark 1 add 2 roll
- charstack_write closefile
-% lenIV 0 ge { 4330 exch dup .type1encrypt exch pop readonly } if
-} bind def
-
-% ------ Decoding ------ %
-
-% Decode a CharString (unencrypted).
-/charstack_read { % <file> charstack_read <no-mark-charstack>
- { dup read not { pop exit } if
- Type1decode 1 index get dup null eq {
- pop 1 string dup 0 4 -1 roll put
- } {
- exch pop exec
- } ifelse exch
- } loop
-} bind def
diff --git a/lib/unprot.ps b/lib/unprot.ps
deleted file mode 100644
index d5b1d19ff..000000000
--- a/lib/unprot.ps
+++ /dev/null
@@ -1,66 +0,0 @@
-% Copyright (C) 2001-2012 Artifex Software, Inc.
-% All Rights Reserved.
-%
-% This software is provided AS-IS with no warranty, either express or
-% implied.
-%
-% This software is distributed under license and may not be copied,
-% modified or distributed except as expressly authorized under the terms
-% of the license contained in the file LICENSE in this distribution.
-%
-% Refer to licensing information at http://www.artifex.com or contact
-% Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael,
-% CA 94903, U.S.A., +1(415)492-9861, for further information.
-%
-
-% Disable all access checks. This is useful for printing out
-% eexec-encrypted Type 1 fonts, and similar purposes.
-
-systemdict wcheck
- { /protdict systemdict def
- }
- { (Please restart Ghostscript with the -dWRITESYSTEMDICT switch.\n) print
- (Some access checks will remain active if you do not do this.\n) print
- flush
- /protdict userdict def
- }
-ifelse
-
-% The procedures we're about to define will go in systemdict,
-% so they must be allocated in global VM.
-
-.currentglobal true .setglobal
-
-protdict begin
- /readonly. /readonly load def
- /executeonly. /executeonly load def
- /noaccess. /noaccess load def
- /readonly { } odef
- /readonly.. /readonly load def
- /executeonly { } odef
- /executeonly.. /executeonly load def
- /noaccess { } odef
- /noaccess.. /noaccess load def
-end
-
-% Disable the access checks.
-
-/unprot
- { protdict begin
- /readonly /readonly.. load def
- /executeonly /executeonly.. load def
- /noaccess /noaccess.. load def
- end
- } bind def
-
-% Re-enable the access checks.
-
-/reprot
- { protdict begin
- /readonly /readonly. load def
- /executeonly /executeonly. load def
- /noaccess /noaccess. load def
- end
- } bind def
-
-.setglobal
diff --git a/lib/viewmiff.ps b/lib/viewmiff.ps
index 018550903..4c918ea68 100644
--- a/lib/viewmiff.ps
+++ b/lib/viewmiff.ps
@@ -100,7 +100,7 @@
{ f token pop
dup (:) eq { pop exit } if
dup type /nametype eq {
- .namestring (=) search {
+ 1024 string cvs (=) search {
exch pop miffwords exch .knownget { exec } { pop } ifelse
} {
pop % who knows?
diff --git a/lib/wftopfa b/lib/wftopfa
deleted file mode 100755
index dc8c77913..000000000
--- a/lib/wftopfa
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-# This definition is changed on install to match the
-# executable name set in the makefile
-GS_EXECUTABLE=gs
-gs="`dirname \"$0\"`/$GS_EXECUTABLE"
-if test ! -x "$gs"; then
- gs="$GS_EXECUTABLE"
-fi
-GS_EXECUTABLE="$gs"
-
-exec "$GS_EXECUTABLE" -q -P- -dNODISPLAY -- wftopfa.ps "$@"
diff --git a/lib/wftopfa.ps b/lib/wftopfa.ps
deleted file mode 100644
index 005eaf83f..000000000
--- a/lib/wftopfa.ps
+++ /dev/null
@@ -1,302 +0,0 @@
-% Copyright (C) 2001-2012 Artifex Software, Inc.
-% All Rights Reserved.
-%
-% This software is provided AS-IS with no warranty, either express or
-% implied.
-%
-% This software is distributed under license and may not be copied,
-% modified or distributed except as expressly authorized under the terms
-% of the license contained in the file LICENSE in this distribution.
-%
-% Refer to licensing information at http://www.artifex.com or contact
-% Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael,
-% CA 94903, U.S.A., +1(415)492-9861, for further information.
-%
-
-% wftopfa.ps
-% Convert a Wadalab base font to .PFA (or .PFB) format.
-
-(gs_ksb_e.ps) runlibfile
-(wrfont.ps) runlibfile
-
-/wftopfa_dict 100 dict def
-wftopfa_dict begin
-
-/KanjiSubEncoding dup .findencoding def
-
-% Initialize parameters.
-/init % - init -
- { /chars 256 dict def
- /version (001.001) def
- /highcode 0 def
- /StdHW [32] def
- /StdVW [32] def
- /UniqueID 20000000 def
- /FontBase (Wadalab) def
- /StdEncMode false def
- /CustomEncMode false def
- /Binary false def
- /Encrypt true def
- } bind def
-
-% Read definitions.
-/rdstring 5000 string def
-/readdefs % <filename> readdefs -
- { (r) file
- { dup rdstring readline not { pop exit } if
- dup length 15 ge
- { dup dup length 7 sub 7 getinterval (> CompD) eq
- { token pop exch token pop exch pop
- dup 0 get /highcode exch def
- exch chars 3 1 roll put
- }
- { pop
- }
- ifelse
- }
- { pop
- }
- ifelse
- }
- loop closefile
- } bind def
-
-% Write out the final font.
-/writepfa
- { 4 string highcode 16#1000 add 16 2 index cvrs 0 (.r) putinterval
- FontBase exch concatstrings /fullname exch def
- UniqueID 20000000 eq { /UniqueID 4990000 highcode add def } if
- /encoding CustomEncMode
- { KanjiSubEncoding }
- { StdEncMode { StandardEncoding } { ISOLatin1Encoding } ifelse }
- ifelse def
-
- /Font 30 dict def
- Font begin
- /FontInfo 20 dict def
- FontInfo begin
-
- % Write the clear text part.
-
- /CreationDate (%Calendar%) currentdevparams
- dup /Weekday get {(Sun )(Mon )(Tue )(Wed )(Thu )(Fri )(Sat )} exch get
- 1 index /Month get 1 sub
- {(Jan)(Feb)(Mar)(Apr)(May)(Jun)(Jul)(Aug)(Sep)(Oct)(Nov)(Dec)} exch get
- concatstrings
- {{/Day ( )} {/Hour ( )} {/Minute (:)} {/Second (:)} {/Year ( )}}
- { dup 1 get 3 -1 roll exch concatstrings exch
- 0 get 2 index exch get
- dup 10 lt { =string cvs (0) exch concatstrings } { =string cvs } ifelse
- concatstrings
- }
- forall exch pop readonly def
- /VMusage 100000 def
- /version version readonly def
- /Notice (No copyright on this font. Original available from moe.ipl.t.u-tokyo.ac.jp:/Font. Converted by wftopfa.ps (Artifex Software Inc).) readonly def
- /FullName fullname readonly def
- /FamilyName FontBase readonly def
- /Weight (Regular) readonly def
- /ItalicAngle 0 def
- /isFixedPitch true def
- /UnderlinePosition 0 def
- /UnderlineThickness 0 def
-
- end % FontInfo
-
- /FontName fullname cvn def
- /Encoding encoding def
- /PaintType 0 def
- /FontType 1 def
- /FontMatrix [.001 0 0 .001 0 -0.16] readonly def
- /UniqueID UniqueID def
- /FontBBox [0 0 1000 1000] readonly def
-
- /Private 20 dict def
- Private begin
-
- /-| {string currentfile exch readstring pop} readonly def
- /|- {readonly def} readonly def
- /| {readonly put} readonly def
- /BlueValues [] readonly def
- /OtherBlues [] readonly def
- /MinFeature {16 16} readonly def
- /StdHW StdHW def
- /StdVW StdVW def
- /ForceBold false def
- /password 5839 def
- /UniqueID UniqueID def
- /OtherSubrs [] readonly def
- /Subrs [
- (\020\2771p|\020\024\020=-\223D\\\342R) readonly
- (\020\2771py\274\366Uz) readonly
- (\020\2771py\275\304\236i) readonly
- (\020\2771p\371) readonly
- (\020\2771p~\266+6\034\3446z) readonly
- ] readonly def
-
- end % Private
-
- /CharStrings 256 dict def
- chars
- { exch =string cvs
- dup 0 get highcode eq
- { 1 get encoding exch get exch CharStrings 3 1 roll put }
- { pop pop }
- ifelse
- }
- forall
-
- end % Font
-
- Font /FontName get Font definefont setfont
- (%stdout) (w) file writefont
- } bind def
-
-% Scan the command line and process files.
-/options mark
- /version { 2 copy get /version exch def 1 add } bind
- /StdHW { 2 copy get cvx exec /StdHW exch def 1 add } bind
- /StdVW { 2 copy get cvx exec /StdVW exch def 1 add } bind
- /UniqueId { 2 copy get cvi /UniqueID exch def 1 add } bind
- /UniqueID 1 index
- /FontBase { 2 copy get /FontBase exch def 1 add } bind
- /StdEnc { /StdEncMode true def } bind
- /CustomEnc { /CustomEncMode true def } bind
- /Binary { /Binary true def } bind
- /noEncrypt { /Encrypt false def } bind
-.dicttomark def
-/wftopfa % [(arg1) ...] wftopfa -
- { init dup 0
- { dup 2 index length ge { exit } if
- 2 copy get exch 1 add exch
- options 1 index .knownget { exch pop exec } { readdefs } ifelse
- }
- loop pop pop
- wrfont_dict /binary_CharStrings Binary put
- wrfont_dict /eexec_encrypt Encrypt put
- wrfont_dict /name_all_Encodings CustomEncMode put
- writepfa
- } bind def
-
-end % wftopfa_dict
-
-/wftopfa
- { mark exch wftopfa_dict begin /saved save def { wftopfa } exec false%stopped
- { cleartomark true } { cleartomark false } ifelse
- saved end restore { stop } if
- } bind def
-
-[ shellarguments
- { ] wftopfa }
- { pop }
-ifelse
-
-% ---------------- Root font ---------------- %
-
-% Define the Encoding for the root font.
-/wfrootencoding
-% \x00-\x3F
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 1 2 3 4 5 6 7 8 0 0 0 0 0 0 0
- 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
-% \x40-\x7F
- 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
- 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
- 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
- 73 74 75 76 77 0 0 0 0 0 0 0 0 0 0 0
-% \x80-\xFF
-128 copy
-256 packedarray def
-
-% Define the template for the root font dictionary.
-/wfrootfontdict mark
- /FontType 0
- /FontMatrix [1 0 0 1 0 0]
- /FMapType 2
- /Encoding wfrootencoding
-.dicttomark def
-
-% Define a dummy (placeholder) Type 1 font for the FDepVector.
-/type1dummyfont % <fontname> type1dummyfont <font>
- { mark /FontName 3 -1 roll
- /FontType 1
- /FontMatrix [.001 0 0 .001 0 0]
- /FontBBox [0 0 1000 1000]
- /Encoding /KanjiSubEncoding findencoding
- /CharStrings 0 dict
- /Private mark /BlueValues [] /password 5839 .dicttomark
- .dicttomark dup /FontName get exch definefont
- } bind def
-
-% Write a root font. Again, wrfont.ps does most of the work.
-/makerootfont % <rootname> makerootfont <font>
- { wfrootfontdict dup length 4 add % FontName, FDepVector, PrefEnc, FID
- dict copy begin
- cvlit /FontName exch def
- 4 dict begin
- /len FontName length def
- /str len 4 add string def
- FontName str cvs pop
- str len (.r) putinterval
- /FDepVector [ 16#21 1 16#74
- { dup wfrootencoding exch get 0 eq
- { pop
- }
- { 16 str len 2 add 2 getinterval cvrs pop
- str cvn type1dummyfont
- }
- ifelse
- }
- for end counttomark -1 roll dup counttomark 2 roll
- ] def
- FontName currentdict end definefont
- } bind def
-/writerootfont % <rootname> writerootfont -
- { save exch makerootfont setfont (%stdout) (w) file writefont restore
- } bind def
-
-% ---------------- Converting entire fonts ---------------- %
-
-% Define the directory where the Wadalab fonts are stored.
-/wfdir (/home/ghost/kanji/w) def
-
-% Convert an entire Wadalab font.
-/writeentirefont % <fontname> <template*> writeentirefont -
- { 2 dict begin
- /templates exch def
- /fontname exch def
- [ templates
- { wfdir (/) concatstrings exch concatstrings { copystring }
- 8192 string filenameforall
- }
- forall
- wfdir (/wadalab-sym/*.ps) concatstrings { copystring }
- 8192 string filenameforall
- ]
- (%!\n) print
- { /currentuserparams where
- { pop currentuserparams /VMReclaim get -2 vmreclaim { vmreclaim } }
- { { } }
- ifelse
- } == (exec\n) print
- (/KanjiSubEncoding ) print /KanjiSubEncoding findencoding ==
- (readonly def\n) print
- { (%stderr) (w) file dup 2 index write== flushfile
- mark exch (CustomEnc) (Binary) (noEncrypt)
- (FontBase) fontname counttomark -1 roll ] wftopfa
- }
- forall
- fontname cvn writerootfont
- (exec\n) print
- end
- } def % don't bind, so we can print the procedure
-
-% Convert the Wadalab JIS 1&2 SaiMincho font.
-% To invoke this from the command line,
-% gs -dNODISPLAY -q wftopfa.ps -c writeSaiMincho0 flush quit >wmin0.ps
-% To make the resulting font loadable on demand, add to the Fontmap file:
-% /Wadalab-SaiMincho (wmin0.ps) ;
-/writeSaiMincho0
- { (Wadalab-SaiMincho) [ (wadalab-mincho-0-8/*.ps) ] writeentirefont
- } bind def
diff --git a/lib/wrfont.ps b/lib/wrfont.ps
deleted file mode 100644
index eeab341ac..000000000
--- a/lib/wrfont.ps
+++ /dev/null
@@ -1,664 +0,0 @@
-% Copyright (C) 2001-2012 Artifex Software, Inc.
-% All Rights Reserved.
-%
-% This software is provided AS-IS with no warranty, either express or
-% implied.
-%
-% This software is distributed under license and may not be copied,
-% modified or distributed except as expressly authorized under the terms
-% of the license contained in the file LICENSE in this distribution.
-%
-% Refer to licensing information at http://www.artifex.com or contact
-% Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael,
-% CA 94903, U.S.A., +1(415)492-9861, for further information.
-%
-
-% wrfont.ps
-% Write out a Type 1 font in readable, reloadable form.
-% Note that this does NOT work on protected fonts, such as Adobe fonts
-% (unless you have loaded unprot.ps first, in which case you may be
-% violating the Adobe license).
-
-% ****** NOTE: This file must be kept consistent with gs_pfile.ps.
-
-/wrfont_dict 100 dict def
-wrfont_dict begin
-
-% ------ Options ------ %
-
-% Define whether to use eexec encryption for the font.
-% eexec encryption is only useful for compatibility with Adobe Type Manager
-% and other programs; it only slows Ghostscript down.
- /eexec_encrypt false def
-
-% Define whether to write out the CharStrings in binary or in hex.
-% Binary takes less space on the file, but isn't guaranteed portable.
- /binary_CharStrings false def
-
-% Define whether to use binary token encodings when possible.
-% Binary tokens are smaller and load faster, but are a Level 2 feature.
- /binary_tokens false def
-
-% Define whether to encrypt the CharStrings on the file. (CharStrings
-% are always encrypted in memory.) Unencrypted CharStrings load about
-% 20% slower, but make the files compress much better for transport.
- /encrypt_CharStrings true def
-
-% Define whether the font must provide standard PostScript language
-% equivalents for any facilities it uses that are provided in Ghostscript
-% but are not part of the standard PostScript language.
- /standard_only true def
-
-% Define the value of lenIV to use in writing out the font.
-% use_lenIV = 0 produces the smallest output, but this may not be
-% compatible with old Adobe interpreters. use_lenIV = -1 means
-% use the value of lenIV from the font.
- /use_lenIV -1 def
-
-% Define whether to produce the smallest possible output, relying
-% as much as possible on Ghostscript-specific support code.
-% Taking full advantage of this requires the following settings:
-% binary_CharStrings = true, binary_tokens = true, standard_only = false.
- /smallest_output false def
-
-% Define whether to write out all currently known Encodings by name,
-% or only StandardEncoding and ISOLatin1Encoding.
- /name_all_Encodings false def
-
-% ---------------- Runtime support ---------------- %
-
-/.packedfilefilter where
- { pop }
- { (gs_pfile.ps) runlibfile }
-ifelse
-
-% ------ Output utilities ------ %
-
-% By convention, the output file is named psfile.
-
-% Define some utilities for writing the output file.
- /wtstring 2000 string def
- /wb {psfile exch write} bind def
- /wnb {/wb load repeat} bind def
- /w1 {psfile exch write} bind def
- /ws {psfile exch writestring} bind def
- /wl {ws (\n) ws} bind def
- /wt {wtstring cvs ws ( ) ws} bind def
- /wd % Write a dictionary.
- { dup length wo {dict dup begin} wol { we } forall
- {end} wol
- } bind def
- /wld % Write a large dictionary more efficiently.
- % Ignore the readonly attributes.
- { dup length wo {dict dup begin} wol
- 0 exch
- { exch wo wo () wl
- 1 add dup 200 eq
- { wo ({def} repeat) wl 0 }
- if
- }
- forall
- dup 0 ne
- { wo ({def} repeat) wl }
- { pop }
- ifelse
- (end) ws
- } bind def
- /we % Write a dictionary entry.
- { exch wo wo /def cvx wo (\n) ws
- } bind def
- /wcs % Write a CharString (or Subrs entry)
- { dup type /stringtype eq
- { 4330 exch changelenIV 0 ge
- { % Add some leading garbage bytes.
- wtstring changelenIV 2 index length getinterval
- .type1decrypt exch pop
- wtstring exch 0 exch length changelenIV add getinterval
- }
- { % Drop some leading garbage bytes.
- wtstring .type1decrypt exch pop
- changelenIV neg 1 index length 1 index sub getinterval
- }
- ifelse
- binary_tokens encrypt_CharStrings and
- { % Suppress recognizing the readonly status of the string.
- 4330 exch dup .type1encrypt exch pop wo
- }
- { encrypt_CharStrings
- { 4330 exch dup .type1encrypt exch pop
- } if
- smallest_output
- { wo
- }
- { readonly dup length wo
- binary_tokens not { ( ) ws } if
- readproc ws wx
- }
- ifelse
- }
- ifelse
- }
- { wo % PostScript procedure
- }
- ifelse
- } bind def
-
-% Construct the inversion of the system name table.
- (\210\001) token pop exch pop 1 eq { % i.e., do we have binary tokens?
- /snit 256 dict def
- 0 1 255 {
- (\221 ) dup 1 3 index put
- { token } stopped {
- pop pop
- } {
- % Stack: char () token true
- pop exch pop exch snit 3 1 roll put
- } ifelse
- } for
- } {
- /snit 1 dict def
- } ifelse
-
-% Write an object, using binary tokens if requested and possible.
- /woa % write in ascii
- { psfile exch write==only
- } bind def
-
- % Lookup table for ASCII output.
-
- /intbytes % int nbytes -> byte*
- { { dup 255 and exch -8 bitshift } repeat pop
- } bind def
- /wotta 10 dict dup begin
- { /booleantype /integertype }
- { { ( ) ws woa } def }
- forall
- % Iterate over arrays so we can print operators.
- /arraytype
- { dup xcheck {(}) ({)} {(]) ([)} ifelse ws exch dup wol exch ws wop
- } bind def
- /dicttype
- { ( ) ws wd } def
- /nametype
- { dup xcheck { ( ) ws } if woa
- } bind def
- % Map back operators to their names,
- % so we can write procedures.
- /nulltype
- { pop ( null) ws
- } bind def
- /operatortype
- { wtstring cvs cvn cvx wo
- } bind def
- % Convert reals to integers if possible.
- /realtype
- { dup cvi 1 index eq { cvi wo } { ( ) ws woa } ifelse
- } bind def
- % == truncates strings longer than 200 characters!
- /stringtype
- { (\() ws dup
- { dup dup 32 lt exch 127 ge or
- { (\\) ws dup -6 bitshift 48 add w1
- dup -3 bitshift 7 and 48 add w1
- 7 and 48 add
- }
- { dup dup -2 and 40 eq exch 92 eq or {(\\) ws} if
- }
- ifelse w1
- }
- forall
- (\)) ws wop
- } bind def
- /packedarraytype
- { ([) ws dup { wo } forall
- encodingnames 1 index known
- % This is an encoding, but not one of the standard ones.
- % Use the built-in encoding only if it is available.
- { encodingnames exch get wo
- ({findencoding}stopped{pop) ws
- (}{counttomark 1 add 1 roll cleartomark}ifelse)
- }
- { pop ()
- }
- ifelse
- (/packedarray where{pop counttomark packedarray exch pop}{]readonly}ifelse) ws
- wl
- }
- def
- end def
-
- % Lookup table for binary output.
-
- /wottb 8 dict dup begin
- wotta currentdict copy pop
- /integertype
- { dup dup 127 le exch -128 ge and
- { 136 wb 255 and wb }
- { dup dup 32767 le exch -32768 ge and
- { 134 wb 2 intbytes wb wb }
- { 132 wb 4 intbytes wb wb wb wb }
- ifelse
- }
- ifelse
- } bind def
- /nametype
- { dup snit exch known
- { dup xcheck { 146 } { 145 } ifelse wb
- snit exch get wb
- }
- { wotta /nametype get exec
- }
- ifelse
- } bind def
- /stringtype
- { dup dup length dup 255 le { 142 2 } { 2 intbytes 143 3 } ifelse wnb
- ws wop
- } bind def
- end def
-
- /wop % Write object protection
- { wcheck not { /readonly cvx wo } if
- } bind def
- /wo % Write an object.
- { dup type binary_tokens { wottb } { wotta } ifelse
- exch get exec
- } bind def
- /wol % Write a list of objects.
- { { wo } forall
- } bind def
-
-% Write a hex string for Subrs or CharStrings.
- /wx % string ->
- { binary_CharStrings
- { ws
- }
- { % Some systems choke on very long lines, so
- % we break up the hexstring into chunks of 50 characters.
- { dup length 25 le {exit} if
- dup 0 25 getinterval psfile exch writehexstring (\n) ws
- dup length 25 sub 25 exch getinterval
- } loop
- psfile exch writehexstring
- } ifelse
- } bind def
-
-% ------ CharString encryption utilities ------ %
-
-/enc_dict 20 dict def
-1 dict begin
-/bind { } def % make sure we can print out the procedures
-enc_dict begin
-
-(type1enc.ps) runlibfile
-enc_dict /.type1decrypt undef % we don't need this
-
-end end
-
-enc_dict { 1 index where { pop pop pop } { def } ifelse } forall
-
-% ------ Other utilities ------ %
-
-% Test whether two values are equal (for default dictionary entries).
- /valueeq % <obj1> <obj2> valueeq <bool>
- { 2 copy eq
- { pop pop true }
- { % Special hack for comparing FontMatrix values
- dup type /arraytype eq 2 index type /arraytype eq and
- { dup length 2 index length eq
- { true 0 1 3 index length 1 sub
- { % Stack: arr1 arr2 true index
- 3 index 1 index get 3 index 3 -1 roll get eq not
- { pop false exit }
- if
- }
- for 3 1 roll pop pop
- }
- { pop pop false
- }
- ifelse
- }
- { pop pop false
- }
- ifelse
- }
- ifelse
- } bind def
-
-% ------ The main program ------ %
-
-% Define the dictionary of keys to skip because they are treated specially.
-/.fontskipkeys mark
- /CharStrings dup
- /Encoding dup
- /FDepVector dup
- /FID dup
- /FontInfo dup
- /Metrics dup
- /Metrics2 dup
- /Private dup
-.dicttomark def
-/.minfontskipkeys mark
- .fontskipkeys { } forall
- /FontName dup
- /UniqueID dup
-.dicttomark def
-/.privateskipkeys mark
- /ND dup
- /NP dup
- /RD dup
- /Subrs dup
-.dicttomark def
-/.minprivateskipkeys mark
- .privateskipkeys { } forall
- /MinFeature dup
- /Password dup
- /UniqueID dup
-.dicttomark def
-
-% Define the procedures for the Private dictionary.
-% These must be defined without `bind',
-% for the sake of the DISKFONTS feature.
-4 dict begin
- /-! {string currentfile exch readhexstring pop} def
- /-| {string currentfile exch readstring pop} def
- /|- {readonly def} def
- /| {readonly put} def
-currentdict end /encrypted_procs exch def
-4 dict begin
- /-! {string currentfile exch readhexstring pop
- 4330 exch dup .type1encrypt exch pop} def
- /-| {string currentfile exch readstring pop
- 4330 exch dup .type1encrypt exch pop} def
- /|- {readonly def} def
- /| {readonly put} def
-currentdict end /unencrypted_procs exch def
-
-% Construct an inverse dictionary of encodings.
-/encodingnames mark
- StandardEncoding /StandardEncoding
- ISOLatin1Encoding /ISOLatin1Encoding
- SymbolEncoding /SymbolEncoding
- DingbatsEncoding /DingbatsEncoding
- /resourceforall where
- { pop (*) { cvn dup findencoding exch } 100 string /Encoding resourceforall }
- if
-.dicttomark def
-
-% Invert the standard encodings.
-.knownEncodings length 256 mul dict begin
- 0 .knownEncodings
- { { currentdict 1 index known { pop } { 1 index def } ifelse
- 1 add
- }
- forall
- }
- forall pop
-currentdict end /inverseencodings exch def
-
-/writefont % <psfile> writefont - (writes the current font)
- { /psfile exch def
- /Font currentfont def
- /FontInfo Font /FontInfo .knownget not { 0 dict } if def
- /FontType Font /FontType get def
- /hasPrivate Font /Private known def
- /Private hasPrivate { Font /Private get } { 0 dict } ifelse def
- /readproc binary_CharStrings { (-| ) } { (-! ) } ifelse def
- /privateprocs
- encrypt_CharStrings binary_tokens not and
- { encrypted_procs } { unencrypted_procs } ifelse
- def
- /addlenIV false def
- /changelenIV use_lenIV 0 lt
- { 0 }
- { use_lenIV Private /lenIV .knownget not
- { 4 /addlenIV use_lenIV 4 ne def } if sub }
- ifelse def
- /minimize
- smallest_output
- FontType 1 eq and
- Font /UniqueID known and
- def
- (%!FontType) ws FontType wtstring cvs ws (-1.0: ) ws
- currentfont /FontName get wt
- FontInfo /version .knownget not { (001.001) } if wl
- FontInfo /CreationDate .knownget { (%%Creation Date: ) ws wl } if
- FontInfo /VMusage .knownget
- { (%%VMusage: ) ws dup wt wtstring cvs wl }
- if
- (systemdict begin) wl
-
-% If we're going to use eexec, create the filters now.
- /realpsfile psfile def
- eexec_encrypt
- { /eexecfilter psfile binary_CharStrings not
- { pop /bxstring 35 string def
- { pop dup length 0 ne
- { realpsfile exch writehexstring realpsfile (\n) writestring }
- { pop }
- ifelse bxstring
- }
- /NullEncode filter dup /hexfilter exch def
- }
- if 55665 /eexecEncode filter def
- }
- if
-
-% Turn on binary tokens if relevant.
- binary_tokens { (currentobjectformat 1 setobjectformat) wl } if
-
-% If the file has a UniqueID, write out a check against loading it twice.
- minimize
- { Font /FontName get wo
- Font /UniqueID get wo
- Private length addlenIV { 1 add } if wo
- Font length 1 add wo % +1 for FontFile
- ( .checkexistingfont) wl
- }
- { Font /UniqueID known
- { ({} FontDirectory) ws Font /FontName get dup wo ( known) wl
- ( {) ws wo ( findfont dup /UniqueID known) wl
- ( { dup /UniqueID get) ws Font /UniqueID get wo ( eq exch /FontType get 1 eq and }) wl
- ( { pop false } ifelse) wl
- ( { pop save /restore load } if) wl
- ( } if) wl
- }
- if
- }
- ifelse
-
-% If we are writing unencrypted CharStrings for a standard environment,
-% write out the encryption procedures.
- privateprocs unencrypted_procs eq standard_only and
- { (systemdict /.type1encrypt known) wl
- ( { save /restore load } { { } } ifelse) wl
- (userdict begin) wl
- enc_dict { we } forall
- (end exec) wl
- }
- if
-
-% Write out the creation of the font dictionary and FontInfo.
- minimize not
- { Font length 1 add wo {dict begin} wol % +1 for FontFile
- }
- if
- (/FontInfo ) ws FontInfo wd {readonly def} wol
-
-% Write out the other fixed entries in the font dictionary.
- Font begin
- Font
- { minimize
- { .minfontskipkeys 2 index known
- { pop pop
- }
- { //.compactfontdefault 2 index .knownget
- { 1 index valueeq { pop pop } { we } ifelse }
- { we }
- ifelse
- }
- ifelse
- }
- { .fontskipkeys 2 index known { pop pop } { we } ifelse
- }
- ifelse
- } forall
- /Encoding
- encodingnames Encoding known
- name_all_Encodings
- Encoding StandardEncoding eq or
- Encoding ISOLatin1Encoding eq or and
- { encodingnames Encoding get cvx }
- { Encoding }
- ifelse
- dup /StandardEncoding cvx eq minimize and
- { pop pop }
- { we }
- ifelse
-
-% Write the FDepVector, if any.
- Font /FDepVector .knownget
- { {/FDepVector [} wol
- { /FontName get wo {findfont} wol () wl } forall
- {] readonly def} wol
- }
- if
-
-% Write out the Metrics, if any.
- Font /Metrics .knownget
- { (/Metrics ) ws wld {readonly def} wol
- }
- if
- Font /Metrics2 .knownget
- { (/Metrics2 ) ws wld {readonly def} wol
- }
- if
-
-% Start the eexec-encrypted section, if applicable.
- eexec_encrypt
- { {currentdict currentfile eexec} wol () wl
- /psfile eexecfilter store
- (\000\000\000\000) ws {begin} wol
- }
- if
-
-% Create and initialize the Private dictionary, if any.
- hasPrivate
-{
- Private
- minimize
- { begin {Private dup begin}
- }
- { dup length privateprocs length add dict copy begin
- privateprocs { readonly def } forall
- /Private wo
- currentdict length 1 add wo {dict dup begin}
- }
- ifelse wol () wl
- currentdict
- { 1 index minimize { .minprivateskipkeys } { .privateskipkeys } ifelse
- exch known
- { pop pop }
- { 1 index /lenIV eq use_lenIV 0 ge and { pop use_lenIV } if we }
- ifelse
- } forall
- addlenIV { /lenIV use_lenIV we } if
-}
-if
-
-% Write the Subrs entries, if any.
- currentdict /Subrs known
- { (/Subrs[) wl
- Subrs
- { dup null ne
- { wcs minimize not { () wl } if }
- { pop /null cvx wo }
- ifelse
- } forall
- {] dup {readonly pop} forall readonly def} wol () wl
- }
- if
-
-% Wrap up the Private dictionary.
- hasPrivate
- { end % Private
- minimize
- { {end readonly pop} } % Private
- { {end readonly def} } % Private in font
- ifelse wol
- }
- if
-
-% Write the CharStrings entries.
-% Detect identical (eq) entries, which bdftops produces.
- currentdict /CharStrings known
-{
- /CharStrings wo CharStrings length wo
- minimize
- { encrypt_CharStrings not wo ( .readCharStrings) wl
- CharStrings length dict
- CharStrings
- { exch inverseencodings 1 index .knownget not { dup } if wo
- % Stack: vdict value key
- 3 copy pop .knownget { wo pop pop } { 3 copy put pop wcs } ifelse
- } forall
- }
- { {dict dup Private begin begin} wol () wl
- CharStrings length dict
- CharStrings
- { 2 index 1 index known
- { exch wo 1 index exch get wo {load def} wol () wl
- }
- { 2 index 1 index 3 index put
- exch wo wcs ( |-) wl
- }
- ifelse
- } forall
- {end end} wol
- }
- ifelse
- pop
- { readonly def } % CharStrings in font
- wol
-}
-if
-
-% Terminate the output.
- end % Font
- eexec_encrypt
- { {end mark currentfile closefile} wol () wl
- eexecfilter dup flushfile closefile % psfile is eexecfilter
- binary_CharStrings not { hexfilter dup flushfile closefile } if
- /psfile realpsfile store
- 8
- { (0000000000000000000000000000000000000000000000000000000000000000)
- wl
- }
- repeat {cleartomark} wol
- }
- if
- { FontName currentdict end definefont pop
- }
- wol
- Font /UniqueID known { /exec cvx wo } if
- binary_tokens { /setobjectformat cvx wo } if
- ( end) wl % systemdict
-
- } bind def
-
-% ------ Other utilities ------ %
-
-% Prune garbage characters and OtherSubrs out of the current font,
-% if the relevant dictionaries are writable.
-/prunefont
- { currentfont /CharStrings get wcheck
- { currentfont /CharStrings get dup [ exch
- { pop dup (S????00?) .stringmatch not { pop } if
- } forall
- ] { 2 copy undef pop } forall pop
- }
- if
- } bind def
-
-end % wrfont_dict
-
-/writefont { wrfont_dict begin writefont end } def