summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlgs/lib
diff options
context:
space:
mode:
authorReinhard Kotucha <reinhard.kotucha@web.de>2017-10-05 20:49:39 +0000
committerReinhard Kotucha <reinhard.kotucha@web.de>2017-10-05 20:49:39 +0000
commitfda5435ca272bab86872d2627667b5b259eb5423 (patch)
tree2211c66243a4658b14be60b857eb92348579c069 /Master/tlpkg/tlgs/lib
parent6da90753bb28081fe69076b75057451a26501c67 (diff)
Upgrade gs-9.21 -> gs-9.22
git-svn-id: svn://tug.org/texlive/trunk@45477 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlgs/lib')
-rw-r--r--Master/tlpkg/tlgs/lib/addxchar.ps356
-rw-r--r--Master/tlpkg/tlgs/lib/decrypt.ps14
-rw-r--r--Master/tlpkg/tlgs/lib/font2c.ps674
-rw-r--r--Master/tlpkg/tlgs/lib/font2pcl.ps600
-rw-r--r--Master/tlpkg/tlgs/lib/gs_pfile.ps126
-rw-r--r--Master/tlpkg/tlgs/lib/gs_rdlin.ps19
-rw-r--r--Master/tlpkg/tlgs/lib/impath.ps178
-rw-r--r--Master/tlpkg/tlgs/lib/level1.ps2
-rw-r--r--Master/tlpkg/tlgs/lib/markhint.ps129
-rw-r--r--Master/tlpkg/tlgs/lib/markpath.ps58
-rw-r--r--Master/tlpkg/tlgs/lib/packfile.ps332
-rw-r--r--Master/tlpkg/tlgs/lib/pcharstr.ps125
-rw-r--r--Master/tlpkg/tlgs/lib/pdfwrite.ps396
-rw-r--r--Master/tlpkg/tlgs/lib/ps2ascii.ps1523
-rw-r--r--Master/tlpkg/tlgs/lib/ps2epsi.ps4
-rw-r--r--Master/tlpkg/tlgs/lib/quit.ps1
-rw-r--r--Master/tlpkg/tlgs/lib/showchar.ps92
-rw-r--r--Master/tlpkg/tlgs/lib/showpage.ps1
-rw-r--r--Master/tlpkg/tlgs/lib/traceop.ps10
-rw-r--r--Master/tlpkg/tlgs/lib/type1enc.ps64
-rw-r--r--Master/tlpkg/tlgs/lib/type1ops.ps236
-rw-r--r--Master/tlpkg/tlgs/lib/unprot.ps66
-rw-r--r--Master/tlpkg/tlgs/lib/viewmiff.ps2
-rw-r--r--Master/tlpkg/tlgs/lib/viewpbm.ps8
-rw-r--r--Master/tlpkg/tlgs/lib/wftopfa.ps302
-rw-r--r--Master/tlpkg/tlgs/lib/wrfont.ps664
26 files changed, 13 insertions, 5969 deletions
diff --git a/Master/tlpkg/tlgs/lib/addxchar.ps b/Master/tlpkg/tlgs/lib/addxchar.ps
deleted file mode 100644
index d9027d6046c..00000000000
--- a/Master/tlpkg/tlgs/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/Master/tlpkg/tlgs/lib/decrypt.ps b/Master/tlpkg/tlgs/lib/decrypt.ps
deleted file mode 100644
index 92249182885..00000000000
--- a/Master/tlpkg/tlgs/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/Master/tlpkg/tlgs/lib/font2c.ps b/Master/tlpkg/tlgs/lib/font2c.ps
deleted file mode 100644
index dffc24745e0..00000000000
--- a/Master/tlpkg/tlgs/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/Master/tlpkg/tlgs/lib/font2pcl.ps b/Master/tlpkg/tlgs/lib/font2pcl.ps
deleted file mode 100644
index df0c92d7279..00000000000
--- a/Master/tlpkg/tlgs/lib/font2pcl.ps
+++ /dev/null
@@ -1,600 +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.
-%
-
-% font2pcl.ps
-% Write out a font as a PCL bitmap font.
-
-/pcldict 60 dict def
-
-% Write out the current font as a PCL bitmap font.
-% The current transformation matrix defines the font size and orientation.
-
-/WriteResolution? false def % true=use "resolution bound font" format,
- % false=use older format
-
-/LJ4 false def % true=use LJ4 Typeface code
- % false=use LJIIP/IID/IIIx Typeface code
-
-pcldict begin % internal procedures
-
-/findstring % <string> <substring> findstring <bool>
- { search { pop pop pop true } { pop false } ifelse
- } def
-
- % Determine which set of keywords is present in a string.
- % The last keyword set must be empty.
-
-/keysearch % <string> <array of arrays of keywords> keysearch <index>
- { 0 1 2 index length 1 sub
- { 2 copy get true exch
- { % Stack: <string> <a.a.k.> <index> <bool> <keyword>
- 4 index exch findstring and
- }
- forall
- { 0 exch getinterval exit
- }
- if pop
- }
- for
- exch pop length % invalid index if missing
- } def
-
- % Determine the device height of a string in quarter-dots.
-
-/charheight % <string> charheight <int>
- { gsave newpath 0 0 moveto false charpath
- pathbbox exch pop exch sub exch pop 0 exch grestore
- dtransform add abs 4 mul cvi
- } def
-
- % Compute an integer version of the transformed FontBBox.
-
-/inflate % <num> inflate <num>
- { dup 0 gt { ceiling } { floor } ifelse
- } def
-/ixbbox % - ixbbox <llx> <lly> <urx> <ury>
- { /FontBBox load aload pop % might be executable or literal
- 4 2 roll transform exch truncate cvi exch truncate cvi
- 4 2 roll transform exch inflate cvi exch inflate cvi
- } def
-
- % Determine the original font of a possibly transformed font.
- % Since some badly behaved PostScript files construct transformed
- % fonts "by hand", we can't just rely on the OrigFont pointers.
- % Instead, if a font with the given name exists, and if its
- % entries for FontType and UniqueID match those of the font we
- % obtain by following the OrigFont chain, we use that font.
-
-/origfont
- { { dup /OrigFont known not { exit } if /OrigFont get } loop
- FontDirectory 1 index /FontName get .knownget
- { % Stack: origfont namedfont
- 1 index /FontType get 1 index /FontType get eq
- { 1 index /UniqueID .knownget
- { 1 index /UniqueID .knownget
- { eq { exch } if }
- { pop }
- ifelse
- }
- if
- }
- if pop
- }
- if
- } def
-
- % Determine the bounding box of the current device's image.
- % Free variables: row, zerow.
-
-/devbbox % <rw> <rh> devbbox <ymin> <ymax1> <xmin> <xmax1>
- { % Find top and bottom whitespace.
- dup
- { dup 0 eq { exit } if 1 sub
- dup currentdevice exch row copyscanlines
- zerow ne { 1 add exit } if
- }
- loop % ymax1
- 0
- { 2 copy eq { exit } if
- dup currentdevice exch row copyscanlines
- zerow ne { exit } if
- 1 add
- }
- loop % ymin
- exch
- % Find left and right whitespace.
- 3 index 0
- % Stack: rw rh ymin ymax1 xmin xmax1
- 3 index 1 4 index 1 sub
- { currentdevice exch row copyscanlines .findzeros
- exch 4 1 roll .max 3 1 roll .min exch
- }
- for % xmin xmax1
- % Special check: xmin > xmax1 if height = 0
- 2 copy gt { exch pop dup } if
- 6 -2 roll pop pop
-
- } def
-
- % Write values on outfile.
-
- /w1 { 255 and outfile exch write } def
- /w2 { dup -8 bitshift w1 w1 } def
- /wbyte % <byte> <label> wbyte
- { VDEBUG { print ( =byte= ) print dup == flush } { pop } ifelse w1
- } def
- /wword % <word16> <label> wword
- { VDEBUG { print ( =word= ) print dup == flush } { pop } ifelse w2
- } def
- /wdword % <word32> <label> wdword
- { VDEBUG { print ( =dword= ) print dup == flush } { pop } ifelse
- dup -16 bitshift w2 w2
- } def
-
-/style.posture.keys
- [ { (Italic) } { (Oblique) }
- { }
- ] def
-/style.posture.values <010100> def
-
-/style.appearance.width.keys
- [ { (Ultra) (Compressed) }
- { (Extra) (Compressed) }
- { (Extra) (Condensed) }
- { (Extra) (Extended) }
- { (Extra) (Expanded) }
- { (Compressed) }
- { (Condensed) }
- { (Extended) }
- { (Expanded) }
- { }
- ] def
-/style.appearance.width.values <04030207070201060600> def
-
-/width.type.keys
- [ { (Ultra) (Compressed) }
- { (Extra) (Compressed) }
- { (Extra) (Condensed) }
- { (Extra) (Expanded) }
- { (Compressed) }
- { (Condensed) }
- { (Expanded) }
- { }
- ] def
-/width.type.values <fbfcfd03fdfe0200> def
-
-/stroke.weight.keys
- [ { (Ultra) (Thin) }
- { (Ultra) (Black) }
- { (Extra) (Thin) }
- { (Extra) (Light) }
- { (Extra) (Bold) }
- { (Extra) (Black) }
- { (Demi) (Light) }
- { (Demi) (Bold) }
- { (Semi) (Light) }
- { (Semi) (Bold) }
- { (Thin) }
- { (Light) }
- { (Bold) }
- { (Black) }
- { }
- ] def
-/stroke.weight.values <f907fafc0406fe02ff01fbfd030500> def
-
-/vendor.keys
- [ { (Agfa) }
- { (Bitstream) }
- { (Linotype) }
- { (Monotype) }
- { (Adobe) }
- { }
- ] def
-/vendor.default.index 4 def % might as well be Adobe
-/old.vendor.values <020406080a00> def
-/new.vendor.values <010203040500> def
-/vendor.initials (CBLMA\000) def
-
-currentdict readonly end pop % pcldict
-
-% Convert and write a PCL font for the current font and transformation.
-
-% Write the font header. We split this off only to avoid overflowing
-% the limit on the maximum size of a procedure.
-% Free variables: outfile uury u0y rw rh orientation uh ully
-/writefontheader
- { outfile (\033\)s) writestring
- outfile 64 WriteResolution? { 4 add } if
- Copyright length add write==only
- outfile (W) writestring
- WriteResolution? { 20 68 } { 0 64 } ifelse
- (Font Descriptor Size) wword
- (Header Format) wbyte
- 1 (Font Type) wbyte
- FullName style.posture.keys keysearch style.posture.values exch get
- FullName style.appearance.width.keys keysearch
- style.appearance.width.values exch get 4 mul add
- PaintType 2 eq { 32 add } if
- /style exch def
- style -8 bitshift (Style MSB) wbyte
- 0 (Reserved) wbyte
- /baseline uury 1 sub u0y sub def
- baseline (Baseline Position) wword
- rw (Cell Width) wword
- rh (Cell Height) wword
- orientation (Orientation) wbyte
- FontInfo /isFixedPitch .knownget not { false } if
- { 0 } { 1 } ifelse (Spacing) wbyte
- % Use loop/exit to fake a multiple-exit block.
- { Encoding StandardEncoding eq { 10 (J) exit } if
- Encoding ISOLatin1Encoding eq { 11 (J) exit } if
- Encoding SymbolEncoding eq { 19 (M) exit } if
- Encoding DingbatsEncoding eq { 10 (L) exit } if
-% (Warning: unknown Encoding, using ISOLatin1.\n) print flush
- 11 (J) exit
- }
- loop
- 0 get 64 sub exch 32 mul add (Symbol Set) wword
- ( ) stringwidth pop 0 dtransform add abs 4 mul
- /pitch exch def
- pitch cvi (Pitch) wword
- uh 4 mul (Height) wword % Height
- (x) charheight (x-Height) wword
- FullName width.type.keys keysearch
- width.type.values exch get (Width Type) wbyte
- style 255 and (Style LSB) wbyte
- FullName stroke.weight.keys keysearch
- stroke.weight.values exch get (Stroke Weight) wbyte
- FullName vendor.keys keysearch
- dup vendor.initials exch get 0 eq
- { % No vendor in FullName, try Notice
- pop Copyright vendor.keys keysearch
- dup vendor.initials exch get 0 eq { pop vendor.default.index } if
- }
- if
- /vendor.index exch def
- 0 (Typeface LSB) wbyte % punt
- 0 (Typeface MSB) wbyte % punt
- 0 (Serif Style) wbyte % punt
- 2 (Quality) wbyte
- 0 (Placement) wbyte
- gsave FontMatrix concat rot neg rotate
- /ulwidth
- FontInfo /UnderlineThickness .knownget
- { 0 exch dtransform exch pop abs }
- { resolution 100 div }
- ifelse def
- FontInfo /UnderlinePosition .knownget
- { 0 exch transform exch pop negY ulwidth 2 div add }
- { ully ulwidth add }
- ifelse u0y sub
- round cvi 1 .max 255 .min (Underline Position) wbyte
- ulwidth round cvi 1 .max 255 .min (Underline Thickness) wbyte
- grestore
- uh 1.2 mul 4 mul cvi (Text Height) wword
- (average lowercase character) dup stringwidth
- pop 0 dtransform add abs
- exch length div 4 mul cvi (Text Width) wword
- 0
- { dup Encoding exch get /.notdef ne { exit } if
- 1 add
- }
- loop (First Code) wword
- 255
- { dup Encoding exch get /.notdef ne { exit } if
- 1 sub
- }
- loop (Last Code) wword
- pitch dup cvi sub 256 mul cvi (Pitch Extended) wbyte
- 0 (Height Extended) wbyte
- 0 (Cap Height) wword % (default)
- currentfont /UniqueID known { UniqueID } { 0 } ifelse
- 16#c1000000 add (Font Number (Adobe UniqueID)) wdword
- FontName length 16 .max string
- dup FontName exch cvs pop
- outfile exch 0 16 getinterval writestring % Font Name
- WriteResolution?
- { resolution dup (X Resolution) wword (Y Resolution) wword
- }
- if
- outfile Copyright writestring % Copyright
- } def
-
-/writePCL % <fontfile> <resolution> writePCL -
- {
- save
- currentfont begin
- pcldict begin
- 80 dict begin % allow for recursion
- /saved exch def
- /resolution exch def
- /outfile exch def
- matrix currentmatrix dup 4 0 put dup 5 0 put setmatrix
-
- % Supply some default values so we don't have to check later.
-
- currentfont /FontInfo known not { /FontInfo 1 dict def } if
- currentfont /FontName known not { /FontName () def } if
- /Copyright FontInfo /Notice .knownget not { () } if def
- /FullName
- FontInfo /FullName .knownget not
- { FontName dup length string cvs }
- if def
-
- % Determine the original font, and its relationship to this one.
-
- /OrigFont currentfont origfont def
- /OrigMatrix OrigFont /FontMatrix get def
- /OrigMatrixInverse OrigMatrix matrix invertmatrix def
- /ScaleMatrix matrix currentfont OrigFont ne
- { FontMatrix exch OrigMatrixInverse exch concatmatrix
- } if
- def
- /CurrentScaleMatrix
- matrix currentmatrix
- matrix defaultmatrix
- dup 0 get 1 index 3 get mul 0 lt
- 1 index dup 1 get exch 2 get mul 0 gt or
- /flipY exch def
- dup invertmatrix
- dup concatmatrix
- def
- /negY flipY { {neg} } { {} } ifelse def
-
- % Print debugging information.
-
- /CDEBUG where { pop } { /CDEBUG false def } ifelse
- /VDEBUG where { pop } { /VDEBUG false def } ifelse
- CDEBUG { /VDEBUG true def } if
- DEBUG
- { (currentmatrix: ) print matrix currentmatrix ==
- (defaultmatrix: ) print matrix defaultmatrix ==
- (flipY: ) print flipY ==
- (scaling matrix: ) print CurrentScaleMatrix ==
- (FontMatrix: ) print FontMatrix ==
- (FontBBox: ) print /FontBBox load ==
- currentfont OrigFont ne
- { OrigFont /FontName .knownget { (orig FontName: ) print == } if
- (orig FontMatrix: ) print OrigMatrix ==
- } if
- currentfont /ScaleMatrix .knownget { (ScaleMatrix: ) print == } if
- gsave
- FontMatrix concat
- (combined matrix: ) print matrix currentmatrix ==
- grestore
- flush
- } if
-
- % Determine the orientation.
-
- ScaleMatrix matrix currentmatrix dup concatmatrix
- 0 1 3
- { 1 index 1 get 0 eq 2 index 2 get 0 eq and 2 index 0 get 0 gt and
- { exit } if
- pop -90 matrix rotate exch dup concatmatrix
- }
- for
- dup type /integertype ne
- { (Only rotations by multiples of 90 degrees are supported:\n) print
- == flush
- saved end end end restore stop
- }
- if
- /orientation exch def
- /rot orientation 90 mul def
- DEBUG { (orientation: ) print orientation == flush } if
-
- 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 ==
- matrix defaultmatrix == flush
- saved end end end restore stop
- }
- if pop
-
- % Determine the font metrics, in the PCL character coordinate system,
- % which has +Y going towards the top of the page.
-
- gsave
- FontMatrix concat
- 0 0 transform
- negY round cvi /r0y exch def
- round cvi /r0x exch def
- ixbbox
- negY /rury exch def /rurx exch def
- negY /rlly exch def /rllx exch def
- /rminx rllx rurx .min def
- /rminy rlly negY rury negY .min def
- /rw rurx rllx sub abs def
- /rh rury rlly sub abs def
- gsave rot neg rotate
- 0 0 transform
- negY round cvi /u0y exch def
- round cvi /u0x exch def
- ixbbox
- negY /uury exch def /uurx exch def
- negY /ully exch def /ullx exch def
- /uw uurx ullx sub def
- /uh uury ully sub def
- grestore
- DEBUG
- { (rmatrix: ) print matrix currentmatrix ==
- (rFontBBox: ) print [rllx rlly rurx rury] ==
- (uFontBBox: ) print [ullx ully uurx uury] ==
- flush
- } if
- grestore
-
- % Disable the character cache, to avoid excessive allocation
- % and memory sandbars.
-
- mark cachestatus /upper exch def
- cleartomark 0 setcachelimit
-
- % Write the font header.
-
- writefontheader
-
- % Establish an image device for rasterizing characters.
-
- matrix currentmatrix
- dup 4 rminx neg put
- dup 5 rminy neg put
- % Round the width up to a multiple of 8
- % so we don't get garbage bits in the last byte of each row.
- rw 7 add -8 and rh <ff 00> makeimagedevice
- /cdevice exch def
- nulldevice % prevent page device switching
- cdevice setdevice
-
- % Rasterize each character in turn.
-
- /raster rw 7 add 8 idiv def
- /row raster string def
- /zerow row length string def
- 0 1 Encoding length 1 sub
- { /cindex exch def
- Encoding cindex get /.notdef ne
- { VDEBUG { Encoding cindex get == flush } if
- erasepage initgraphics
- 0 0 moveto currentpoint transform add
- ( ) dup 0 cindex put show
- currentpoint transform add exch sub round cvi
- /cwidth exch abs def
- rw rh devbbox
- VDEBUG
- { (image bbox: ) print 4 copy 4 2 roll 4 array astore == flush
- } if
- % Save the device bounding box.
- % Note that this is in current device coordinates,
- % not PCL (right-handed) coordinates.
- /bqx exch def /bpx exch def /bqy exch def /bpy exch def
- % Re-render with the character justified to (0,0).
- % This may be either the lower left or the upper left corner.
- bpx neg bpy neg idtransform moveto
- erasepage
- VDEBUG { (show point: ) print [ currentpoint transform ] == flush } if
- ( ) dup 0 cindex put show
- % Find the bounding box. Note that xmin and ymin are now 0,
- % xmax1 = xw, and ymax1 = yh.
- rw rh devbbox
- /xw exch def
- % xmin or ymin can be non-zero only if the character is blank.
- xw 0 eq
- { pop }
- { dup 0 ne { (Non-zero xmin! ) print = } { pop } ifelse }
- ifelse
- /yh exch def
- yh 0 eq
- { pop }
- { dup 0 ne { (Non-zero ymin! ) print = } { pop } ifelse }
- ifelse
-
- /xbw xw 7 add 8 idiv def
- /xright raster 8 mul xw sub def
- % Write the Character Code command.
- outfile (\033*c) writestring
- outfile cindex write==only
- outfile (E) writestring
- % Write the Character Definition command.
- outfile (\033\(s) writestring
- yh xbw mul 16 add
- outfile exch write=only
- % Record the character position for the .PCM file.
- /cfpos outfile fileposition 1 add def
- outfile (W\004\000\016\001) writestring
- orientation (Orientation) wbyte 0 (Reserved) wbyte
- rminx bpx add r0x sub (Left Offset) wword
- flipY { rminy bpy add neg } { rminy bqy add } ifelse r0y sub
- (Top Offset) wword
- xw (Character Width) wword
- yh (Character Height) wword
- cwidth orientation 2 ge { neg } if 4 mul (Delta X) wword
- % Write the character data.
- flipY { 0 1 yh 1 sub } { yh 1 sub -1 0 } ifelse
- { cdevice exch row copyscanlines
- 0 xbw getinterval
- CDEBUG
- { dup
- { 8
- { dup 128 ge { (+) } { (.) } ifelse print
- 127 and 1 bitshift
- }
- repeat pop
- }
- forall (\n) print
- }
- if
- outfile exch writestring
- }
- for
- }
- { /bpx 0 def /bpy 0 def /bqx 0 def /bqy 0 def
- /cwidth 0 def
- /cfpos 0 def
- }
- ifelse
-
- }
- for
-
- % Wrap up.
-
- upper setcachelimit
- outfile closefile
-
- nulldevice % prevent page device switching
- saved end end end restore
-
- } def
-
-% Provide definitions for testing with older or non-custom interpreters.
-
-/.findzeros where { pop (%END) .skipeof } if
-/.findzeros
- { userdict begin /zs exch def /zl zs length def
- 0 { dup zl ge { exit } if dup zs exch get 0 ne { exit } if 1 add } loop
- zl { dup 0 eq { exit } if dup 1 sub zs exch get 0 ne { exit } if 1 sub } loop
- exch 3 bitshift exch 3 bitshift
- 2 copy lt
- { exch zs 1 index -3 bitshift get
- { dup 16#80 and 0 ne { exit } if exch 1 add exch 1 bitshift } loop pop
- exch zs 1 index -3 bitshift 1 sub get
- { dup 1 and 0 ne { exit } if exch 1 sub exch -1 bitshift } loop pop
- }
- if end
- } bind def
-%END
-
-/write=only where { pop (%END) .skipeof } if
-/w=s 128 string def
-/write=only
- { w=s cvs writestring
- } bind def
-%END
-
-%**************** Test
-/PCLTEST where {
- pop
- /DEBUG true def
- /CDEBUG true def
- /VDEBUG true def
- /Times-Roman findfont 10 scalefont setfont
- (t.pcf) (w) file
- 300 72 div dup scale
- 300 writePCL
- flush quit
-} if
diff --git a/Master/tlpkg/tlgs/lib/gs_pfile.ps b/Master/tlpkg/tlgs/lib/gs_pfile.ps
deleted file mode 100644
index 1118d8aa567..00000000000
--- a/Master/tlpkg/tlgs/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/Master/tlpkg/tlgs/lib/gs_rdlin.ps b/Master/tlpkg/tlgs/lib/gs_rdlin.ps
deleted file mode 100644
index aefd6d00438..00000000000
--- a/Master/tlpkg/tlgs/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/Master/tlpkg/tlgs/lib/impath.ps b/Master/tlpkg/tlgs/lib/impath.ps
deleted file mode 100644
index 8ddc1ef1a89..00000000000
--- a/Master/tlpkg/tlgs/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/Master/tlpkg/tlgs/lib/level1.ps b/Master/tlpkg/tlgs/lib/level1.ps
deleted file mode 100644
index b4c53c1a453..00000000000
--- a/Master/tlpkg/tlgs/lib/level1.ps
+++ /dev/null
@@ -1,2 +0,0 @@
-%!
-/.setlanguagelevel where { pop 1 .setlanguagelevel } if
diff --git a/Master/tlpkg/tlgs/lib/markhint.ps b/Master/tlpkg/tlgs/lib/markhint.ps
deleted file mode 100644
index f83d62d85af..00000000000
--- a/Master/tlpkg/tlgs/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/Master/tlpkg/tlgs/lib/markpath.ps b/Master/tlpkg/tlgs/lib/markpath.ps
deleted file mode 100644
index 4aec660c177..00000000000
--- a/Master/tlpkg/tlgs/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/Master/tlpkg/tlgs/lib/packfile.ps b/Master/tlpkg/tlgs/lib/packfile.ps
deleted file mode 100644
index 8bad56f6dff..00000000000
--- a/Master/tlpkg/tlgs/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/Master/tlpkg/tlgs/lib/pcharstr.ps b/Master/tlpkg/tlgs/lib/pcharstr.ps
deleted file mode 100644
index 7f38fc96670..00000000000
--- a/Master/tlpkg/tlgs/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/Master/tlpkg/tlgs/lib/pdfwrite.ps b/Master/tlpkg/tlgs/lib/pdfwrite.ps
deleted file mode 100644
index 8aa9dca1d4d..00000000000
--- a/Master/tlpkg/tlgs/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/Master/tlpkg/tlgs/lib/ps2ascii.ps b/Master/tlpkg/tlgs/lib/ps2ascii.ps
deleted file mode 100644
index 2b0e2d58109..00000000000
--- a/Master/tlpkg/tlgs/lib/ps2ascii.ps
+++ /dev/null
@@ -1,1523 +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.
-%
-
-% Extract the ASCII text from a PostScript file. Nothing is displayed.
-% Instead, ASCII information is written to stdout. The idea is similar to
-% Glenn Reid's `distillery', only a lot more simple-minded, and less robust.
-
-% If SIMPLE is defined, just the text is written, with a guess at line
-% breaks and word spacing. If SIMPLE is not defined, lines are written
-% to stdout as follows:
-%
-% F <height> <width> (<fontname>)
-% Indicate the font height and the width of a space.
-%
-% P
-% Indicate the end of the page.
-%
-% S <x> <y> (<string>) <width>
-% Display a string.
-%
-% <width> and <height> are integer dimensions in units of 1/720".
-% <x> and <y> are integer coordinates, in units of 1/720", with the origin
-% at the lower left.
-% <string> and <fontname> are strings represented with the standard
-% PostScript escape conventions.
-
-% If COMPLEX is defined, the following additional types of lines are
-% written to stdout.
-%
-% C <r> <g> <b>
-% Indicate the current color.
-%
-% I <x> <y> <width> <height>
-% Note the presence of an image.
-%
-% R <x> <y> <width> <height>
-% Fill a rectangle.
-%
-% <r>, <g>, and <b> are RGB values expressed as integers between 0 and 1000.
-%
-% Note that future versions of this program (in COMPLEX mode) may add
-% other output elements, so programs parsing the output should be
-% prepared to ignore elements that they do not recognize.
-
-% Note that this code will only work in all cases if systemdict is writable
-% and if `binding' the definitions of operators defined as procedures
-% is deferred. For this reason, it is normally invoked with
-% gs -q -dNODISPLAY -dDELAYBIND -dWRITESYSTEMDICT ps2ascii.ps
-
-% Thanks to:
-% J Greely <jgreely@cis.ohio-state.edu> for improvements to this code;
-% Jerry Whelan <jerryw@abode.ccd.bnl.gov> for motivating other improvements;
-% David M. Jones <dmjones@theory.lcs.mit.edu> for improvements noted below.
-
-%% Additional modifications by David M. Jones
-%% (dmjones@theory.lcs.mit.edu), December 23, 1997
-%%
-%% (a) Rewrote forall loop at the end of .show.write. This fixes a
-%% stack leakage problem, but the changes are more significant
-%% than that.
-%%
-%% .char.map includes the names of all characters in the
-%% StandardEncoding, ISOLatin1Encoding, OT1Encoding and
-%% T1Encoding vectors. Thus, if the Encoding vector for the
-%% current font contains a name that is not in .char.map, it's
-%% redundant to check if the Encoding vector is equal to one of
-%% the known vectors. Previous versions of ps2ascii would give
-%% up at this point, and substitute an asterisk (*) for the
-%% character. I've taken the liberty of instead using the
-%% OT1Encoding vector to translate the character, on the grounds
-%% that in the cases I'm most interested in, a font without a
-%% useful Encoding vector was most likely created by a DVI to PS
-%% converter such as dvips or DVILASER (and OT1Encoding is
-%% largely compatible with StandardEncoding anyway). [Note that
-%% this does not make my earlier changes to support dvips (see
-%% fix (a) under my 1996 changes) completely obsolete, since
-%% there's additional useful information I can extract in that
-%% case.]
-%%
-%% Overall, this should provide better support for some documents
-%% (e.g, DVILASER documents will no longer be translated into a
-%% series of *'s) without breaking any other documents any worse
-%% than they already were broken.
-%%
-%% (b) Fixed two bugs in dvips.df-tail: (1) changed "dup 127" to "dup
-%% 128" to fix fencepost error, and (2) gave each font it's own
-%% FontName rather than having all fonts share the same name.
-%%
-%% (c) Added one further refinement to the heuristic for detecting
-%% paragraph breaks: do not ever start a new paragraph after a
-%% line ending in a hyphen.
-%%
-%% (d) Added a bunch of missing letters from the T1Encoding,
-%% OT1Encoding and ISOLatin1Encoding vectors to .letter.chars to
-%% improve hyphen-elimination algorithm. This still won't help
-%% if there's no useful Encoding vector.
-%%
-%% NOTE: A better solution to the problem of missing Encoding vectors
-%% might be to redefine definefont to check whether the Encoding
-%% vector is sensible and, if not, replace it by a default. This
-%% would alleviate the need for constant tests in the .show.write
-%% loop, as well as automatically solving the problem noted in fix
-%% (d) above, and the similar problem with .break.chars. This should
-%% be investigated. Also, the hyphen-elimination algorithm really
-%% needs to be looked at carefully and rethought.
-
-%%* Modifications to ps2ascii.ps by David M. Jones
-%%* (dmjones@theory.lcs.mit.edu), June 25-July 8, 1996
-
-%%* Modifications:
-%%*
-%%* (a) added code to give better support for dvips files by providing
-%%* FontBBox's, FontName's and Encoding vectors for downloaded
-%%* bitmap fonts. This is done by using dvips's start-hook to
-%%* overwrite the df-tail and D procedures that dvips uses to
-%%* define its Type 3 bitmap fonts. Thus, this change should
-%%* provide better support for dvips-generated PS files without
-%%* affecting the handling of other documents.
-%%*
-%%* (b) Fixed two bugs that could potentially affect any PS file, not
-%%* just those created by dvips: (1) added missing "get" operator
-%%* in .show.write and (2) fixed bug that caused a hyphen at the
-%%* end of a line to be replaced by a space rather than begin
-%%* deleted. Note that the first bug was a source of stack
-%%* leakage, causing ps2ascii to run out of operand stack space
-%%* occasionally.
-%%*
-%%* Search for "%%* BF" to find these modifications.
-%%*
-%%* (c) Improved the heuristic for determining whether a line break
-%%* has occurred and whether a line break represents a paragraph
-%%* break. Previously, any change in the vertical position caused
-%%* a line break; now a line break is only registered if the
-%%* change is larger than the height of the current font. This
-%%* means that superscripts, subscripts, and such things as
-%%* shifted accents generated by TeX won't cause line breaks.
-%%* Paragraph-recognition is now done by comparing the indentation
-%%* of the new line to the indentation of the previous line and by
-%%* comparing the vertical distance between the new line and the
-%%* previous line to the vertical distance between the previous
-%%* line and its predecessor.
-%%*
-%%* (d) Added a hook for renaming the files where stdout and stderr
-%%* go.
-%%*
-%%* In general, my additions or changes to the code are described in
-%%* comments beginning with "%%*". However, there are numerous other
-%%* places where I have either re-formatted code or added comments to
-%%* the code while I was trying to understand it. These are usually
-%%* not specially marked.
-%%*
-
-/QUIET true def
-systemdict wcheck { systemdict } { userdict } ifelse begin
-/.max where { pop } { /.max { 2 copy lt { exch } if pop } bind def } ifelse
-/COMPLEX dup where { pop true } { false } ifelse def
-/SIMPLE dup where { pop true } { false } ifelse def
-/setglobal where
- { pop currentglobal /setglobal load true setglobal }
- { { } }
-ifelse
-
-% Define a way to store and retrieve integers that survives save/restore.
-/.i.string0 (0 ) def
-/.i.string .i.string0 length string def
-/.iget { cvi } bind def
-/.iput { exch //.i.string exch copy cvs pop } bind def
-/.inew { //.i.string0 dup length string copy } bind def
-
-% We only want to redefine operators if they are defined already.
-
-/codef { 1 index where { pop def } { pop pop } ifelse } def
-
-% Redefine the end-of-page operators.
-
-/erasepage { } codef
-/copypage { SIMPLE { (\014) } { (P\n) } ifelse //print } codef
-/showpage { copypage erasepage initgraphics } codef
-
-% Redefine the fill operators to detect rectangles.
-
-/.orderrect % <llx> <lly> <urx> <ury> .orderrect <llx> <lly> <w> <h>
- { % Ensure llx <= urx, lly <= ury.
- 1 index 4 index lt { 4 2 roll } if
- dup 3 index lt { 3 1 roll exch } if
- exch 3 index sub exch 2 index sub
- } odef
-/.fillcomplex
- { % Do a first pass to see if the path is all rectangles in
- % the output coordinate system. We don't worry about overlapping
- % rectangles that might be partially not filled.
- % Stack: mark llx0 lly0 urx0 ury0 ... true mark x0 y0 ...
- mark true mark
- % Add a final moveto so we pick up any trailing unclosed subpath.
- 0 0 itransform moveto
- { .coord counttomark 2 gt
- { counttomark 4 gt { .fillcheckrect } { 4 2 roll pop pop } ifelse }
- if
- }
- { .coord }
- { cleartomark not mark exit }
- { counttomark -2 roll 2 copy counttomark 2 roll .fillcheckrect }
- pathforall cleartomark
- { .showcolor counttomark 4 idiv
- { counttomark -4 roll .orderrect
- (R ) //print .show==4
- }
- repeat pop
- }
- { cleartomark
- }
- ifelse
- } odef
-/.fillcheckrect
- { % Check whether the current subpath is a rectangle.
- % If it is, add it to the list of rectangles being accumulated;
- % if not exit the .fillcomplex loop.
- % The subpath has not been closed.
- % Stack: as in .fillcomplex, + newx newy
- counttomark 10 eq { 9 index 9 index 4 2 roll } if
- counttomark 12 ne { cleartomark not mark exit } if
- 12 2 roll
- % Check for the two possible forms of rectangles:
- % x0 y0 x0 y1 x1 y1 x1 y0 x0 y0
- % x0 y0 x1 y0 x1 y1 x0 y1 x0 y0
- 9 index 2 index eq 9 index 2 index eq and
- 10 index 9 index eq
- { % Check for first form.
- 7 index 6 index eq and 6 index 5 index eq and 3 index 2 index eq and
- }
- { % Check for second form.
- 9 index 8 index eq and
- 8 index 7 index eq and 5 index 4 index eq and 4 index 3 index eq and
- }
- ifelse not { cleartomark not mark exit } if
- % We have a rectangle.
- pop pop pop pop 4 2 roll pop pop 8 4 roll
- } odef
-/eofill { COMPLEX { .fillcomplex } if newpath } codef
-/fill { COMPLEX { .fillcomplex } if newpath } codef
-/rectfill { gsave newpath .rectappend fill grestore } codef
-/ueofill { gsave newpath uappend eofill grestore } codef
-/ufill { gsave newpath uappend fill grestore } codef
-
-% Redefine the stroke operators to detect rectangles.
-
-/rectstroke
- { gsave newpath
- dup type dup /arraytype eq exch /packedarraytype eq or
- { dup length 6 eq { exch .rectappend concat } { .rectappend } ifelse }
- { .rectappend }
- ifelse stroke grestore
- } codef
-/.strokeline % <fromx> <fromy> <tox> <toy> .strokeline <tox> <toy>
- % Note: fromx and fromy are in output coordinates;
- % tox and toy are in user coordinates.
- { .coord 2 copy 6 2 roll .orderrect
- % Add in the line width. Assume square or round caps.
- currentlinewidth 2 div dup .dcoord add abs 1 .max 5 1 roll
- 4 index add 4 1 roll 4 index add 4 1 roll
- 4 index sub 4 1 roll 5 -1 roll sub 4 1 roll
- (R ) //print .show==4
- } odef
-/.strokecomplex
- { % Do a first pass to see if the path is all horizontal and vertical
- % lines in the output coordinate system.
- % Stack: true mark origx origy curx cury
- true mark null null null null
- { .coord 6 2 roll pop pop pop pop 2 copy }
- { .coord 1 index 4 index eq 1 index 4 index eq or
- { 4 2 roll pop pop }
- { cleartomark not mark exit }
- ifelse
- }
- { cleartomark not mark exit }
- { counttomark -2 roll 2 copy counttomark 2 roll
- 1 index 4 index eq 1 index 4 index eq or
- { pop pop 2 copy }
- { cleartomark not mark exit }
- ifelse
- }
- pathforall cleartomark
- 0 currentlinewidth .dcoord 0 eq exch 0 eq or and
- % Do the second pass to write out the rectangles.
- % Stack: origx origy curx cury
- { .showcolor null null null null
- { 6 2 roll pop pop pop pop 2 copy .coord }
- { .strokeline }
- { }
- { 3 index 3 index .strokeline }
- pathforall pop pop pop pop
- }
- if
- } odef
-/stroke { COMPLEX { .strokecomplex } if newpath } codef
-/ustroke
- { gsave newpath
- dup length 6 eq { exch uappend concat } { uappend } ifelse
- stroke grestore
- } codef
-
-% The image operators must read the input and note the dimensions.
-% Eventually we should redefine these to detect 1-bit-high all-black images,
-% since this is how dvips does underlining (!).
-
-/.noteimagerect % <width> <height> <matrix> .noteimagerect -
- { COMPLEX
- { gsave setmatrix itransform 0 0 itransform
- grestore .coord 4 2 roll .coord .orderrect
- (I ) //print .show==4
- }
- { pop pop pop
- }
- ifelse
- } odef
-/colorimage where
- { pop /colorimage
- { 1 index
- { dup 6 add index 1 index 6 add index 2 index 5 add index }
- { 6 index 6 index 5 index }
- ifelse .noteimagerect gsave nulldevice //colorimage grestore
- } codef
- } if
-/.noteimage % Arguments as for image[mask]
- { dup type /dicttype eq
- { dup /Width get 1 index /Height get 2 index /ImageMatrix get }
- { 4 index 4 index 3 index }
- ifelse .noteimagerect
- } odef
-/image { .noteimage gsave nulldevice //image grestore } codef
-/imagemask { .noteimage gsave nulldevice //imagemask grestore } codef
-
-% Output the current color if necessary.
-/.color.r .inew def
- .color.r -1 .iput % make sure we write the color at the beginning
-/.color.g .inew def
-/.color.b .inew def
-/.showcolor
- { COMPLEX
- { currentrgbcolor
- 1000 mul round cvi
- 3 1 roll 1000 mul round cvi
- exch 1000 mul round cvi
- % Stack: b g r
- dup //.color.r .iget eq
- 2 index //.color.g .iget eq and
- 3 index //.color.b .iget eq and
- { pop pop pop
- }
- { (C ) //print
- dup //.color.r exch .iput .show==only
- ( ) //print dup //.color.g exch .iput .show==only
- ( ) //print dup //.color.b exch .iput .show==only
- (\n) //print
- }
- ifelse
- }
- if
- } bind def
-
-% Redefine `show'.
-
-% Set things up so our output will be in tenths of a point, with origin at
-% lower left. This isolates us from the peculiarities of individual devices.
-
-/.show.ident.matrix matrix def
-/.show.ident { % - .show.ident <scale> <matrix>
-% //.show.ident.matrix defaultmatrix
-% % Assume the original transformation is well-behaved.
-% 0.1 0 2 index dtransform abs exch abs .max /.show.scale exch def
-% 0.1 dup 3 -1 roll scale
- gsave initmatrix
- % Assume the original transformation is well-behaved...
- 0.1 0 dtransform abs exch abs .max
- 0.1 dup scale .show.ident.matrix currentmatrix
- % ... but undo any rotation into landscape orientation.
- dup 0 get 0 eq {
- 1 get dup abs div 90 mul rotate
- .show.ident.matrix currentmatrix
- } if
- grestore
-} bind def
-
-/.coord { % <x> <y> .coord <x'> <y'>
- transform .show.ident exch pop itransform
- exch round cvi exch round cvi
-} odef
-
-/.dcoord { % <dx> <dy> .coord <dx'> <dy'>
- % Transforming distances is trickier, because
- % the coordinate system might be rotated.
- .show.ident pop 3 1 roll
- exch 0 dtransform
- dup mul exch dup mul add sqrt
- 2 index div round cvi
- exch 0 exch dtransform
- dup mul exch dup mul add sqrt
- 3 -1 roll div round cvi
-} odef
-
-% Remember the current X, Y, and height.
-/.show.x .inew def
-/.show.y .inew def
-/.show.height .inew def
-
-% Remember the last character of the previous string; if it was a
-% hyphen preceded by a letter, we didn't output the hyphen.
-
-/.show.last (\000) def
-
-% Remember the current font.
-/.font.name 130 string def
-/.font.name.length .inew def
-/.font.height .inew def
-/.font.width .inew def
-
-%%* Also remember indentation of current line and previous vertical
-%%* skip
-
-/.show.indent .inew def
-/.show.dy .inew def
-
-% We have to redirect stdout somehow....
-
-/.show.stdout { (%stdout) (w) file } bind def
-
-% Make sure writing will work even if a program uses =string.
-/.show.string =string length string def
-/.show.=string =string length string def
-/.show==only
- { //=string //.show.=string copy pop
- dup type /stringtype eq
- { dup length //.show.string length le
- { dup rcheck { //.show.string copy } if
- } if
- } if
- .show.stdout exch write==only
- //.show.=string //=string copy pop
- } odef
-/.show==4
- { 4 -1 roll .show==only ( ) //print
- 3 -1 roll .show==only ( ) //print
- exch .show==only ( ) //print
- .show==only (\n) //print
- } odef
-
-/.showwidth % Same as stringwidth, but disable COMPLEX so that
- % we don't try to detect rectangles during BuildChar.
- { COMPLEX
- { /COMPLEX false def stringwidth /COMPLEX true def }
- { stringwidth }
- ifelse
- } odef
-
-/.showfont % <string> .showfont <string>
- { gsave
- % Try getting the height and width of the font from the FontBBox.
- currentfont /FontBBox .knownget not { {0 0 0 0} } if
- aload pop % llx lly urx ury
- exch 4 -1 roll % lly ury urx llx
- sub % lly ury dx
- 3 1 roll exch % dx ury lly
- sub % dx dy
- 2 copy .max 0 ne
- { currentfont /FontMatrix get dtransform
- }
- { pop pop
- % Fonts produced by dvips, among other applications, have
- % BuildChar procedures that bomb out when given unexpected
- % characters, and there is no way to determine whether a given
- % character will do this. So for Type 1 fonts, we measure a
- % typical character ('X'); for others, we punt.
- currentfont /FontType get 1 eq
- { (X) .showwidth pop dup 1.3 mul
- }
- { % No safe way to get the character size. Punt.
- 0 0
- }
- ifelse
- }
- ifelse .dcoord exch
- currentfont /FontName .knownget not { () } if
- dup type /stringtype ne { //.show.string cvs } if
- grestore
- % Stack: height width fontname
- SIMPLE
- { pop pop //.show.height exch .iput }
- { 2 index //.font.height .iget eq
- 2 index //.font.width .iget eq and
- 1 index //.font.name 0 //.font.name.length .iget getinterval eq and
- { pop pop pop
- }
- { (F ) //print
- 3 -1 roll dup //.font.height exch .iput .show==only ( ) //print
- exch dup //.font.width exch .iput .show==only ( ) //print
- dup length //.font.name.length exch .iput
- //.font.name cvs .show==only (\n) //print
- }
- ifelse
- }
- ifelse
- } odef
-
-% Define the letters -- characters which, if they occur followed by a hyphen
-% at the end of a line, cause the hyphen and line break to be ignored.
-/.letter.chars 100 dict def
-mark
- 65 1 90 { dup 32 add } for
- counttomark
- { StandardEncoding exch get .letter.chars exch dup put }
- repeat
-pop
-
-%%* Add the rest of the letters from the [O]T1Encoding and
-%%* ISOLatin1Encoding vectors
-
-mark
- /AE
- /Aacute
- /Abreve
- /Acircumflex
- /Adieresis
- /Agrave
- /Aogonek
- /Aring
- /Atilde
- /Cacute
- /Ccaron
- /Ccedilla
- /Dcaron
- /Eacute
- /Ecaron
- /Ecircumflex
- /Edieresis
- /Egrave
- /Eng
- /Eogonek
- /Eth
- /Gbreve
- /Germandbls
- /IJ
- /Iacute
- /Icircumflex
- /Idieresis
- /Idot
- /Igrave
- /Lacute
- /Lcaron
- /Lslash
- /Nacute
- /Ncaron
- /Ntilde
- /OE
- /Oacute
- /Ocircumflex
- /Odieresis
- /Ograve
- /Ohungarumlaut
- /Oslash
- /Otilde
- /Racute
- /Rcaron
- /Sacute
- /Scaron
- /Scedilla
- /Tcaron
- /Tcedilla
- /Thorn
- /Uacute
- /Ucircumflex
- /Udieresis
- /Ugrave
- /Uhungarumlaut
- /Uring
- /Yacute
- /Ydieresis
- /Zacute
- /Zcaron
- /Zdot
- /aacute
- /abreve
- /acircumflex
- /adieresis
- /ae
- /agrave
- /aogonek
- /aring
- /atilde
- /cacute
- /ccaron
- /ccedilla
- /dbar
- /dcaron
- /dotlessi
- /dotlessj
- /eacute
- /ecaron
- /ecircumflex
- /edieresis
- /egrave
- /eng
- /eogonek
- /eth
- /exclamdown
- /ff
- /ffi
- /ffl
- /fi
- /fl
- /gbreve
- /germandbls
- /iacute
- /icircumflex
- /idieresis
- /igrave
- /ij
- /lacute
- /lcaron
- /lslash
- /nacute
- /ncaron
- /ntilde
- /oacute
- /ocircumflex
- /odieresis
- /oe
- /ograve
- /ohungarumlaut
- /oslash
- /otilde
- /questiondown
- /racute
- /rcaron
- /sacute
- /scaron
- /scedilla
- /section
- /sterling
- /tcaron
- /tcedilla
- /thorn
- /uacute
- /ucircumflex
- /udieresis
- /ugrave
- /uhungarumlaut
- /uring
- /yacute
- /ydieresis
- /zacute
- /zcaron
- /zdot
-counttomark
- { .letter.chars exch dup put }
-repeat
-pop
-
-% Define a set of characters which, if they occur at the start of a line,
-% are taken as indicating a paragraph break.
-/.break.chars 50 dict def
-mark
- /bullet /dagger /daggerdbl /periodcentered /section
- counttomark
- { .break.chars exch dup put }
- repeat
-pop
-
-% Define character translation to ASCII.
-% We have to do this for the entire character set.
-
-/.char.map 500 dict def
-
-/.chars.def { counttomark 2 idiv { .char.map 3 1 roll put } repeat pop } def
-
-% Encode the printable ASCII characters.
-
-mark 32 1 126
- { 1 string dup 0 4 -1 roll put
- dup 0 get StandardEncoding exch get exch
- }
-for .chars.def
-
- % Encode accents.
-mark
- /acute (')
- /caron (^)
- /cedilla (,)
- /circumflex (^)
- /dieresis (")
- /grave (`)
- /ring (*)
- /tilde (~)
-.chars.def
-
- % Encode the ISO accented characters.
-mark 192 1 255
- { ISOLatin1Encoding exch get =string cvs
- dup 0 1 getinterval 1 index dup length 1 sub 1 exch getinterval
- .char.map 2 index known .char.map 2 index known and
- { .char.map 3 -1 roll get .char.map 3 -1 roll get concatstrings
- .char.map 3 1 roll put
- }
- { pop pop pop
- }
- ifelse
- }
-for .chars.def
-
-% Encode the remaining standard and ISO alphabetic characters.
-
-mark
- /AE (AE) /Eth (DH) /OE (OE) /Thorn (Th)
- /ae (ae) /eth (dh)
- /ffi (ffi) /ffl (ffl) /fi (fi) /fl (fl)
- /germandbls (ss) /oe (oe) /thorn (th)
-.chars.def
-
-% Encode the other standard and ISO characters.
-
-mark
- /brokenbar (|) /bullet (*) /copyright ((C)) /currency (#)
- /dagger (#) /daggerdbl (##) /degree (o) /divide (/) /dotaccent (.)
- /dotlessi (i)
- /ellipsis (...) /emdash (--) /endash (-) /exclamdown (!)
- /florin (f) /fraction (/)
- /guillemotleft (<<) /guillemotright (>>)
- /guilsinglleft (<) /guilsinglright (>) /hungarumlaut ("") /logicalnot (~)
- /macron (_) /minus (-) /mu (u) /multiply (*)
- /ogonek (,) /onehalf (1/2) /onequarter (1/4) /onesuperior (1)
- /ordfeminine (-a) /ordmasculine (-o)
- /paragraph (||) /periodcentered (*) /perthousand (o/oo) /plusminus (+-)
- /questiondown (?) /quotedblbase (") /quotedblleft (") /quotedblright (")
- /quotesinglbase (,) /quotesingle (') /registered ((R))
- /section ($) /sterling (#)
- /threequarters (3/4) /threesuperior (3) /trademark ((TM)) /twosuperior (2)
- /yen (Y)
-.chars.def
-
-% Encode a few common Symbol characters.
-
-mark
- /asteriskmath (*) /copyrightsans ((C)) /copyrightserif ((C))
- /greaterequal (>=) /lessequal (<=) /registersans ((R)) /registerserif ((R))
- /trademarksans ((TM)) /trademarkserif ((TM))
-.chars.def
-
-%%* Add a few characters from StandardEncoding and ISOLatin1Encoding
-%%* that were missing.
-
-mark
- /cent (c)
- /guilsinglleft (<)
- /guilsinglright (>)
- /breve (*)
- /Lslash (L/)
- /lslash (l/)
-.chars.def
-
-%%* Define the OT1Encoding and T1Encoding vectors for use with dvips
-%%* files. Unfortunately, there's no way of telling what font is
-%%* really being used within a dvips document, so we can't provide an
-%%* appropriate encoding for each individual font. Instead, we'll
-%%* just provide support for the two most popular text encodings, the
-%%* OT1 and T1 encodings, and just accept the fact that any font not
-%%* using one of those encodings will be rendered as gibberish.
-%%*
-%%* OT1 is Knuth's 7-bit encoding for the CMR text fonts, while T1
-%%* (aka the Cork encoding) is the 8-bit encoding used by the DC
-%%* fonts, a preliminary version of the proposed Extended Computer
-%%* Modern fonts. Unfortunately, T1 is not a strict extension of OT1;
-%%* they differ in positions 8#000 through 8#040, 8#074, 8#076, 8#134,
-%%* 8#137, 8#173, 8#174, 8#175 and 8#177, so we can't use the same
-%%* vector for both.
-%%*
-%%* Of course, we also can't reliably tell the difference between an
-%%* OT1-encoded font and a T1-encoded font based on the information in
-%%* a dvips-created PostScript file. As a best-guess solution, we'll
-%%* use the T1 encoding if the font contains any characters in
-%%* positions above 8#177 and the OT1 encoding if it doesn't.
-
-/T1Encoding 256 array def
-
-/OT1Encoding 256 array def
-
-%%* T1Encoding shares a lot with StandardEncoding, so let's start
-%%* there.
-
-StandardEncoding T1Encoding copy pop
-
-/OT1.encode {
- counttomark
- 2 idiv
- { OT1Encoding 3 1 roll put }
- repeat
- cleartomark
-} def
-
-/T1.encode {
- counttomark
- 2 idiv
- { T1Encoding 3 1 roll put }
- repeat
- cleartomark
-} def
-
-mark
- 8#000 /grave
- 8#001 /acute
- 8#002 /circumflex
- 8#003 /tilde
- 8#004 /dieresis
- 8#005 /hungarumlaut
- 8#006 /ring
- 8#007 /caron
-
- 8#010 /breve
- 8#011 /macron
- 8#012 /dotaccent
- 8#013 /cedilla
- 8#014 /ogonek
- 8#015 /quotesinglbase
- 8#016 /guilsinglleft
- 8#017 /guilsinglright
-
- 8#020 /quotedblleft
- 8#021 /quotedblright
- 8#022 /quotedblbase
- 8#023 /guillemotleft
- 8#024 /guillemotright
- 8#025 /endash
- 8#026 /emdash
- 8#027 /cwm
-
- 8#030 /perthousandzero
- 8#031 /dotlessi
- 8#032 /dotlessj
- 8#033 /ff
- 8#034 /fi
- 8#035 /fl
- 8#036 /ffi
- 8#037 /ffl
-
-%% 8#040 through 8#176 follow StandardEncoding
-
- 8#177 /hyphen
-T1.encode
-
-mark
- 8#200 /Abreve
- 8#201 /Aogonek
- 8#202 /Cacute
- 8#203 /Ccaron
- 8#204 /Dcaron
- 8#205 /Ecaron
- 8#206 /Eogonek
- 8#207 /Gbreve
- 8#210 /Lacute
- 8#211 /Lcaron
- 8#212 /Lslash
- 8#213 /Nacute
- 8#214 /Ncaron
- 8#215 /Eng
- 8#216 /Ohungarumlaut
- 8#217 /Racute
- 8#220 /Rcaron
- 8#221 /Sacute
- 8#222 /Scaron
- 8#223 /Scedilla
- 8#224 /Tcaron
- 8#225 /Tcedilla
- 8#226 /Uhungarumlaut
- 8#227 /Uring
- 8#230 /Ydieresis
- 8#231 /Zacute
- 8#232 /Zcaron
- 8#233 /Zdot
- 8#234 /IJ
- 8#235 /Idot
- 8#236 /dbar
- 8#237 /section
- 8#240 /abreve
- 8#241 /aogonek
- 8#242 /cacute
- 8#243 /ccaron
- 8#244 /dcaron
- 8#245 /ecaron
- 8#246 /eogonek
- 8#247 /gbreve
- 8#250 /lacute
- 8#251 /lcaron
- 8#252 /lslash
- 8#253 /nacute
- 8#254 /ncaron
- 8#255 /eng
- 8#256 /ohungarumlaut
- 8#257 /racute
- 8#260 /rcaron
- 8#261 /sacute
- 8#262 /scaron
- 8#263 /scedilla
- 8#264 /tcaron
- 8#265 /tcedilla
- 8#266 /uhungarumlaut
- 8#267 /uring
- 8#270 /ydieresis
- 8#271 /zacute
- 8#272 /zcaron
- 8#273 /zdot
- 8#274 /ij
- 8#275 /exclamdown
- 8#276 /questiondown
- 8#277 /sterling
-
- 8#300 /Agrave
- 8#301 /Aacute
- 8#302 /Acircumflex
- 8#303 /Atilde
- 8#304 /Adieresis
- 8#305 /Aring
- 8#306 /AE
- 8#307 /Ccedilla
- 8#310 /Egrave
- 8#311 /Eacute
- 8#312 /Ecircumflex
- 8#313 /Edieresis
- 8#314 /Igrave
- 8#315 /Iacute
- 8#316 /Icircumflex
- 8#317 /Idieresis
- 8#320 /Eth
- 8#321 /Ntilde
- 8#322 /Ograve
- 8#323 /Oacute
- 8#324 /Ocircumflex
- 8#325 /Otilde
- 8#326 /Odieresis
- 8#327 /OE
- 8#330 /Oslash
- 8#331 /Ugrave
- 8#332 /Uacute
- 8#333 /Ucircumflex
- 8#334 /Udieresis
- 8#335 /Yacute
- 8#336 /Thorn
- 8#337 /Germandbls
-
- 8#340 /agrave
- 8#341 /aacute
- 8#342 /acircumflex
- 8#343 /atilde
- 8#344 /adieresis
- 8#345 /aring
- 8#346 /ae
- 8#347 /ccedilla
- 8#350 /egrave
- 8#351 /eacute
- 8#352 /ecircumflex
- 8#353 /edieresis
- 8#354 /igrave
- 8#355 /iacute
- 8#356 /icircumflex
- 8#357 /idieresis
- 8#360 /eth
- 8#361 /ntilde
- 8#362 /ograve
- 8#363 /oacute
- 8#364 /ocircumflex
- 8#365 /otilde
- 8#366 /odieresis
- 8#367 /oe
- 8#370 /oslash
- 8#371 /ugrave
- 8#372 /uacute
- 8#373 /ucircumflex
- 8#374 /udieresis
- 8#375 /yacute
- 8#376 /thorn
- 8#377 /germandbls
-
-T1.encode
-
-%%* Now copy OT1Encoding into T1Encoding and make a few changes.
-
-T1Encoding OT1Encoding copy pop
-
-mark
- 8#000 /Gamma
- 8#001 /Delta
- 8#002 /Theta
- 8#003 /Lambda
- 8#004 /Xi
- 8#005 /Pi
- 8#006 /Sigma
- 8#007 /Upsilon
-
- 8#010 /Phi
- 8#011 /Psi
- 8#012 /Omega
- 8#013 /ff
- 8#014 /fi
- 8#015 /fl
- 8#016 /ffi
- 8#017 /ffl
-
- 8#020 /dotlessi
- 8#021 /dotlessj
- 8#022 /grave
- 8#023 /acute
- 8#024 /caron
- 8#025 /breve
- 8#026 /macron
- 8#027 /ring
-
- 8#030 /cedilla
- 8#031 /germandbls
- 8#032 /ae
- 8#033 /oe
- 8#034 /oslash
- 8#035 /AE
- 8#036 /OE
- 8#037 /Oslash
-
- 8#040 /polishslash
-
- 8#042 /quotedblright
-
- 8#074 /exclamdown
- 8#076 /questiondown
-
- 8#134 /quotedblleft
- 8#137 /dotaccent
-
- 8#173 /endash
- 8#174 /emdash
- 8#175 /hungarumlaut
- 8#177 /dieresis
-OT1.encode
-
-%%* And add a few characters from the OT1Encoding
-
-mark
- /Gamma (\\Gamma )
- /Delta (\\Delta )
- /Theta (\\Theta )
- /Lambda (\\Lambda )
- /Xi (\\Xi )
- /Pi (\\Pi )
- /Sigma (\\Sigma )
- /Upsilon (\\Upsilon )
-
- /Phi (\\Phi )
- /Psi (\\Psi )
- /Omega (\\Omega )
-
- /dotlessj (j)
- /ff (ff)
-
- /cwm ()
-
- /perthousandzero (0)
-
- /polishslash ()
-
- /Abreve (A*)
- /Aogonek (A,)
- /Cacute (C')
- /Ccaron (C^)
- /Dcaron (D^)
- /Ecaron (E^)
- /Eogonek (E,)
- /Gbreve (G*)
- /Lacute (L')
- /Lcaron (L^)
- /Nacute (N')
- /Ncaron (N^)
- /Eng (NG)
- /Ohungarumlaut (O"")
- /Racute (R')
- /Rcaron (R^)
- /Sacute (S')
- /Scaron (S^)
- /Scedilla (S,)
- /Tcaron (T^)
- /Tcedilla (T,)
- /Uhungarumlaut (U"")
- /Uring (U*)
- /Ydieresis (Y")
- /Zacute (Z')
- /Zcaron (Z^)
- /Zdot (Z.)
- /IJ (IJ)
- /Idot (I.)
- /dbar (d-)
- /abreve (a*)
- /aogonek (a,)
- /cacute (c')
- /ccaron (c^)
- /dcaron (d^)
- /ecaron (e^)
- /eogonek (e,)
- /gbreve (g*)
- /lacute (l')
- /lcaron (l^)
- /nacute (n')
- /ncaron (n^)
- /eng (ng)
- /ohungarumlaut (o"")
- /racute (r')
- /rcaron (r^)
- /sacute (s')
- /scaron (s^)
- /scedilla (s,)
- /tcaron (t^)
- /tcedilla (t,)
- /uhungarumlaut (u"")
- /uring (u*)
- /zacute (z')
- /zcaron (z^)
- /zdot (z.)
- /ij (ij)
- /Germandbls (SS)
-.chars.def
-
-%%* We extend the df-tail command to stick in an Encoding vector (see
-%%* above for a discussion of the T1 and OT1 encodings), put in a
-%%* FontName (which will just be dvips's name for the font, i.e., Fa,
-%%* Fb, etc.) and give each font a separate FontBBox instead of
-%%* letting them all share a single one.
-
-/dvips.df-tail % id numcc maxcc df-tail
- {
- /nn 9 dict N
- nn begin
- %%
- %% Choose an encoding based on the highest position occupied.
- %%
- dup 128 gt { T1Encoding } { OT1Encoding } ifelse
- /Encoding X
- /FontType 3 N
- %%
- %% It's ok for all the fonts to share a FontMatrix, but they
- %% need to have separate FontBBoxes
- %%
- /FontMatrix fntrx N
- /FontBBox [0 0 0 0] N
- string /base X
- array /BitMaps X
- %%
- %% And let's throw in a FontName for good measure
- %%
- dup ( ) cvs
- %%
- %% Make sure each font gets it own private FontName. -- dmj,
- %% 12/23/97
- %%
- dup length string copy
- /FontName X
- /BuildChar {CharBuilder} N
- end
- dup { /foo setfont }
- 2 array copy cvx N
- load
- 0 nn put
- /ctr 0 N
- [
-} def
-
-%%* This is functionally equivalent to dvips's /D procedure, but it
-%%* also calculates the Font Bounding Box while defining the
-%%* characters.
-
-/dvips.D % char-data ch D - : define character bitmap in current font
-{
- /cc X % char-data
- dup type /stringtype ne {]} if % char-data
-
- /ch-xoff where
- { pop }
- { dup /Cd exch def
- /ch-width { Cw } def
- /ch-height { Ch } def
- /ch-xoff { Cx } def
- /ch-yoff { Cy } def
- /ch-dx { Cdx } def
- } ifelse
- /ch-data X
- nn /base get cc ctr put % (adds ctr to cc'th position of BASE)
- nn /BitMaps get
- ctr
- ch-data % BitMaps ctr char-data
- sf 1 ne {
- dup dup length 1 sub dup 2 index S get sf div put
- } if
- put % puts char-data into BitMaps at index ctr
- /ctr ctr 1 add N
-%%
-%% Make sure the Font Bounding Box encloses the Bounding Box of the
-%% current character
-%%
- nn /FontBBox get % BB
-
- dup % calculate new llx
- dup 0 get
- ch-xoff
- .min
- 0 exch put
-
- dup % calculate new lly
- dup 1 get
- ch-yoff ch-height sub
- .min
- 1 exch put
-
- dup % calculate new urx
- dup 2 get
- ch-dx ch-width add
- .max
- 2 exch put
-
- dup 3 get % calculate new ury
- ch-yoff
- .max
- 3 exch put
-
-} def
-
-%%* Define start-hook to replace df-tail and D by our versions.
-%%* Unfortunately, the user can redefine start-hook and thus bypass
-%%* these changes, but I don't see an obvious way around that.
-
-userdict /start-hook {
- TeXDict /df-tail /dvips.df-tail load bind put
- TeXDict /D /dvips.D load bind put
-} put
-
-%%* Introduce a symbolic constant for hyphens. (Need to make
-%%* allowance for hyphen being in different place?)
-
-/.hyphen 45 def
-
-% Write out a string. If it ends in a letter and a hyphen,
-% don't write the hyphen, and set .show.last to a hyphen;
-% otherwise, set .show.last to the character (or \000 if it was a hyphen).
-/.show.write % <string>
- {
- dup length 1 ge
- { dup dup length 1 sub get % string last_char
- dup .hyphen eq % string last_char hyphen?
- { % string last_char
- 1 index length 1 gt
- { 1 index dup length 2 sub get }
- { //.show.last 0 get }
- ifelse % string last_char prev-char
- currentfont /Encoding get exch get % look up prev-char
- //.letter.chars exch known % is it a letter?
- { % Remove the hyphen % string last_char
- exch % last_char string
- dup length 1 sub % last_char string len-1
- 0 exch getinterval % last_char string-1
- exch % string-1 last_char
- }
- { pop 0 } % string 0
- ifelse
- }
- if
- //.show.last 0 3 -1 roll put % store last_char
- % in .show.last
- % If .show.last ==
- % hyphen, then
- % last char of
- % previous string
- % was a hyphen
- }
- if % string
- currentfont /FontType get 0 ne
- {
- { % begin forall % c
- dup % c c
- currentfont /Encoding get % c c vec
- exch get % c name
- dup //.char.map exch known % c name bool
- { exch pop }
- { pop OT1Encoding exch get }
- ifelse % name
- //.char.map exch get % translation
- .show.stdout exch writestring
- }
- forall
- }
- { (\0) dup 0 get 0 eq
- { 0 1 put
- (%stderr) (w) file dup
- (*** Warning: composite font characters dumped without decoding.\n) writestring
- closefile
- }
- { pop
- }
- ifelse
- .show.stdout exch writestring
- }
- ifelse
-} odef
-
-/.showstring1 { % string
- currentpoint .coord % string x y
- 3 -1 roll dup .showwidth % x y string dx dy
- 1 index % x y string dx dy dx
- 0 rmoveto % x y string dx dy
- .dcoord pop % x y string width
- SIMPLE
- { % x y string width
- 2 index % x y string width y
- //.show.y .iget % x y string width y old.y
- %%*
- %%* Replaced test "has y changed" by "has y changed by more
- %%* than the current font height" so that subscripts and
- %%* superscripts won't cause line/paragraph breaks
- %%*
- sub abs dup % x y string width dy dy
- //.show.height .iget
- gt
- { % x y string width dy
-
- %%* Vertical position has changed by more than the font
- %%* height, so we now try to figure out whether we've
- %%* started a new paragraph or merely a new line, using a
- %%* variety of heuristics.
-
- %%* If any of the following is true, we start a new
- %%* paragraph:
-
- %%* (a) the current vertical shift is more than 1.1 times
- %%* the previous vertical shift, where 1.1 is an
- %%* arbitrarily chosen factor that could probably be
- %%* refined.
-
- dup % x y string width dy dy
- //.show.dy .iget 1.1 mul
- gt
- exch
-
- %%* Save the new vertical shift
-
- //.show.dy exch .iput
-
- %%* (b) The vertical shift is more than 1.3 times the
- %%* "size" of the current font. I've removed this
- %%* test since it's not really very useful.
-
-%%* //.show.dy .iget
-%%* //.show.height .iget 1.4 mul
-%%* gt % x y string width bool
-%%* .show.height .iget 0 gt and % only perform test if font
-%%* % height is nonzero
-%%* or
-
- %%* (c) the first character of the new line is one of the
- %%* .break.chars
-
- 2 index length % x y string width newpar? len
- 0 gt % x y string width newpar? len>0?
- {
- 2 index 0 get % x y string width newpar? s
- currentfont /Encoding get
- exch get % x y string width newpar? s_enc
- //.break.chars exch known { pop true } if
- }
- if % x y string width newpar?
-
- %%* (d) The indentation of the new line is greater than
- %%* the indentation of the previous line.
-
- 4 index
- //.show.indent .iget
- gt
- or
-
- %%* HOWEVER, if the line ends in a hyphen, we do NOT begin
- %%* a new paragraph (cf. comment at end of BF2). --dmj,
- %%* 12/23/97
-
- //.show.last 0 get .hyphen ne
- and
-
- % newpar?
- { (\n\n) } % Paragraph
- { % Line
- %%*
- %%* BF2: If last character on a line is
- %%* a hyphen, we omit the hyphen and
- %%* run the lines together. Of
- %%* course, this will fail if a word
- %%* with an explicit hyphen (e.g.,
- %%* X-ray) is split across two lines.
- %%* Oh, well. (What should we do
- %%* about a hyphen that ends a
- %%* "paragraph"? Perhaps that should
- %%* inhibit a paragraph break.)
- %%*
- //.show.last 0 get .hyphen eq
- { () }
- { (\n) }
- ifelse % x y string width char
- }
- ifelse
- //print
-
- //.show.y 3 index .iput % x y string width
- //.show.x 4 index .iput % x y string width
- //.show.indent 4 index .iput
- }
- { % x y string width dy
- % If the word processor split a hyphenated word within
- % the same line, put out the hyphen now.
- pop
- //.show.last 0 get .hyphen eq { (-) //print } if
- }
- ifelse
- %%*
- %%* If have moved more than 1 point to
- %%* the right, interpret it as a
- %%* space? This need to be looked at
- %%* more closely.
- %%*
- 3 index % x y string width x
- //.show.x .iget 10 add gt % x y string width bool
- { ( ) //print }
- if
- % x y string width
- 4 1 roll % width x y string
- .show.write pop % width x
- add //.show.x exch .iput % <empty>
- }
- { (S ) //print .show==4 }
- ifelse
-} odef
-
-/.showstring
- { dup () eq { pop } { .showstring1 } ifelse
- } bind def
-
-% Redefine all the string display operators.
-
-/show {
- .showfont
- .showcolor
- .showstring
-} codef
-
-% We define all the other operators in terms of .show1.
-
-/.show1.string ( ) def
-/.show1 { //.show1.string exch 0 exch put //.show1.string .showstring } odef
-/ashow
- { .showfont .showcolor
- { .show1 2 copy rmoveto } forall
- pop pop
- } codef
-/awidthshow
- { .showfont .showcolor
- { dup .show1 4 index eq { 4 index 4 index rmoveto } if
- 2 copy rmoveto
- }
- forall
- pop pop pop pop pop
- } codef
-/widthshow
- { .showfont .showcolor
- //.show1.string 0 4 -1 roll put
- { //.show1.string search not { exit } if
- .showstring .showstring
- 2 index 2 index rmoveto
- } loop
- .showstring pop pop
- } codef
-/kshow
- { .showfont .showcolor
- %**************** Should construct a closure, in case the procedure
- %**************** affects the o-stack.
- { .show1 dup exec } forall pop
- } codef
-
-% We don't really do the right thing with the Level 2 show operators,
-% but we do something semi-reasonable.
-/xshow { pop show } codef
-/yshow { pop show } codef
-/xyshow { pop show } codef
-/glyphshow
- { currentfont /Encoding .knownget not { {} } if
- 0 1 2 index length 1 sub
- { % Stack: glyph encoding index
- 2 copy get 3 index eq { exch pop exch pop null exit } if
- pop
- }
- for null eq { (X) dup 0 4 -1 roll put show } { pop } ifelse
- } codef
-
-end
-
-% Bind the operators we just defined, and all the others if we didn't
-% do it before.
-
-DELAYBIND { .bindnow } if
-
-% Make systemdict read-only if it wasn't already.
-
-systemdict wcheck { systemdict readonly pop } if
-
-% Restore the current local/global VM mode.
-
-exec
diff --git a/Master/tlpkg/tlgs/lib/ps2epsi.ps b/Master/tlpkg/tlgs/lib/ps2epsi.ps
index 35c203a85c6..65d5b862e00 100644
--- a/Master/tlpkg/tlgs/lib/ps2epsi.ps
+++ b/Master/tlpkg/tlgs/lib/ps2epsi.ps
@@ -164,7 +164,9 @@ ps2edict begin
dup rm gt
% If the new index is greater, we save index and element
{ /rm exch def } { pop } ifelse
- } if
+ } {
+ pop
+ } ifelse
} for
% Write out the magic string and bounding box information
diff --git a/Master/tlpkg/tlgs/lib/quit.ps b/Master/tlpkg/tlgs/lib/quit.ps
deleted file mode 100644
index ff604669be5..00000000000
--- a/Master/tlpkg/tlgs/lib/quit.ps
+++ /dev/null
@@ -1 +0,0 @@
-quit
diff --git a/Master/tlpkg/tlgs/lib/showchar.ps b/Master/tlpkg/tlgs/lib/showchar.ps
deleted file mode 100644
index 32a71c6862b..00000000000
--- a/Master/tlpkg/tlgs/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/Master/tlpkg/tlgs/lib/showpage.ps b/Master/tlpkg/tlgs/lib/showpage.ps
deleted file mode 100644
index 97a4789f75d..00000000000
--- a/Master/tlpkg/tlgs/lib/showpage.ps
+++ /dev/null
@@ -1 +0,0 @@
-showpage
diff --git a/Master/tlpkg/tlgs/lib/traceop.ps b/Master/tlpkg/tlgs/lib/traceop.ps
index 0b655df04de..6d5509b10fb 100644
--- a/Master/tlpkg/tlgs/lib/traceop.ps
+++ b/Master/tlpkg/tlgs/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/Master/tlpkg/tlgs/lib/type1enc.ps b/Master/tlpkg/tlgs/lib/type1enc.ps
deleted file mode 100644
index 42be0cfb218..00000000000
--- a/Master/tlpkg/tlgs/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/Master/tlpkg/tlgs/lib/type1ops.ps b/Master/tlpkg/tlgs/lib/type1ops.ps
deleted file mode 100644
index ce9d8d9431e..00000000000
--- a/Master/tlpkg/tlgs/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/Master/tlpkg/tlgs/lib/unprot.ps b/Master/tlpkg/tlgs/lib/unprot.ps
deleted file mode 100644
index d5b1d19ff7a..00000000000
--- a/Master/tlpkg/tlgs/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/Master/tlpkg/tlgs/lib/viewmiff.ps b/Master/tlpkg/tlgs/lib/viewmiff.ps
index 01855090348..4c918ea6859 100644
--- a/Master/tlpkg/tlgs/lib/viewmiff.ps
+++ b/Master/tlpkg/tlgs/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/Master/tlpkg/tlgs/lib/viewpbm.ps b/Master/tlpkg/tlgs/lib/viewpbm.ps
index 177f22bb63e..60d5782da1d 100644
--- a/Master/tlpkg/tlgs/lib/viewpbm.ps
+++ b/Master/tlpkg/tlgs/lib/viewpbm.ps
@@ -128,10 +128,10 @@
% show the tags as pseudo-color image
/ncomp 1 def /invert false def /maxv 1 def
[ /Indexed /DeviceRGB 255
- % TEXT=1, IMAGE=2, PATH=4, UNTOUCHED=8
- % red green blue gray
+ % UNTOUCHED=0, TEXT=1, IMAGE=2, PATH=4
+ % gray red green blue
768 string
- dup 0 <000000 ff0000 00ff00 ffff00 0000ff ff00ff 00ffff ffffff cccccc> putinterval
+ dup 0 <cccccc ff0000 00ff00 ffff00 0000ff ff00ff 00ffff ffffff 000000> putinterval
] setcolorspace
w h {
readstring pop
@@ -190,7 +190,7 @@
pop
/FITPAGE where {/FITPAGE get}{false} ifelse
{
- Width 72 mul SCALE mul Height 72 mul SCALE mul
+ Width SCALE mul Height SCALE mul
}
{
% Map pixels SCALE-for-1. Assume orthogonal transformation.
diff --git a/Master/tlpkg/tlgs/lib/wftopfa.ps b/Master/tlpkg/tlgs/lib/wftopfa.ps
deleted file mode 100644
index 005eaf83f53..00000000000
--- a/Master/tlpkg/tlgs/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/Master/tlpkg/tlgs/lib/wrfont.ps b/Master/tlpkg/tlgs/lib/wrfont.ps
deleted file mode 100644
index eeab341ac28..00000000000
--- a/Master/tlpkg/tlgs/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