From 4c7ea1ec21f149b4164551b72860054d241d4c16 Mon Sep 17 00:00:00 2001 From: Reinhard Kotucha Date: Sat, 10 Sep 2011 20:02:58 +0000 Subject: tlpkg/tlgs: gs-8.71 => gs-9.04 git-svn-id: svn://tug.org/texlive/trunk@23888 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/tlgs/README.TEXLIVE | 2 +- Master/tlpkg/tlgs/bin/gsdll32.dll | Bin 11575296 -> 14639104 bytes Master/tlpkg/tlgs/bin/gsdll32.lib | Bin 8014 -> 8014 bytes Master/tlpkg/tlgs/bin/gswin32.exe | Bin 147456 -> 147456 bytes Master/tlpkg/tlgs/bin/gswin32c.exe | Bin 139264 -> 139264 bytes Master/tlpkg/tlgs/lib/EndOfTask.ps | 2 +- Master/tlpkg/tlgs/lib/FAPIcidfmap | 32 - Master/tlpkg/tlgs/lib/FAPIconfig | 14 - Master/tlpkg/tlgs/lib/FAPIconfig-FCO | 2 +- Master/tlpkg/tlgs/lib/FAPIfontmap | 33 - Master/tlpkg/tlgs/lib/FCOfontmap-PCLPS3 | 2 +- Master/tlpkg/tlgs/lib/FCOfontmap-PS3 | 2 +- Master/tlpkg/tlgs/lib/PDFA_def.ps | 6 +- Master/tlpkg/tlgs/lib/PDFX_def.ps | 6 +- Master/tlpkg/tlgs/lib/acctest.ps | 8 +- Master/tlpkg/tlgs/lib/addxchar.ps | 68 +- Master/tlpkg/tlgs/lib/align.ps | 8 +- Master/tlpkg/tlgs/lib/bdftops.ps | 795 ------ Master/tlpkg/tlgs/lib/caption.ps | 12 +- Master/tlpkg/tlgs/lib/cat.ps | 148 +- Master/tlpkg/tlgs/lib/cid2code.ps | 38 +- Master/tlpkg/tlgs/lib/cidfmap | 63 + Master/tlpkg/tlgs/lib/decrypt.ps | 2 +- Master/tlpkg/tlgs/lib/docie.ps | 46 +- Master/tlpkg/tlgs/lib/dumphint.ps | 57 +- Master/tlpkg/tlgs/lib/font2c.ps | 180 +- Master/tlpkg/tlgs/lib/font2pcl.ps | 242 +- Master/tlpkg/tlgs/lib/gs_ce_e.ps | 8 +- Master/tlpkg/tlgs/lib/gs_cmdl.ps | 58 +- Master/tlpkg/tlgs/lib/gs_fform.ps | 32 +- Master/tlpkg/tlgs/lib/gs_il2_e.ps | 8 +- Master/tlpkg/tlgs/lib/gs_kanji.ps | 74 +- Master/tlpkg/tlgs/lib/gs_ksb_e.ps | 8 +- Master/tlpkg/tlgs/lib/gs_lgo_e.ps | 8 +- Master/tlpkg/tlgs/lib/gs_lgx_e.ps | 8 +- Master/tlpkg/tlgs/lib/gs_pfile.ps | 52 +- Master/tlpkg/tlgs/lib/gs_rdlin.ps | 8 +- Master/tlpkg/tlgs/lib/gs_wl1_e.ps | 40 +- Master/tlpkg/tlgs/lib/gs_wl2_e.ps | 40 +- Master/tlpkg/tlgs/lib/gs_wl5_e.ps | 40 +- Master/tlpkg/tlgs/lib/gslp.ps | 114 +- Master/tlpkg/tlgs/lib/gsnup.ps | 18 +- Master/tlpkg/tlgs/lib/ht_ccsto.ps | 2 +- Master/tlpkg/tlgs/lib/image-qa.ps | 464 ++-- Master/tlpkg/tlgs/lib/impath.ps | 22 +- Master/tlpkg/tlgs/lib/jispaper.ps | 8 +- Master/tlpkg/tlgs/lib/jobseparator.ps | 2 +- Master/tlpkg/tlgs/lib/landscap.ps | 8 +- Master/tlpkg/tlgs/lib/level1.ps | 2 +- Master/tlpkg/tlgs/lib/lines.ps | 20 +- Master/tlpkg/tlgs/lib/markhint.ps | 14 +- Master/tlpkg/tlgs/lib/markpath.ps | 10 +- Master/tlpkg/tlgs/lib/mkcidfm.ps | 497 +++- Master/tlpkg/tlgs/lib/opdfread.ps | 4594 +++++++++++++++++++++++++++++++ Master/tlpkg/tlgs/lib/packfile.ps | 80 +- Master/tlpkg/tlgs/lib/pcharstr.ps | 16 +- Master/tlpkg/tlgs/lib/pdf2dsc.ps | 26 +- Master/tlpkg/tlgs/lib/pdfopt.ps | 375 ++- Master/tlpkg/tlgs/lib/pdfwrite.ps | 38 +- Master/tlpkg/tlgs/lib/pf2afm.ps | 5 +- Master/tlpkg/tlgs/lib/pfbtopfa.ps | 8 +- Master/tlpkg/tlgs/lib/ppath.ps | 8 +- Master/tlpkg/tlgs/lib/pphs.ps | 26 +- Master/tlpkg/tlgs/lib/prfont.ps | 60 +- Master/tlpkg/tlgs/lib/printafm.ps | 234 +- Master/tlpkg/tlgs/lib/ps2ai.ps | 56 +- Master/tlpkg/tlgs/lib/ps2ascii.ps | 170 +- Master/tlpkg/tlgs/lib/ps2epsi.ps | 125 +- Master/tlpkg/tlgs/lib/rollconv.ps | 61 +- Master/tlpkg/tlgs/lib/showchar.ps | 12 +- Master/tlpkg/tlgs/lib/stcinfo.ps | 106 +- Master/tlpkg/tlgs/lib/stcolor.ps | 37 +- Master/tlpkg/tlgs/lib/stocht.ps | 8 +- Master/tlpkg/tlgs/lib/traceimg.ps | 8 +- Master/tlpkg/tlgs/lib/traceop.ps | 10 +- Master/tlpkg/tlgs/lib/type1enc.ps | 10 +- Master/tlpkg/tlgs/lib/type1ops.ps | 18 +- Master/tlpkg/tlgs/lib/uninfo.ps | 26 +- Master/tlpkg/tlgs/lib/unprot.ps | 8 +- Master/tlpkg/tlgs/lib/viewcmyk.ps | 14 +- Master/tlpkg/tlgs/lib/viewgif.ps | 66 +- Master/tlpkg/tlgs/lib/viewjpeg.ps | 76 +- Master/tlpkg/tlgs/lib/viewmiff.ps | 60 +- Master/tlpkg/tlgs/lib/viewpbm.ps | 40 +- Master/tlpkg/tlgs/lib/viewpcx.ps | 50 +- Master/tlpkg/tlgs/lib/viewps2a.ps | 8 +- Master/tlpkg/tlgs/lib/viewrgb.ps | 100 +- Master/tlpkg/tlgs/lib/wftopfa.ps | 26 +- Master/tlpkg/tlgs/lib/winmaps.ps | 10 +- Master/tlpkg/tlgs/lib/wrfont.ps | 264 +- Master/tlpkg/tlgs/lib/zeroline.ps | 8 +- 91 files changed, 7178 insertions(+), 3002 deletions(-) mode change 100755 => 100644 Master/tlpkg/tlgs/bin/gsdll32.dll delete mode 100644 Master/tlpkg/tlgs/lib/FAPIcidfmap delete mode 100644 Master/tlpkg/tlgs/lib/FAPIconfig delete mode 100644 Master/tlpkg/tlgs/lib/FAPIfontmap delete mode 100644 Master/tlpkg/tlgs/lib/bdftops.ps create mode 100644 Master/tlpkg/tlgs/lib/cidfmap create mode 100644 Master/tlpkg/tlgs/lib/opdfread.ps (limited to 'Master/tlpkg/tlgs') diff --git a/Master/tlpkg/tlgs/README.TEXLIVE b/Master/tlpkg/tlgs/README.TEXLIVE index 625c2e4a358..b9a5bfb3f01 100644 --- a/Master/tlpkg/tlgs/README.TEXLIVE +++ b/Master/tlpkg/tlgs/README.TEXLIVE @@ -1,5 +1,5 @@ -This directory contains a subset of the Ghostscript 8.71 distribution +This directory contains a subset of the Ghostscript 9.04 distribution for Windows. The only purpose of this package is to support programs shipped with TeX Live. It's not intended for general use. diff --git a/Master/tlpkg/tlgs/bin/gsdll32.dll b/Master/tlpkg/tlgs/bin/gsdll32.dll old mode 100755 new mode 100644 index 21112d0ed4f..3598ab4a452 Binary files a/Master/tlpkg/tlgs/bin/gsdll32.dll and b/Master/tlpkg/tlgs/bin/gsdll32.dll differ diff --git a/Master/tlpkg/tlgs/bin/gsdll32.lib b/Master/tlpkg/tlgs/bin/gsdll32.lib index dd2d26c7d47..deeefd19f5e 100644 Binary files a/Master/tlpkg/tlgs/bin/gsdll32.lib and b/Master/tlpkg/tlgs/bin/gsdll32.lib differ diff --git a/Master/tlpkg/tlgs/bin/gswin32.exe b/Master/tlpkg/tlgs/bin/gswin32.exe index 6caf62d4220..29f4528f63b 100755 Binary files a/Master/tlpkg/tlgs/bin/gswin32.exe and b/Master/tlpkg/tlgs/bin/gswin32.exe differ diff --git a/Master/tlpkg/tlgs/bin/gswin32c.exe b/Master/tlpkg/tlgs/bin/gswin32c.exe index acb5afad16a..d9c915cc217 100755 Binary files a/Master/tlpkg/tlgs/bin/gswin32c.exe and b/Master/tlpkg/tlgs/bin/gswin32c.exe differ diff --git a/Master/tlpkg/tlgs/lib/EndOfTask.ps b/Master/tlpkg/tlgs/lib/EndOfTask.ps index 45a8ca02bfc..ce9a8a9d59b 100644 --- a/Master/tlpkg/tlgs/lib/EndOfTask.ps +++ b/Master/tlpkg/tlgs/lib/EndOfTask.ps @@ -1 +1 @@ - \ No newline at end of file + diff --git a/Master/tlpkg/tlgs/lib/FAPIcidfmap b/Master/tlpkg/tlgs/lib/FAPIcidfmap deleted file mode 100644 index 38e42e60df1..00000000000 --- a/Master/tlpkg/tlgs/lib/FAPIcidfmap +++ /dev/null @@ -1,32 +0,0 @@ -%! -% $Id: FAPIcidfmap 6826 2006-05-31 15:29:52Z leonardo $ -% This is a sample map file for FAPI CID fonts. - -% -% The map is a set of records like this : -% -% /CIDfont_name options_dict ; -% -% where options_dict is a dictionary with the following entries : -% -% Key Type Description -% Path string Absolute path to font file, or relative path to font file from -% the GS_EXTFONTPATH value. -% CIDFontType interger PostScript type for this CID font. Only 0 is currently allowed. -% Note that this is unrelated to the real type of the font file - -% the bridge will perform format conversion. -% FAPI name Name of the renderer to be used with the font. Only /UFST is now allowed. -% SubfontId integer (optional) Index of the font in font collection, such as FCO or TTC. -% It is being ignored if /Path doesn't specify a collection. -% Default value is 0. -% CSI array Must have strongly 2 elements. -% The first element of the array specifies Ordering of CIDSystemInfo. -% The second element specifies Supplement of CIDSystemInfo. -% -% Use regular Postscript syntax. -% -% Examples : -% -% /Ryumin-Medium << /Path (msgothic.ttc) /CIDFontType 0 /FAPI /UFST /CSI [(Japan1) 2] >> ; -% /HeiseiKakuGo-W5 << /Path (F:/WIN2000/Fonts/BATANG.TTC) /CIDFontType 0 /FAPI /UFST /CSI [(Japan1) 2] >> ; - diff --git a/Master/tlpkg/tlgs/lib/FAPIconfig b/Master/tlpkg/tlgs/lib/FAPIconfig deleted file mode 100644 index c539b9266d7..00000000000 --- a/Master/tlpkg/tlgs/lib/FAPIconfig +++ /dev/null @@ -1,14 +0,0 @@ -%! -% $Id: FAPIconfig 6870 2006-06-20 16:31:15Z leonardo $ -% This is configuration file for FAPI client. - -/FontPath (/Fonts) % A default directory for FAPI-handled font files path in FAPIfontmap. -/CIDFontPath (/CIDFonts) % A default directory for FAPI-handled CID font files path in FAPIcidfmap. -/HookDiskFonts [1 2 9 11 42] % FontType values for disk PS fonts to be redirected to FAPI. -/HookEmbeddedFonts [1 2 9 11 42] % FontType values for embedded PS fonts to be redirected to FAPI. - -% Values allowed for HookDiskFonts and HookEmbeddedFonts are 1, 2, 9, 11, 42. -% "Disk fonts" are fonts being installed to Ghostscript with 'lib/Fontmap' or with GS_FONTPATH, -% and CID font resource files. -% "Embedded fonts" are fonts and CID fonts being embedded into a document. - diff --git a/Master/tlpkg/tlgs/lib/FAPIconfig-FCO b/Master/tlpkg/tlgs/lib/FAPIconfig-FCO index dcd8ac53bf5..40e454a3ed6 100644 --- a/Master/tlpkg/tlgs/lib/FAPIconfig-FCO +++ b/Master/tlpkg/tlgs/lib/FAPIconfig-FCO @@ -1,5 +1,5 @@ %! -% $Id: FAPIconfig-FCO 6998 2006-08-18 04:42:11Z ray $ +% $Id$ % This is configuration file for FAPI client. /FontPath () % A default directory for FAPI-handled font files path in FAPIfontmap. diff --git a/Master/tlpkg/tlgs/lib/FAPIfontmap b/Master/tlpkg/tlgs/lib/FAPIfontmap deleted file mode 100644 index 0fedcdeaef8..00000000000 --- a/Master/tlpkg/tlgs/lib/FAPIfontmap +++ /dev/null @@ -1,33 +0,0 @@ -%! -% $Id: FAPIfontmap 6870 2006-06-20 16:31:15Z leonardo $ -% This is a sample map file for FAPI fonts. - -% -% The map is a set of records like this : -% -% /font_name options_dict ; -% -% where options_dict is a dictionary with the following entries : -% -% Key Type Description -% Path string Absolute path to font file, or relative path to font file from -% the GS_EXTFONTPATH value. -% FontType interger PostScript type for this font. Only 1 and 42 are currently allowed. -% Note that this is unrelated to the real type of the font file - -% the bridge will perform format conversion. -% FAPI name Name of the renderer to be used with the font. Only /AgfaUFST is now allowed. -% SubfontId integer (optional) Index of the font in font collection, such as FCO or TTC. -% It is being ignored if /Path doesn't specify a collection. -% Default value is 0. -% Decoding name (optional) The name of a Decoding resource to be used with the font. -% If specified, "xlatmap" doesn't work for this font. -% -% Use regular Postscript syntax. -% -% Examples : -% -% /ArialTT << /Path (arial.ttf) /FontType 1 /FAPI /UFST >> ; -% /CourierTT << /Path (F:/WIN2000/Fonts/cour.ttf) /FontType 1 /FAPI /UFST >> ; -% /FCO1 << /Path (F:/AFPL/ufst/fontdata/MTFONTS/PCLPS3/MT1/PCLP3__G.FCO) /FontType 42 /FAPI /UFST /SubfontId 10 >> ; -% - diff --git a/Master/tlpkg/tlgs/lib/FCOfontmap-PCLPS3 b/Master/tlpkg/tlgs/lib/FCOfontmap-PCLPS3 index 08b75282c37..7e794fd6413 100644 --- a/Master/tlpkg/tlgs/lib/FCOfontmap-PCLPS3 +++ b/Master/tlpkg/tlgs/lib/FCOfontmap-PCLPS3 @@ -13,7 +13,7 @@ % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: FCOfontmap-PCLPS3 8269 2007-10-03 17:37:35Z ray $ +% $Id$ % May add general FAPIfontmap records here like this : /Wingdings-Regular << /Path FCOfontfile2 /FontType 1 /FAPI /UFST /SubfontId 0 /Encoding /Wingdings /Decoding /FCO_Wingdings>> ; diff --git a/Master/tlpkg/tlgs/lib/FCOfontmap-PS3 b/Master/tlpkg/tlgs/lib/FCOfontmap-PS3 index c543f072284..666c82a391b 100644 --- a/Master/tlpkg/tlgs/lib/FCOfontmap-PS3 +++ b/Master/tlpkg/tlgs/lib/FCOfontmap-PS3 @@ -13,7 +13,7 @@ % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: FCOfontmap-PS3 8269 2007-10-03 17:37:35Z ray $ +% $Id$ % May add general FAPIfontmap records here like this : /Wingdings-Regular << /Path FCOfontfile2 /FontType 1 /FAPI /UFST /SubfontId 0 /Encoding /Wingdings /Decoding /FCO_Wingdings>> ; diff --git a/Master/tlpkg/tlgs/lib/PDFA_def.ps b/Master/tlpkg/tlgs/lib/PDFA_def.ps index e351f76cc6b..7fe7871370a 100644 --- a/Master/tlpkg/tlgs/lib/PDFA_def.ps +++ b/Master/tlpkg/tlgs/lib/PDFA_def.ps @@ -1,22 +1,20 @@ %! -% $Id: PDFA_def.ps 8284 2007-10-10 17:40:38Z giles $ +% $Id$ % This is a sample prefix file for creating a PDF/A document. % Feel free to modify entries marked with "Customize". % This assumes an ICC profile to reside in the file (ISO Coated sb.icc), % unless the user modifies the corresponding line below. - systemdict /ProcessColorModel known { systemdict /ProcessColorModel get dup /DeviceGray ne exch /DeviceCMYK ne and } { true -} ifelse +} ifelse { (ERROR: ProcessColorModel must be /DeviceGray or DeviceCMYK.)= /ProcessColorModel cvx /rangecheck signalerror } if - % Define entries to the document Info dictionary : /ICCProfile (ISO Coated sb.icc) % Customize. diff --git a/Master/tlpkg/tlgs/lib/PDFX_def.ps b/Master/tlpkg/tlgs/lib/PDFX_def.ps index e276663848b..60c6d15aec0 100644 --- a/Master/tlpkg/tlgs/lib/PDFX_def.ps +++ b/Master/tlpkg/tlgs/lib/PDFX_def.ps @@ -1,22 +1,20 @@ %! -% $Id: PDFX_def.ps 8284 2007-10-10 17:40:38Z giles $ +% $Id$ % This is a sample prefix file for creating a PDF/X-3 document. % Feel free to modify entries marked with "Customize". % This assumes an ICC profile to reside in the file (ISO Coated sb.icc), % unless the user modifies the corresponding line below. - systemdict /ProcessColorModel known { systemdict /ProcessColorModel get dup /DeviceGray ne exch /DeviceCMYK ne and } { true -} ifelse +} ifelse { (ERROR: ProcessColorModel must be /DeviceGray or DeviceCMYK.)= /ProcessColorModel cvx /rangecheck signalerror } if - % Define entries to the document Info dictionary : /ICCProfile (ISO Coated sb.icc) def % Customize or remove. diff --git a/Master/tlpkg/tlgs/lib/acctest.ps b/Master/tlpkg/tlgs/lib/acctest.ps index bd5f7142923..6c8adf7958d 100644 --- a/Master/tlpkg/tlgs/lib/acctest.ps +++ b/Master/tlpkg/tlgs/lib/acctest.ps @@ -1,6 +1,6 @@ %! % Check that operators do their access tests correctly. -% $Id: acctest.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % proc dotest => . /dotest @@ -17,7 +17,7 @@ def 0 0 moveto % So the show commands don't bomb because of nocurrentpoint. -{ [1 2] executeonly aload } dotest +{ [1 2] executeonly aload } dotest { (string) executeonly (seek) anchorsearch } dotest { (string) (seek) executeonly anchorsearch } dotest { 100 101 (string) noaccess ashow} dotest @@ -36,7 +36,7 @@ def { 1 10 1 string readonly cvrs } dotest { true 5 string readonly cvs } dotest { 1 dict readonly begin /foo true def } dotest -{ 10 array readonly dictstack } dotest +{ 10 array readonly dictstack } dotest { 1 string executeonly 1 string eq } dotest { 1 string 1 string executeonly eq } dotest { 10 array readonly execstack } dotest @@ -67,7 +67,7 @@ def { 1 dict noaccess maxlength } dotest { 1 string executeonly 1 string ne } dotest { 1 string 1 string executeonly ne } dotest -%{ newpath 0 0 moveto (a) false charpath +%{ newpath 0 0 moveto (a) false charpath % {} {} {} {} pathforall closepath } dotest { 1 array executeonly 0 put } dotest { 1 dict noaccess /key put } dotest diff --git a/Master/tlpkg/tlgs/lib/addxchar.ps b/Master/tlpkg/tlgs/lib/addxchar.ps index 05668739fa0..2895bd739c6 100644 --- a/Master/tlpkg/tlgs/lib/addxchar.ps +++ b/Master/tlpkg/tlgs/lib/addxchar.ps @@ -1,19 +1,19 @@ % Copyright (C) 1999 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: addxchar.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Add the Central European and other Adobe extended Latin characters to a % Type 1 font. % Requires -dWRITESYSTEMDICT to disable access protection. @@ -26,7 +26,7 @@ addce_dict begin % Define the added copyright notice. -/addednotice (. Portions Copyright (C) 1999 Aladdin Enterprises.) def +/addednotice (. Portions Copyright (C) 1999 Aladdin Enterprises.) def % Open a font for modification by removing the FID and changing the % FontName. Removing UniqueID and XUID is not necessary, since we @@ -46,7 +46,7 @@ addce_dict begin % Do the equivalent of charpath + pathbbox for a glyph. /glyphbbox { % glyphbbox - % We cache this value, because it's expensive to compute. + % We cache this value, because it's expensive to compute. BBoxes 1 index .knownget { exch pop } { @@ -57,7 +57,7 @@ addce_dict begin % Get the side bearing and width for a glyph. /glyphsbw { % glyphsbw - % We cache this value, because it's expensive to compute. + % We cache this value, because it's expensive to compute. SBW 1 index .knownget { exch pop } { @@ -77,9 +77,9 @@ addce_dict begin % Find an occurrence of a value in an array. /asearch { % asearch true - % asearch false + % asearch false false 0 4 2 roll exch { - % Stack: false index value element + % Stack: false index value element 2 copy eq { pop pop exch not exch dup exit } if exch 1 add exch } forall pop pop @@ -103,7 +103,7 @@ addce_dict begin % Defines accent, base, abox, bbox. % The initial dx lines up the origins of the base and the accent. /beginseac { % beginseac - % -mark- /hsbw + % -mark- /hsbw /accent exch def /base exch def /abox [accent glyphbbox] def /bbox [base glyphbbox] def @@ -212,14 +212,14 @@ addce_dict begin 0 } ifelse def - % Invert the Encoding (needed for seac). + % 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. + % Add the commaaccent character, by moving the comma downward. /comma glyphbbox /commatop exch def pop pop pop /comma glyphcs @@ -227,24 +227,24 @@ addce_dict begin [ exch { caedit 1 index .knownget { exec } if } forall ] /commaaccent exch csdef - % Add the accented characters that can be made with seac. + % 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. + % 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 + % ... 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 + pop 0 } ifelse finishseac } forall @@ -269,9 +269,9 @@ addce_dict begin seaccaronchars { dup =string cvs 0 1 getinterval cvn /quoteright beginseac - % Move the quote to the right of the character. + % 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. + % 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 @@ -280,26 +280,26 @@ addce_dict begin dup =string cvs 0 1 getinterval cvn /comma beginseac centeraccent commatop neg - % Lower the accent if the character extends below - % the baseline + % 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. + % 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. + % Add the one remaining character. CharStrings /Dcroat CharStrings /Eth get put - % Recompute the FontBBox, since some of the accented characters - % may have enlarged it. + % 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 { @@ -309,7 +309,7 @@ addce_dict begin } forall /FontBBox llx cvi lly cvi urx ceiling cvi ury ceiling cvi 4 packedarray def - % Restore the Encoding and wrap up. + % Restore the Encoding and wrap up. [/Copyright /Notice] { FontInfo 1 index .knownget { diff --git a/Master/tlpkg/tlgs/lib/align.ps b/Master/tlpkg/tlgs/lib/align.ps index 23bd61a8950..eb67a3e4500 100644 --- a/Master/tlpkg/tlgs/lib/align.ps +++ b/Master/tlpkg/tlgs/lib/align.ps @@ -1,19 +1,19 @@ % Copyright (C) 1989, 1996 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: align.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Print a page that indicates the proper settings of Margins and HWMargins % for a given device. Requires a Level 2 system. diff --git a/Master/tlpkg/tlgs/lib/bdftops.ps b/Master/tlpkg/tlgs/lib/bdftops.ps deleted file mode 100644 index bf310c529de..00000000000 --- a/Master/tlpkg/tlgs/lib/bdftops.ps +++ /dev/null @@ -1,795 +0,0 @@ -% Copyright (C) 1990, 1995, 1996 Aladdin Enterprises. 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. -% -% For more information about licensing, please refer to -% http://www.ghostscript.com/licensing/. For information on -% commercial licensing, go to http://www.artifex.com/licensing/ or -% contact Artifex Software, Inc., 101 Lucas Valley Road #110, -% San Rafael, CA 94903, U.S.A., +1(415)492-9861. - -% $Id: bdftops.ps 6300 2005-12-28 19:56:24Z giles $ -% bdftops.ps -% Convert a BDF file (possibly with (an) associated AFM file(s)) -% to a PostScript Type 1 font (without eexec encryption). -% The resulting font will work with any PostScript language interpreter, -% but not with ATM or other font rasterizers lacking a complete interpreter. - -/envBDF 120 dict def -envBDF begin - -% "Import" the image-to-path package. -% This also brings in the Type 1 opcodes (type1ops.ps). - (impath.ps) runlibfile - -% "Import" the font-writing package. - (wrfont.ps) runlibfile - wrfont_dict begin - /binary_CharStrings false def - /binary_tokens false def - /encrypt_CharStrings true def - /standard_only true def - end - /lenIV 0 def - -% Invert the StandardEncoding vector. - 256 dict dup begin - 0 1 255 { dup StandardEncoding exch get exch def } for - end /StandardDecoding exch def - -% Define the properties copied to FontInfo. - mark - (COPYRIGHT) /Notice - (FAMILY_NAME) /FamilyName - (FULL_NAME) /FullName - (WEIGHT_NAME) /Weight - .dicttomark /properties exch def - -% Define the character sequences for synthesizing missing composite -% characters in the standard encoding. - mark - /AE [/A /E] - /OE [/O /E] - /ae [/a /e] - /ellipsis [/period /period /period] - /emdash [/hyphen /hyphen /hyphen] - /endash [/hyphen /hyphen] - /fi [/f /i] - /fl [/f /l] - /germandbls [/s /s] - /guillemotleft [/less /less] - /guillemotright [/greater /greater] - /oe [/o /e] - /quotedblbase [/comma /comma] - .dicttomark /composites exch def - -% Define the procedure for synthesizing composites. -% This must not be bound. - /compose - { exch pop - FontMatrix Private /composematrix get invertmatrix concat - 0 0 moveto - dup gsave false charpath pathbbox currentpoint grestore - 6 2 roll setcachedevice show - } def -% Define the CharString procedure that calls compose, with the string -% on the stack. This too must remain unbound. - /compose_proc - { Private /compose get exec - } def - -% Define aliases for missing characters similarly. - mark - /acute /quoteright - /bullet /asterisk - /cedilla /comma - /circumflex /asciicircum - /dieresis /quotedbl - /dotlessi /i - /exclamdown /exclam - /florin /f - /fraction /slash - /grave /quoteleft - /guilsinglleft /less - /guilsinglright /greater - /hungarumlaut /quotedbl - /periodcentered /asterisk - /questiondown /question - /quotedblleft /quotedbl - /quotedblright /quotedbl - /quotesinglbase /comma - /quotesingle /quoteright - /tilde /asciitilde - .dicttomark /aliases exch def - -% Define overstruck characters that can be synthesized with seac. - mark - [ /Aacute /Acircumflex /Adieresis /Agrave /Aring /Atilde - /Ccedilla - /Eacute /Ecircumflex /Edieresis /Egrave - /Iacute /Icircumflex /Idieresis /Igrave - /Lslash - /Ntilde - /Oacute /Ocircumflex /Odieresis /Ograve /Otilde - /Scaron - /Uacute /Ucircumflex /Udieresis /Ugrave - /Yacute /Ydieresis - /Zcaron - /aacute /acircumflex /adieresis /agrave /aring /atilde - /ccedilla - /eacute /ecircumflex /edieresis /egrave - /iacute /icircumflex /idieresis /igrave - /lslash - /ntilde - /oacute /ocircumflex /odieresis /ograve /otilde - /scaron - /uacute /ucircumflex /udieresis /ugrave - /yacute /ydieresis - /zcaron - ] - { dup =string cvs - [ exch dup 0 1 getinterval cvn - exch dup length 1 sub 1 exch getinterval cvn - ] - } forall - /cent [/c /slash] - /daggerdbl [/bar /equal] - /divide [/colon /hyphen] - /sterling [/L /hyphen] - /yen [/Y /equal] - .dicttomark /accentedchars exch def - -% ------ Output utilities ------ % - - /ws {psfile exch writestring} bind def - /wl {ws (\n) ws} bind def - /wt {=string cvs ws ( ) ws} bind def - -% ------ BDF file parsing utilities ------ % - -% Define a buffer for reading the BDF file. - /buffer 400 string def - -% Read a line from the BDF file into the buffer. -% Ignore empty (zero-length) lines. -% Define /keyword as the first word on the line. -% Define /args as the remainder of the line. -% If the keyword is equal to commentword, skip the line. -% (If commentword is equal to a space, never skip.) - /nextline - { { bdfile buffer readline not - { (Premature EOF\n) print stop } if - dup length 0 ne { exit } if pop - } - loop - ( ) search - { /keyword exch def pop } - { /keyword exch def () } - ifelse - /args exch def - keyword commentword eq { nextline } if - } bind def - -% Get a word argument from args. We do *not* copy the string. - /warg % warg -> string - { args ( ) search - { exch pop exch } - { () } - ifelse /args exch def - } bind def - -% Get an integer argument from args. - /iarg % iarg -> int - { warg cvi - } bind def - -% Get a numeric argument from args. - /narg % narg -> int|real - { warg cvr - dup dup cvi eq { cvi } if - } bind def - -% Convert the remainder of args into a string. - /remarg % remarg -> string - { args copystring - } bind def - -% Get a string argument that occupies the remainder of args. - /sarg % sarg -> string - { args (") anchorsearch - { pop /args exch def } { pop } ifelse - args args length 1 sub get (") 0 get eq - { args 0 args length 1 sub getinterval /args exch def } if - args copystring - } bind def - -% Check that the keyword is the expected one. - /checkline % (EXPECTED-KEYWORD) checkline -> - { dup keyword ne - { (Expected ) print = - (Line=) print keyword print ( ) print args print (\n) print stop - } if - pop - } bind def - -% Read a line and check its keyword. - /getline % (EXPECTED-KEYWORD) getline -> - { nextline checkline - } bind def - -% Find the first/last non-zero bit of a non-zero byte. - /fnzb - { 0 { exch dup 128 ge { pop exit } { dup add exch 1 add } ifelse } - loop - } bind def - /lnzb - { 7 { exch dup 1 and 0 ne { pop exit } { -1 bitshift exch 1 sub } ifelse } - loop - } bind def - -% ------ Type 1 encoding utilities ------ % - -% Parse the side bearing and width information that begins a CharString. -% Arguments: charstring. Result: sbx sby wx wy substring. - /parsesbw - { mark exch lenIV - { % stack: mark ... string dropcount - dup 2 index length exch sub getinterval - dup 0 get dup 32 lt { pop exit } if - dup 246 le - { 139 sub exch 1 } - { dup 250 le - { 247 sub 8 bitshift 108 add 1 index 1 get add exch 2 } - { dup 254 le - { 251 sub 8 bitshift 108 add 1 index 1 get add neg exch 2 } - { pop dup 1 get 128 xor 128 sub - 8 bitshift 1 index 2 get add - 8 bitshift 1 index 3 get add - 8 bitshift 1 index 4 get add exch 5 - } ifelse - } ifelse - } ifelse - } loop - counttomark 3 eq { 0 3 1 roll 0 exch } if - 6 -1 roll pop - } bind def - -% Find the side bearing and width information that begins a CharString. -% Arguments: charstring. Result: charstring sizethroughsbw. - /findsbw - { dup parsesbw 4 { exch pop } repeat skipsbw - } bind def - /skipsbw % charstring sbwprefix -> sizethroughsbw - { length 1 index length exch sub - 2 copy get 12 eq { 2 } { 1 } ifelse add - } bind def - -% Encode a number, and append it to a string. -% Arguments: str num. Result: newstr. - /concatnum - { dup dup -107 ge exch 107 le and - { 139 add 1 string dup 0 3 index put } - { dup dup -1131 ge exch 1131 le and - { dup 0 ge { 16#f694 } { neg 16#fa94 } ifelse add - 2 string dup 0 3 index -8 bitshift put - dup 1 3 index 255 and put - } - { 5 string dup 0 255 put exch - 2 copy 1 exch -24 bitshift 255 and put - 2 copy 2 exch -16 bitshift 255 and put - 2 copy 3 exch -8 bitshift 255 and put - 2 copy 4 exch 255 and put - exch - } - ifelse - } - ifelse exch pop concatstrings - } bind def - -% ------ Point arithmetic utilities ------ % - - /ptadd { exch 4 -1 roll add 3 1 roll add } bind def - /ptexch { 4 2 roll } bind def - /ptneg { neg exch neg exch } bind def - /ptpop { pop pop } bind def - /ptsub { ptneg ptadd } bind def - -% ------ The main program ------ % - - /readBDF % - % readBDF -> - { /xuid exch def % may be null - /uniqueID exch def % may be -1 - /encodingname exch def - /encoding encodingname cvx exec def - /fontname exch def - /psname exch def - /bdfname exch def - gsave % so we can set the CTM to the font matrix - -% Open the input files. We don't open the output file until -% we've done a minimal validity check on the input. - bdfname (r) file /bdfile exch def - /commentword ( ) def - -% Check for the STARTFONT. - (STARTFONT) getline - args (2.1) ne { (Not version 2.1\n) print stop } if - -% Initialize the font. - /Font 20 dict def - Font begin - /FontName fontname def - /PaintType 0 def - /FontType 1 def - uniqueID 0 gt { /UniqueID uniqueID def } if - xuid null ne { /XUID xuid def } if - /Encoding encoding def - /FontInfo 20 dict def - /Private 20 dict def - currentdict end currentdict end - exch begin begin % insert font above environment - -% Initialize the Private dictionary in the font. - Private begin - /-! {string currentfile exch readhexstring pop} readonly def - /-| {string currentfile exch readstring pop} readonly def - /|- {readonly def} readonly def - /| {readonly put} readonly def - /BlueValues [] def - /lenIV lenIV def - /MinFeature {16 16} def - /password 5839 def - /UniqueID uniqueID def - end % Private - -% Invert the Encoding, for synthesizing composite characters. - /decoding encoding length dict def - 0 1 encoding length 1 sub - { dup encoding exch get exch decoding 3 1 roll put } - for - -% Now open the output file. - psname (w) file /psfile exch def - -% Put out a header compatible with the Adobe "standard". - (%!FontType1-1.0: ) ws fontname wt (000.000) wl - (% This is a font description converted from ) ws - bdfname wl - (% by bdftops running on ) ws - statusdict /product get ws ( revision ) ws - revision =string cvs ws (.) wl - -% Copy the initial comments, up to FONT. - true - { nextline - keyword (COMMENT) ne {exit} if - { (% Here are the initial comments from the BDF file:\n%) wl - } if false - (%) ws remarg wl - } loop pop - () wl - /commentword (COMMENT) def % do skip comments from now on - -% Read and process the FONT, SIZE, and FONTBOUNDINGBOX. - % If we cared about FONT, we'd use it here. If the BDF files - % from MIT had PostScript names rather than X names, we would - % care; but what's there is unusable, so we discard FONT. - % The FONTBOUNDINGBOX may not be reliable, so we discard it too. - (FONT) checkline - (SIZE) getline - /pointsize iarg def /xres iarg def /yres iarg def - (FONTBOUNDINGBOX) getline - nextline - -% Initialize the font bounding box bookeeping. - /fbbxo 1000 def - /fbbyo 1000 def - /fbbxe -1000 def - /fbbye -1000 def - -% Read and process the properties. We only care about a few of them. - keyword (STARTPROPERTIES) eq - { iarg - { nextline - properties keyword known - { FontInfo properties keyword get sarg readonly put - } if - } repeat - (ENDPROPERTIES) getline - nextline - } if - -% Compute and set the FontMatrix. - Font /FontMatrix - [ 0.001 0 0 0.001 xres mul yres div 0 0 ] readonly - dup setmatrix put - -% Read and process the header for the bitmaps. - (CHARS) checkline - /ccount iarg def - -% Initialize the CharStrings dictionary. - /charstrings ccount - composites length add - aliases length add - accentedchars length add - 1 add dict def % 1 add for .notdef - /isfixedwidth true def - /fixedwidth null def - /subrcount 0 def - /subrs [] def - -% Read the bitmap data. This reads the remainder of the file. -% We do this before processing the bitmaps so that we can compute -% the correct FontBBox first. - /chardata ccount dict def - ccount -1 1 - { (STARTCHAR) getline - /charname remarg def - (ENCODING) getline - /eindex iarg def - eindex dup 0 ge exch 255 le and - { charname /charname StandardEncoding eindex get def - charname /.notdef eq eindex 0 gt and - { /charname (A) eindex =string cvs concatstrings cvn def - } - if - (/) print charname =string cvs print (,) print print - } - { (/) print charname print - } - ifelse - 10 mod 1 eq { (\n) print flush } if - (SWIDTH) getline - /swx iarg pointsize mul 1000 div xres mul 72 div def - /swy iarg pointsize mul 1000 div xres mul 72 div def - (DWIDTH) getline % Ignore, use SWIDTH instead - (BBX) getline - /bbw iarg def /bbh iarg def /bbox iarg def /bboy iarg def - nextline - keyword (ATTRIBUTES) eq - { nextline - } if - (BITMAP) checkline - -% Update the font bounding box. - /fbbxo fbbxo bbox .min def - /fbbyo fbbyo bboy .min def - /fbbxe fbbxe bbox bbw add .max def - /fbbye fbbye bboy bbh add .max def - -% Read the bits for this character. - /raster bbw 7 add 8 idiv def - /cbits raster bbh mul string def - cbits length 0 gt - { 0 raster cbits length raster sub - { cbits exch raster getinterval - bdfile buffer readline not - { (EOF in bitmap\n) print stop } if - % stack has - 0 () /SubFileDecode filter - exch 2 copy readhexstring pop pop pop closefile - } for - } if - - (ENDCHAR) getline - -% Save the character data. - chardata charname [swx swy bbw bbh bbox bboy cbits] put - } for - - (ENDFONT) getline - -% Allocate the buffers for the bitmap and the outline, -% according to the font bounding box. - /fbbw fbbxe fbbxo sub def - /fbbh fbbye fbbyo sub def - /fraster fbbw 7 add 8 idiv def - /bits fraster fbbh mul 200 .max 65535 .min string def - /outline bits length 16 mul 65535 .min string def - -% Process the characters. - chardata - { exch /charname exch def aload pop - /cbits exch def - /bboy exch def /bbox exch def - /bbh exch def /bbw exch def - /swy exch def /swx exch def - -% The bitmap handed to type1imagepath must have the correct height, -% because type1imagepath uses this to compute the scale factor, -% so we have to clear the unused parts of it. - /raster bbw 7 add 8 idiv def - bits dup 0 1 raster fbbh mul 1 sub - { 0 put dup } for - pop pop - bits raster fbbh bbh sub mul cbits putinterval - -% Compute the font entry, converting the bitmap to an outline. - bits 0 raster fbbh mul getinterval % the bitmap image - bbw fbbh % bitmap width & height - swx swy % width x & y - bbox neg bboy neg % origin x & y - % Account for lenIV when converting the outline. - outline lenIV outline length lenIV sub getinterval - type1imagepath - length lenIV add - outline exch 0 exch getinterval - -% Check for a fixed width font. - isfixedwidth - { fixedwidth null eq - { /fixedwidth swx def } - { fixedwidth swx ne { /isfixedwidth false def } if } - ifelse - } if - -% Finish up the character. - copystring - charname exch charstrings 3 1 roll put - } forall - -% Add CharStrings entries for aliases. - aliases - { charstrings 2 index known not charstrings 2 index known and - { charstrings exch get charstrings 3 1 roll put - } - { pop pop - } - ifelse - } - forall - -% If this is not a fixed-width font, synthesize missing characters -% out of available ones. - isfixedwidth not - { false composites - { 1 index charstrings exch known not - 1 index { decoding exch known and } forall - { ( /) print 1 index bits cvs print - /combine exch def - 0 1 combine length 1 sub - { dup combine exch get decoding exch get - bits 3 1 roll put - } for - bits 0 combine length getinterval copystring - [ exch /compose_proc load aload pop ] cvx - charstrings 3 1 roll put - pop true - } - { pop pop } - ifelse - } - forall flush - { Private /composematrix matrix put - Private /compose /compose load put - } - if - } - if - -% Synthesize accented characters with seac if needed and possible. - accentedchars - { aload pop /accent exch def /base exch def - buffer cvs /accented exch def - charstrings accented known not - charstrings base known and - charstrings accent known and - StandardDecoding base known and - StandardDecoding accent known and - encoding StandardDecoding base get get base eq and - encoding StandardDecoding accent get get accent eq and - { ( /) print accented print - charstrings base get findsbw 0 exch getinterval - /acstring exch def % start with sbw of base - charstrings accent get parsesbw - 4 { pop } repeat % just leave sbx - acstring exch concatnum - 0 concatnum 0 concatnum % adx ady - decoding base get concatnum % bchar - decoding accent get concatnum % achar - s_seac concatstrings - charstrings exch accented copystring exch put - } if - } forall - -% Make a CharStrings entry for .notdef. - outline lenIV <8b8b0d0e> putinterval % 0 0 hsbw endchar - charstrings /.notdef outline 0 lenIV 4 add getinterval copystring put - -% Encrypt the CharStrings and Subrs (in place). - charstrings - { % Be careful not to encrypt aliased characters twice, - % since they share their CharString. - aliases 2 index known - { charstrings aliases 3 index get .knownget - { 1 index ne } - { true } - ifelse - } - { true - } - ifelse - 1 index type /stringtype eq and - { 4330 exch dup .type1encrypt exch pop - readonly charstrings 3 1 roll put - } - { pop pop - } - ifelse - } - forall - 0 1 subrcount 1 sub - { dup subrs exch get - 4330 exch dup .type1encrypt exch pop - subrs 3 1 roll put - } - for - -% Make most of the remaining entries in the font dictionaries. - -% The Type 1 font machinery really only works with a 1000 unit -% character coordinate system. Set this up here, by computing the factor -% to make the X entry in the FontMatrix come out at exactly 0.001. - /fontscale 1000 fbbh div yres mul xres div def - Font /FontBBox - [ fbbxo fontscale mul - fbbyo fontscale mul - fbbxe fontscale mul - fbbye fontscale mul - ] cvx readonly put - Font /CharStrings charstrings readonly put - FontInfo /FullName known not - { % Some programs insist on FullName being present. - FontInfo /FullName FontName dup length string cvs put - } - if - FontInfo /isFixedPitch isfixedwidth put - subrcount 0 gt - { Private /Subrs subrs 0 subrcount getinterval readonly put - } if - -% Determine the italic angle and underline position -% by actually installing the font. - save - /_temp_ Font definefont setfont - [1000 0 0 1000 0 0] setmatrix % mitigate rounding problems -% The italic angle is the multiple of -5 degrees -% that minimizes the width of the 'I'. - 0 9999 0 5 85 - { dup rotate - newpath 0 0 moveto (I) false charpath - dup neg rotate - pathbbox pop exch pop exch sub - dup 3 index lt { 4 -2 roll } if - pop pop - } - for pop -% The underline position is halfway between the bottom of the 'A' -% and the bottom of the FontBBox. - newpath 0 0 moveto (A) false charpath - FontMatrix concat - pathbbox pop pop exch pop -% Put the values in FontInfo. - 3 -1 roll - restore - Font /FontBBox get 1 get add 2 div cvi - dup FontInfo /UnderlinePosition 3 -1 roll put - 2 div abs FontInfo /UnderlineThickness 3 -1 roll put - FontInfo /ItalicAngle 3 -1 roll put - -% Clean up and finish. - grestore - bdfile closefile - Font currentdict end end begin % remove font from dict stack - (\n) print flush - - } bind def - -% ------ Reader for AFM files ------ % - -% Dictionary for looking up character keywords - /cmdict 6 dict dup begin - /C { /c iarg def } def - /N { /n warg copystring def } def - /WX { /w narg def } def - /W0X /WX load def - /W /WX load def - /W0 /WX load def - end def - - /readAFM % fontdict afmfilename readAFM -> fontdict - { (r) file /bdfile exch def - /Font exch def - /commentword (Comment) def - -% Check for the StartFontMetrics. - (StartFontMetrics) getline - args cvr 2.0 lt { (Not version 2.0 or greater\n) print stop } if - -% Look for StartCharMetrics, then parse the character metrics. -% The only information we care about is the X width. - /metrics 0 dict def - { nextline - keyword (EndFontMetrics) eq { exit } if - keyword (StartCharMetrics) eq - { iarg dup dict /metrics exch def - { /c -1 def /n null def /w null def - nextline buffer - { token not { exit } if - dup cmdict exch known - { exch /args exch def cmdict exch get exec args } - { pop } - ifelse - } loop - c 0 ge n null ne or w null ne and - { n null eq { /n Font /Encoding get c get def } if - metrics n w put - } - if - } - repeat - (EndCharMetrics) getline - } if - } loop - -% Insert the metrics in the font. - metrics length 0 ne - { Font /Metrics metrics readonly put - } if - Font - } bind def - -end % envBDF - -% Enter the main program in the current dictionary. -/bdfafmtops % infilename afmfilename* outfilename fontname - % encodingname uniqueID xuid - { envBDF begin - 7 -2 roll exch 7 2 roll % afm* in out fontname encodingname uniqueID xuid - readBDF % afm* font - exch { readAFM } forall - save exch - dup /FontName get exch definefont - setfont - psfile writefont - restore - psfile closefile - end - } bind def - -% If the program was invoked from the command line, run it now. -[ shellarguments - { counttomark 4 ge - { dup 0 get - dup 48 ge exch 57 le and % last arg starts with a digit? - { /StandardEncoding } % no encodingname - { cvn } % have encodingname - ifelse - exch (.) search % next-to-last arg has . in it? - { mark 4 1 roll % have xuid - { cvi exch pop exch (.) search not { exit } if } - loop cvi ] - 3 -1 roll cvi exch - } - { cvi null % no xuid - } - ifelse - counttomark 5 roll - counttomark 6 sub array astore - 7 -2 roll cvn 7 -3 roll % make sure fontname is a name - bdfafmtops - } - { cleartomark - (Usage:\n bdftops xx.bdf [yy1.afm ...] zz.gsf fontname uniqueID [xuid] [encodingname]\n) print flush - mark - } - ifelse - } -if pop diff --git a/Master/tlpkg/tlgs/lib/caption.ps b/Master/tlpkg/tlgs/lib/caption.ps index 6f0a7d31000..6f08ab7b328 100644 --- a/Master/tlpkg/tlgs/lib/caption.ps +++ b/Master/tlpkg/tlgs/lib/caption.ps @@ -1,20 +1,20 @@ %! % Copyright (C) 1995 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: caption.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Add a "caption" to the bottom of each page. /captionsize 20 def /caption @@ -31,13 +31,13 @@ gsave initgraphics clippath pathbbox pop exch 36 add /by exch def - % We can't use stringwidth, so we have to show and measure. + % We can't use stringwidth, so we have to show and measure. gsave 0 0 0 0 rectclip 0 0 moveto caption currentpoint pop /bw exch def grestore add bw sub 2 div /bx exch def - % We don't have the font bbox available, so we guess. + % We don't have the font bbox available, so we guess. /bh captionsize 1.05 mul def grestore /showcaption diff --git a/Master/tlpkg/tlgs/lib/cat.ps b/Master/tlpkg/tlgs/lib/cat.ps index 973d7fd34a7..bed048f0013 100644 --- a/Master/tlpkg/tlgs/lib/cat.ps +++ b/Master/tlpkg/tlgs/lib/cat.ps @@ -1,74 +1,74 @@ -% Copyright (C) 1996-2003 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. -% -% For more information about licensing, please refer to -% http://www.ghostscript.com/licensing/. For information on -% commercial licensing, go to http://www.artifex.com/licensing/ or -% contact Artifex Software, Inc., 101 Lucas Valley Road #110, -% San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% -% $Id: cat.ps 8331 2008-02-05 11:07:00Z kens $ -% -% Appends one file to another. Primarily used to overcome the -% 'copy' limitation of Windows command shell for ps2epsi -% -% the files to be appended are given by the environament -% variables %infile% and %outfile%. %infile% is appended to -% %outfile% -% - -/datastring 1024 string def - -{ - (outfile) getenv - { - /outfilename exch def - (infile) getenv - { - /infilename exch def - - infilename status - { - pop pop pop pop outfilename status - { - pop pop pop pop - infilename (r) file /infile exch def - outfilename (a+) file /outfile exch def - { - infile datastring readstring - { - outfile exch writestring - } - { - dup length 0 gt - {outfile exch writestring} {pop} ifelse - exit - } ifelse - } loop - infile closefile - outfile closefile - } - { - (Failed to find file ) print outfilename == - } ifelse - } - { - (Failed to find file ) print infilename == - } ifelse - } - { - (Couldn't find %infile% environment variable) == - } ifelse - } - { - (Couldn't find %outfile% environment variable) == - } - ifelse -} bind -exec +% Copyright (C) 1996-2003 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. +% +% For more information about licensing, please refer to +% http://www.ghostscript.com/licensing/. For information on +% commercial licensing, go to http://www.artifex.com/licensing/ or +% contact Artifex Software, Inc., 101 Lucas Valley Road #110, +% San Rafael, CA 94903, U.S.A., +1(415)492-9861. +% +% $Id: cat.ps 8331 2008-02-05 11:07:00Z kens $ +% +% Appends one file to another. Primarily used to overcome the +% 'copy' limitation of Windows command shell for ps2epsi +% +% the files to be appended are given by the environament +% variables %infile% and %outfile%. %infile% is appended to +% %outfile% +% + +/datastring 1024 string def + +{ + (outfile) getenv + { + /outfilename exch def + (infile) getenv + { + /infilename exch def + + infilename status + { + pop pop pop pop outfilename status + { + pop pop pop pop + infilename (r) file /infile exch def + outfilename (a+) file /outfile exch def + { + infile datastring readstring + { + outfile exch writestring + } + { + dup length 0 gt + {outfile exch writestring} {pop} ifelse + exit + } ifelse + } loop + infile closefile + outfile closefile + } + { + (Failed to find file ) print outfilename == + } ifelse + } + { + (Failed to find file ) print infilename == + } ifelse + } + { + (Couldn't find %infile% environment variable) == + } ifelse + } + { + (Couldn't find %outfile% environment variable) == + } + ifelse +} bind +exec diff --git a/Master/tlpkg/tlgs/lib/cid2code.ps b/Master/tlpkg/tlgs/lib/cid2code.ps index af7ff22774f..7d26ccf5566 100644 --- a/Master/tlpkg/tlgs/lib/cid2code.ps +++ b/Master/tlpkg/tlgs/lib/cid2code.ps @@ -1,19 +1,19 @@ % Copyright (C) 1998, 2000 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: cid2code.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Construct an inverse map from CIDs to codes. % Create an inverse map from CIDs to code values. @@ -30,33 +30,33 @@ mark } def /endcmap { - % Stack: mark code_lo1 code_hi1 cid1 ... + % Stack: mark code_lo1 code_hi1 cid1 ... 20 dict begin /depth counttomark 3 sub def - % Do a first pass to determine the maximum CID. + % Do a first pass to determine the maximum CID. 0 0 3 depth { 1 add /d exch def d index d 2 add index 1 get add d 3 add index 1 get sub .max } for 1 add /ncid exch def /map ncid 2 mul string def - % Now fill in the map. + % Now fill in the map. 0 3 depth { /d exch def d index 2 mul /cid2 exch def d 1 add index /hi exch def d 2 add index 2 string copy /lo exch def lo 1 get 1 hi 1 get { - map cid2 lo 0 get put - map cid2 1 add 3 -1 roll put - /cid2 cid2 2 add def + map cid2 lo 0 get put + map cid2 1 add 3 -1 roll put + /cid2 cid2 2 add def } for } for - % Print the map. + % Print the map. (%stdout) (w) file dup (<) print dup /ASCIIHexEncode filter - dup map writestring + dup map writestring closefile () = flush closefile @@ -105,18 +105,18 @@ currentdict end readonly def (r) file /f exch def (%!) = (/CIDInit /ProcSet findresource begin 12 dict begin begincmap) = - % Print the information from the template. + % Print the information from the template. { exch ==only ( ) print dup type /dicttype eq { dup length =only ( dict dup begin) = { - ( ) print exch ===only ( ) print ===only ( def) = + ( ) print exch ===only ( ) print ===only ( def) = } forall (end def) = } { ===only } ifelse ( def) = } forall - % Read the data from the cid2code.txt file. + % Read the data from the cid2code.txt file. { f =string readline pop (CID\t) anchorsearch { pop pop exit } if pop } loop @@ -129,7 +129,7 @@ currentdict end readonly def dup (*) eq { pop (0000) } if (16#) exch concatstrings cvi } loop ] def - % Print the code space range(s). + % Print the code space range(s). /maxcid map length 1 sub def mark maxcid dup 255 and 255 eq { @@ -140,7 +140,7 @@ currentdict end readonly def counttomark 2 idiv dup =only ( begincodespacerange) = { exch .printhex2 .printhex2 () = } repeat (endcodespacerange) = - % Print the map data. + % Print the map data. 0 1 100 maxcid { /lo exch def /hi lo 99 add maxcid .min def @@ -149,11 +149,11 @@ currentdict end readonly def pop } { =only ( begincidchar) = lo 1 hi { - map 1 index get dup 0 eq { pop pop } { exch .printhex2 = } ifelse + map 1 index get dup 0 eq { pop pop } { exch .printhex2 = } ifelse } for (endcidchar) = } ifelse } for - % Wrap up. + % Wrap up. (endcmap CMapName currentdict /CMap defineresource pop end end) = f closefile end diff --git a/Master/tlpkg/tlgs/lib/cidfmap b/Master/tlpkg/tlgs/lib/cidfmap new file mode 100644 index 00000000000..620afee3292 --- /dev/null +++ b/Master/tlpkg/tlgs/lib/cidfmap @@ -0,0 +1,63 @@ +%! +% cidfmap generated automatically by mkcidfm.ps from fonts found in +% C:/Windows/Fonts + +% Substitutions +/Batang << /SubfontID 0 /CSI [(Korea1) 3] /Path (C:/Windows/Fonts/batang.ttc) /FileType /TrueType >> ; +/SimHei << /SubfontID 0 /CSI [(GB1) 2] /Path (C:/Windows/Fonts/simhei.ttf) /FileType /TrueType >> ; +/GulimChe << /SubfontID 1 /CSI [(Korea1) 3] /Path (C:/Windows/Fonts/gulim.ttc) /FileType /TrueType >> ; +/ArialUnicodeMS-CNS << /SubfontID 0 /CSI [(CNS1) 2] /Path (C:/Windows/Fonts/arialuni.ttf) /FileType /TrueType >> ; +/Gulim << /SubfontID 0 /CSI [(Korea1) 3] /Path (C:/Windows/Fonts/gulim.ttc) /FileType /TrueType >> ; +/MalgunGothicRegular << /SubfontID 0 /CSI [(Korea1) 3] /Path (C:/Windows/Fonts/malgun.ttf) /FileType /TrueType >> ; +/MS-Mincho << /SubfontID 0 /CSI [(Japan1) 3] /Path (C:/Windows/Fonts/msmincho.ttc) /FileType /TrueType >> ; +/Gungsuh << /SubfontID 2 /CSI [(Korea1) 3] /Path (C:/Windows/Fonts/batang.ttc) /FileType /TrueType >> ; +/MalgunGothicBold << /SubfontID 0 /CSI [(Korea1) 3] /Path (C:/Windows/Fonts/malgunbd.ttf) /FileType /TrueType >> ; +/Meiryo-Italic << /SubfontID 1 /CSI [(Japan1) 3] /Path (C:/Windows/Fonts/meiryo.ttc) /FileType /TrueType >> ; +/MS-PGothic << /SubfontID 1 /CSI [(Japan1) 3] /Path (C:/Windows/Fonts/msgothic.ttc) /FileType /TrueType >> ; +/NSimSun << /SubfontID 1 /CSI [(GB1) 2] /Path (C:/Windows/Fonts/simsun.ttc) /FileType /TrueType >> ; +/Meiryo << /SubfontID 0 /CSI [(Japan1) 3] /Path (C:/Windows/Fonts/meiryo.ttc) /FileType /TrueType >> ; +/MS-Gothic << /SubfontID 0 /CSI [(Japan1) 3] /Path (C:/Windows/Fonts/msgothic.ttc) /FileType /TrueType >> ; +/MicrosoftYaHei << /SubfontID 0 /CSI [(GB1) 2] /Path (C:/Windows/Fonts/msyh.ttf) /FileType /TrueType >> ; +/FangSong << /SubfontID 0 /CSI [(GB1) 2] /Path (C:/Windows/Fonts/simfang.ttf) /FileType /TrueType >> ; +/Meiryo-Bold << /SubfontID 0 /CSI [(Japan1) 3] /Path (C:/Windows/Fonts/meiryob.ttc) /FileType /TrueType >> ; +/SimSun << /SubfontID 0 /CSI [(GB1) 2] /Path (C:/Windows/Fonts/simsun.ttc) /FileType /TrueType >> ; +/Dotum << /SubfontID 2 /CSI [(Korea1) 3] /Path (C:/Windows/Fonts/gulim.ttc) /FileType /TrueType >> ; +/ArialUnicodeMS-KR << /SubfontID 0 /CSI [(Korea1) 3] /Path (C:/Windows/Fonts/arialuni.ttf) /FileType /TrueType >> ; +/DotumChe << /SubfontID 3 /CSI [(Korea1) 3] /Path (C:/Windows/Fonts/gulim.ttc) /FileType /TrueType >> ; +/KaiTi << /SubfontID 0 /CSI [(GB1) 2] /Path (C:/Windows/Fonts/simkai.ttf) /FileType /TrueType >> ; +/BatangChe << /SubfontID 1 /CSI [(Korea1) 3] /Path (C:/Windows/Fonts/batang.ttc) /FileType /TrueType >> ; +/MS-PMincho << /SubfontID 1 /CSI [(Japan1) 3] /Path (C:/Windows/Fonts/msmincho.ttc) /FileType /TrueType >> ; +/ArialUnicodeMS-GB << /SubfontID 0 /CSI [(GB1) 2] /Path (C:/Windows/Fonts/arialuni.ttf) /FileType /TrueType >> ; +/Meiryo-BoldItalic << /SubfontID 1 /CSI [(Japan1) 3] /Path (C:/Windows/Fonts/meiryob.ttc) /FileType /TrueType >> ; +/MicrosoftJhengHeiRegular << /SubfontID 0 /CSI [(CNS1) 2] /Path (C:/Windows/Fonts/msjh.ttf) /FileType /TrueType >> ; +/MicrosoftYaHeiBold << /SubfontID 0 /CSI [(GB1) 2] /Path (C:/Windows/Fonts/msyhbd.ttf) /FileType /TrueType >> ; +/MicrosoftJhengHeiBold << /SubfontID 0 /CSI [(CNS1) 2] /Path (C:/Windows/Fonts/msjhbd.ttf) /FileType /TrueType >> ; +/DFKaiShu-SB-Estd-BF << /SubfontID 0 /CSI [(CNS1) 2] /Path (C:/Windows/Fonts/kaiu.ttf) /FileType /TrueType >> ; +/ArialUnicodeMS-JP << /SubfontID 0 /CSI [(Japan1) 3] /Path (C:/Windows/Fonts/arialuni.ttf) /FileType /TrueType >> ; +/PMingLiU << /SubfontID 1 /CSI [(CNS1) 2] /Path (C:/Windows/Fonts/mingliu.ttc) /FileType /TrueType >> ; +/MingLiU << /SubfontID 0 /CSI [(CNS1) 2] /Path (C:/Windows/Fonts/mingliu.ttc) /FileType /TrueType >> ; +/GungsuhChe << /SubfontID 3 /CSI [(Korea1) 3] /Path (C:/Windows/Fonts/batang.ttc) /FileType /TrueType >> ; +/MS-UI-Gothic << /SubfontID 2 /CSI [(Japan1) 3] /Path (C:/Windows/Fonts/msgothic.ttc) /FileType /TrueType >> ; + +% Aliases +/Ryumin-Medium /MS-Mincho ; +/AdobeHeitiStd-Regular /MicrosoftYaHei ; +/HeiseiKakuGo-W5 /MS-Gothic ; +/AdobeMingStd-Light /MingLiU ; +/MKai-Medium /DFKaiShu-SB-Estd-BF ; +/MHei-Medium /MicrosoftJhengHeiRegular ; +/MSung-Light /MingLiU ; +/HYRGoThic-Medium /Gulim ; +/GothicBBB-Medium /MS-Gothic ; +/AdobeSongStd-Light /SimSun ; +/AdobeMyungjoStd-Medium /Batang ; +/HYSMyeongJo-Medium /Batang ; +/HYGoThic-Medium /Dotum ; +/STSong-Light /SimSun ; +/STKaiti-Regular /KaiTi ; +/KozMinPr6N-Regular /MS-Mincho ; +/STHeiti-Regular /MicrosoftYaHei ; +/STFangsong-Light /FangSong ; +/MSung-Medium /MingLiU ; +/Ryumin-Light /MS-Mincho ; +/HeiseiMin-W3 /MS-Mincho ; diff --git a/Master/tlpkg/tlgs/lib/decrypt.ps b/Master/tlpkg/tlgs/lib/decrypt.ps index 2108173ea9f..49356df4865 100644 --- a/Master/tlpkg/tlgs/lib/decrypt.ps +++ b/Master/tlpkg/tlgs/lib/decrypt.ps @@ -1,6 +1,6 @@ %! % Decrypt an eexec-encoded file. -% $Id: decrypt.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ (t.in) (r) file /in exch def (t.out) (w) file /out exch def diff --git a/Master/tlpkg/tlgs/lib/docie.ps b/Master/tlpkg/tlgs/lib/docie.ps index b74cd151ac2..1b5dc7d5875 100644 --- a/Master/tlpkg/tlgs/lib/docie.ps +++ b/Master/tlpkg/tlgs/lib/docie.ps @@ -1,19 +1,19 @@ % Copyright (C) 1995 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: docie.ps 8411 2007-11-28 18:39:59Z ray $ +% $Id$ % docie.ps % Emulate CIE algorithms in PostScript. @@ -49,19 +49,19 @@ } bind def /mmult3 % [ ... ] mmult3 - % + % { 4 -1 roll dup dup 6 -1 roll dup dup 8 -1 roll dup dup 10 -1 roll { 10 -1 roll mul } forall - % Stack: u1 v1 w1 u2 v2 w2 u3 v3 w3 + % Stack: u1 v1 w1 u2 v2 w2 u3 v3 w3 4 -1 roll add 6 -1 roll add - % Stack: u1 v1 u2 v2 u3 v3 w' + % Stack: u1 v1 u2 v2 u3 v3 w' 7 1 roll 3 -1 roll add 4 -1 roll add - % Stack: w' u1 u2 u3 v' + % Stack: w' u1 u2 u3 v' 5 1 roll add add 3 1 roll } bind def /minvert3 % [ ... ] minvert3 - % [ ... ] + % [ ... ] { 16 dict begin aload pop { I H G F E D C B A } { exch def } forall /coa E I mul F H mul sub def @@ -126,20 +126,20 @@ DOCIEDEBUG { (After MatrixABC Decode: ) print3 } if % ---------------- Rendering from XYZ ---------------- % /lookup3 % lookup3 - % + % { 3 -1 roll 3 index 0 get 1 sub mul 3 -1 roll 3 index 1 get 1 sub mul 3 -1 roll 3 index 2 get 1 sub mul - % Stack: rtable ia ib ic + % Stack: rtable ia ib ic DOCIEDEBUG { (RenderTable indices: ) print3 mark 5 1 roll } if 3 -1 roll round cvi 3 index 3 get exch get - % Stack: rtable ib ic string + % Stack: rtable ib ic string 3 -1 roll round cvi 3 index 2 get mul - % Stack: rtable ic string ib*nc + % Stack: rtable ic string ib*nc 3 -1 roll round cvi add 2 index 4 get mul - % Stack: rtable string index + % Stack: rtable string index 2 index 4 get getinterval - % Stack: rtable bytes + % Stack: rtable bytes DOCIEDEBUG { (RenderTable values: ) print (<) print (%stdout) (w) file 1 index writehexstring (>) = } if } bind def @@ -156,11 +156,11 @@ DOCIEDEBUG { (After MatrixPQR: ) print3 } if 6 index /BlackPoint .knownget not { bpdefault } if 4 { 4 -1 roll aload pop - % Stack: csdict crdict x y z pt pt pt px py pz + % Stack: csdict crdict x y z pt pt pt px py pz 3 copy 12 index /MatrixPQR .knownget { mmult3 } if 6 array astore } repeat - % Stack: csdict crdict x y z wps+ bps+ wpd+ bpd+ + % Stack: csdict crdict x y z wps+ bps+ wpd+ bpd+ 9 -1 roll pop % get rid of csdict 7 4 roll 7 index /TransformPQR get @@ -188,14 +188,14 @@ DOCIEDEBUG { (After EncodeABC Encode: ) print3 } if { % Stack: u v w ranges rtable 5 1 roll rescale3 DOCIEDEBUG { (Rescaled ABC: ) print3 } if - % Stack: rtable a b c + % Stack: rtable a b c lookup3 - % Stack: rtable bytes + % Stack: rtable bytes 0 1 3 index 4 get 1 sub { % Stack: values rtable bytes c - 2 copy get 255 div - % Stack: values rtable bytes c v - 3 index 3 -1 roll 5 add get exec 3 1 roll + 2 copy get 255 div + % Stack: values rtable bytes c v + 3 index 3 -1 roll 5 add get exec 3 1 roll } for pop pop DOCIEDEBUG { (After RenderTableT: ) print ] dup == aload pop } if @@ -215,6 +215,6 @@ DOCIEDEBUG { (After RangeABC Encode: ) print3 } if /DeviceRGB { pop /DefaultRGB /ColorSpace findresource 1 get 4 1 roll cscieabc currentcolorrendering 4 1 roll crmap } bind .dicttomark def /mapcie % mapcie ... - % mapcie ... + % mapcie ... { currentcolorspace dup 0 get //mapdict exch get exec } bind def diff --git a/Master/tlpkg/tlgs/lib/dumphint.ps b/Master/tlpkg/tlgs/lib/dumphint.ps index 80e92eb1dba..444692a0c83 100644 --- a/Master/tlpkg/tlgs/lib/dumphint.ps +++ b/Master/tlpkg/tlgs/lib/dumphint.ps @@ -1,19 +1,19 @@ % Copyright (C) 2000, 2001 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: dumphint.ps 8284 2007-10-10 17:40:38Z giles $ +% $Id$ % Linearized PDF hint formatting utility. % @@ -29,7 +29,7 @@ % All array entries start from the new byte boundary. % -/table_width 79 def +/table_width 79 def /col1_width 66 def % Skip bits to the next byte boundary @@ -49,13 +49,13 @@ /bitread { % bitwrite exch begin 0 % bit val - { + { 1 index N .min % bit val m - dup 3 1 roll % bit m val m + dup 3 1 roll % bit m val m bitshift % bit m val<>(N-m) - 3 -1 roll % m val' bit + 3 -1 roll % m val' bit 2 index sub % m val' bit' 3 -1 roll % val' bit' m N exch sub dup % val' bit' N' N' @@ -97,7 +97,7 @@ getinterval % (s) (v) } { dup % (s) (s) - } ifelse + } ifelse (\n) search { 4 1 roll % (pre) (s) (post) (match) pop pop % (pre) (s) @@ -121,9 +121,9 @@ exch print % () n len exch =string cvs % () len (n) dup length % () len (n) len2 - 3 -1 roll add % () (n) len+len2 + 3 -1 roll add % () (n) len+len2 //table_width % () (n) len+len2 78 - exch sub % () (n) 78-len+len2 + exch sub % () (n) 78-len+len2 ( ) multiprint % () (n) = % () { dup length 0 eq { exit } if @@ -196,7 +196,7 @@ % Analyze the page offset hint table. /dump_page_offset_table { % - dump_page_offset_table - hint_stream - + dup 32 bitread dup /hint_minnop exch def (1. The least number of objects in a page.) two_column @@ -219,7 +219,7 @@ dup 32 bitread dup /hint_minsco exch def - (6. Least start of Contents offset. ) + (6. Least start of Contents offset. ) 1 index 0 ne { (\n*** Acrobat expects 0 ***) concatstrings } if two_column @@ -251,7 +251,7 @@ dup /hint_denf exch def (13. Denominator of fraction.) two_column - pop + pop LinearizationParams /N get @@ -353,9 +353,9 @@ } bind def % Analyze tha shared object hint table -/dump_shared_object_table { +/dump_shared_object_table { hint_stream - + dup 32 bitread dup /shint_1st_obj_id exch def (1. Object number of the first object in the shared objects section) two_column @@ -399,7 +399,7 @@ (2. MD5 signature flag) array_header hint_stream bytealign /shint_md5_flags - [ shint_all_shared + [ shint_all_shared { hint_stream 1 bitread } repeat ] readonly def @@ -407,7 +407,7 @@ shint_md5_flags dump_array (3. MD5 signature string) array_header - false shint_md5_flags { 0 ne or } forall { + false shint_md5_flags { 0 ne or } forall { shint_md5_flags { 0 eq { (<>)= @@ -419,7 +419,7 @@ } { pop (Error reading nd5 string.) == } ifelse } ifelse - } forall + } forall } { () = (none) = } ifelse @@ -526,8 +526,8 @@ } bind def % Analyze the generic hint table. -% The hint field names are re-used. -/dump_generic_table { +% The hint field names are re-used. +/dump_generic_table { hint_stream dup 32 bitread @@ -578,7 +578,7 @@ dup /ihint_shared_obj_bits exch def (6. Bits for the max shared object id used by the interactive form or the logical structure hierarchy.) 1 index hint_sobits ne { - (\n*** This fiels is not equal to max shared object ID bits ***) concatstrings + (\n*** This fiels is not equal to max shared object ID bits ***) concatstrings } if pop @@ -612,7 +612,7 @@ (T, Thumbnail hint table) table_header hint_stream exch set_align dump_thumbnail_table - } if + } if dup /O .knownget { (O, Outline hint table) table_header @@ -621,7 +621,7 @@ } if dup /A .knownget { - (A, Thread information hint table) table_header + (A, Thread information hint table) table_header hint_stream exch set_align dump_generic_table } if @@ -659,11 +659,10 @@ pop } bind def - % Load PDF file and extract the hint stream. /pdf_dump_hints { % pdf_dump_hints - dup (r) file % fname - false exch % fname F file + false exch % fname F file { dup 7 string readstring pop % fname F file () (%PDF-1.) ne { pop exit } if % fname F file @@ -696,10 +695,10 @@ LinearizationParams /H get dup length 2 eq { 0 get PDFoffset add PDFfile exch setfileposition - PDFfile token pop + PDFfile token pop PDFfile token pop resolveR dup true resolvestream - /ReusableStreamDecode filter + /ReusableStreamDecode filter bitstream dup bytealign /hint_stream exch def @@ -730,7 +729,7 @@ exch pop save exch 3000000 setvmthreshold - pdfoptdict begin + pdfoptdict begin pdf_dump_hints end restore diff --git a/Master/tlpkg/tlgs/lib/font2c.ps b/Master/tlpkg/tlgs/lib/font2c.ps index 0dcdaab3a9f..9624f414780 100644 --- a/Master/tlpkg/tlgs/lib/font2c.ps +++ b/Master/tlpkg/tlgs/lib/font2c.ps @@ -1,19 +1,19 @@ % Copyright (C) 1992, 1993, 1994, 1995, 1999 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: font2c.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % font2c.ps % Write out a PostScript Type 0 or Type 1 font as C code % that can be linked with the interpreter. @@ -53,9 +53,9 @@ { pop a_all } { % Check for executeonly or noaccess objects in protected. dup protected exch known - { protected exch get } - { pop a_readonly } - ifelse + { protected exch get } + { pop a_readonly } + ifelse } ifelse } bind def @@ -65,10 +65,10 @@ { 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 + exch /packedarraytype eq or + { getpa a_readonly and or } + { pop pop a_all exit } + ifelse } forall } bind def @@ -147,12 +147,12 @@ end /wca % 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 (,) + 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 @@ -180,12 +180,12 @@ end % Convert an object to a string to be scanned at a later time. /cvos % cvos { % 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 + % 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. @@ -195,10 +195,10 @@ end { 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 + dup type /stringtype ne { cvos (255,) ws } if + dup length 256 idiv wt (,) ws + dup length 256 mod wt + (,) (,\n) wca } ifelse } bind def @@ -268,11 +268,11 @@ end def /arraytype { woatt { aload pop 2 index 2 index exec - { exch pop exec exit } - { pop pop } - ifelse - } - forall + { exch pop exec exit } + { pop pop } + ifelse + } + forall } bind def /booleantype { { (\tmake_true\(&) } { (\tmake_false\(&) } ifelse ws @@ -285,12 +285,12 @@ end 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 + (\);) wl + (\tif ( code < 0 ) return code;) wl + true } bind def /packedarraytype - /arraytype load def + /arraytype load def /realtype { (\tmake_real\(&) ws exch wt (, (float)) ws wt (\);) wl true @@ -298,10 +298,10 @@ end 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 + (;) 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. @@ -325,70 +325,70 @@ end def } bind def /wnuma { % <_v> wnuma - ({\tstatic const ref_\() ws exch ws (\) a_[] = {) wl exch - % Stack: name type_v array + % Stack: name type_v array dup length 0 eq { - (\t) ws 1 index ws (\(0\)) wl + (\t) ws 1 index ws (\(0\)) wl } { - dup { - (\t) ws 2 index ws (\() ws wt (\),) wl - } forall + dup { + (\t) ws 2 index ws (\() ws wt (\),) wl + } forall } ifelse exch pop - % Stack: name array + % 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 + (\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 + (\tmake_const_array\(&) ws exch wt + (, avm_foreign|) ws dup wpa (, ) ws length wt + (, (const ref *)a_\);) wl } ifelse (}) wl } bind def /woatt [ - % Integers + % Integers { { { type /integertype eq } isall } { (long) (integer_v) wnuma true } } - % Integers + reals + % Integers + reals { { { type dup /integertype eq exch /realtype eq or } isall } { (float) (real_v) wnuma true } } - % Strings + nulls + % 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 + (\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 + % 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 + (\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 + % Procedure { { iswproc } { dup cvos - % Stack: name proc string - ({\tstatic const unsigned char s_[] = ) ws + % 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 + (;) 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 + % Default { { pop true } { wother } } @@ -403,10 +403,10 @@ end def { counttomark 2 sub wtstring cvs (v_[) exch concatstrings (]) concatstrings exch wo not { (Skipping ) print ==only (....\n) print } - if + if } forall ] - % Stack: array of keys (names) + % 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 @@ -424,13 +424,13 @@ end def % Writes code to declare and initialize enc_keys_, str_keys, and keys_. /wcdkeys % wcdkeys - { % Write keys present in StandardEncoding or ISOLatin1Encoding, - % pushing other keys on the o-stack. + % 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 + (,) ws 255 and wt (}, ) ws + 1 add dup 5 mod 0 eq { (\n) ws } if } { exch } ifelse @@ -438,9 +438,9 @@ end def forall pop ] ({0,0}\n};) wl - % Write other keys. + % Write other keys. (str_keys_) exch wsna - % Write the declaration for keys_. + % 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 @@ -499,9 +499,9 @@ end def (\t0\n};) wl (static const unsigned char lengths_[] = {) wl { (\t) ws dup isnumber - { pop 0 } - { length 1 add } - ifelse wt (,) wl + { pop 0 } + { length 1 add } + ifelse wt (,) wl } cdforall (\t0\n};) wl (\tcode = \(*pprocs->num_dict_create\)\(i_ctx_p, &) ws wt @@ -639,7 +639,7 @@ readonly def { % Stack: string index 2 copy 2 copy get //makefontprocnamemap exch get put pop } - for + for } def /writefont { font2cdict begin writefont end } def @@ -649,11 +649,11 @@ readonly def { 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. + % 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 + currentglobal not setglobal + dup undefinefont } repeat findfont setfont (FontName is ) print currentfont /FontName get ==only (.\n) print flush diff --git a/Master/tlpkg/tlgs/lib/font2pcl.ps b/Master/tlpkg/tlgs/lib/font2pcl.ps index e5ee4e35a8a..3cf04771a57 100644 --- a/Master/tlpkg/tlgs/lib/font2pcl.ps +++ b/Master/tlpkg/tlgs/lib/font2pcl.ps @@ -1,19 +1,19 @@ % Copyright (C) 1993, 1994, 1995, 1997 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: font2pcl.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % font2pcl.ps % Write out a font as a PCL bitmap font. @@ -23,10 +23,10 @@ % The current transformation matrix defines the font size and orientation. /WriteResolution? false def % true=use "resolution bound font" format, - % false=use older format + % false=use older format /LJ4 false def % true=use LJ4 Typeface code - % false=use LJIIP/IID/IIIx Typeface code + % false=use LJIIP/IID/IIIx Typeface code pcldict begin % internal procedures @@ -34,8 +34,8 @@ pcldict begin % internal procedures { 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. + % Determine which set of keywords is present in a string. + % The last keyword set must be empty. /keysearch % keysearch { 0 1 2 index length 1 sub @@ -52,7 +52,7 @@ pcldict begin % internal procedures exch pop length % invalid index if missing } def - % Determine the device height of a string in quarter-dots. + % Determine the device height of a string in quarter-dots. /charheight % charheight { gsave newpath 0 0 moveto false charpath @@ -60,7 +60,7 @@ pcldict begin % internal procedures dtransform add abs 4 mul cvi } def - % Compute an integer version of the transformed FontBBox. + % Compute an integer version of the transformed FontBBox. /inflate % inflate { dup 0 gt { ceiling } { floor } ifelse @@ -71,12 +71,12 @@ pcldict begin % internal procedures 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. + % 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 @@ -84,21 +84,20 @@ pcldict begin % internal procedures { % Stack: origfont namedfont 1 index /FontType get 1 index /FontType get eq { 1 index /UniqueID .knownget - { 1 index /UniqueID .knownget - { eq { exch } if } - { pop } + { 1 index /UniqueID .knownget + { eq { exch } if } + { pop } ifelse - } - if + } + if } if pop } if } def - - % Determine the bounding box of the current device's image. - % Free variables: row, zerow. + % Determine the bounding box of the current device's image. + % Free variables: row, zerow. /devbbox % devbbox { % Find top and bottom whitespace. @@ -116,21 +115,21 @@ pcldict begin % internal procedures } loop % ymin exch - % Find left and right whitespace. + % Find left and right whitespace. 3 index 0 - % Stack: rw rh ymin ymax1 xmin xmax1 + % 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 + % Special check: xmin > xmax1 if height = 0 2 copy gt { exch pop dup } if 6 -2 roll pop pop } def - % Write values on outfile. + % Write values on outfile. /w1 { 255 and outfile exch write } def /w2 { dup -8 bitshift w1 w1 } def @@ -211,7 +210,6 @@ pcldict begin % internal procedures 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 @@ -240,7 +238,7 @@ currentdict readonly end pop % pcldict orientation (Orientation) wbyte FontInfo /isFixedPitch .knownget not { false } if { 0 } { 1 } ifelse (Spacing) wbyte - % Use loop/exit to fake a multiple-exit block. + % 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 @@ -264,7 +262,7 @@ currentdict readonly end pop % pcldict 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 + dup vendor.initials exch get 0 eq { pop vendor.default.index } if } if /vendor.index exch def @@ -326,7 +324,7 @@ currentdict readonly end pop % pcldict /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. + % 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 @@ -336,7 +334,7 @@ currentdict readonly end pop % pcldict { FontName dup length string cvs } if def - % Determine the original font, and its relationship to this one. + % Determine the original font, and its relationship to this one. /OrigFont currentfont origfont def /OrigMatrix OrigFont /FontMatrix get def @@ -356,7 +354,7 @@ currentdict readonly end pop % pcldict def /negY flipY { {neg} } { {} } ifelse def - % Print debugging information. + % Print debugging information. /CDEBUG where { pop } { /CDEBUG false def } ifelse /VDEBUG where { pop } { /VDEBUG false def } ifelse @@ -374,13 +372,13 @@ currentdict readonly end pop % pcldict } if currentfont /ScaleMatrix .knownget { (ScaleMatrix: ) print == } if gsave - FontMatrix concat - (combined matrix: ) print matrix currentmatrix == + FontMatrix concat + (combined matrix: ) print matrix currentmatrix == grestore flush } if - % Determine the orientation. + % Determine the orientation. ScaleMatrix matrix currentmatrix dup concatmatrix 0 1 3 @@ -408,8 +406,8 @@ currentdict readonly end pop % pcldict } if pop - % Determine the font metrics, in the PCL character coordinate system, - % which has +Y going towards the top of the page. + % Determine the font metrics, in the PCL character coordinate system, + % which has +Y going towards the top of the page. gsave FontMatrix concat @@ -433,7 +431,7 @@ currentdict readonly end pop % pcldict /uw uurx ullx sub def /uh uury ully sub def grestore - DEBUG + DEBUG { (rmatrix: ) print matrix currentmatrix == (rFontBBox: ) print [rllx rlly rurx rury] == (uFontBBox: ) print [ullx ully uurx uury] == @@ -441,29 +439,29 @@ currentdict readonly end pop % pcldict } if grestore - % Disable the character cache, to avoid excessive allocation - % and memory sandbars. + % Disable the character cache, to avoid excessive allocation + % and memory sandbars. mark cachestatus /upper exch def cleartomark 0 setcachelimit - - % Write the font header. + + % Write the font header. writefontheader - % Establish an image device for rasterizing characters. + % 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. + % 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 makeimagedevice /cdevice exch def nulldevice % prevent page device switching cdevice setdevice - % Rasterize each character in turn. + % Rasterize each character in turn. /raster rw 7 add 8 idiv def /row raster string def @@ -473,88 +471,88 @@ currentdict readonly end pop % pcldict 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 + 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 + /cwidth 0 def + /cfpos 0 def } ifelse } for - % Wrap up. + % Wrap up. upper setcachelimit outfile closefile diff --git a/Master/tlpkg/tlgs/lib/gs_ce_e.ps b/Master/tlpkg/tlgs/lib/gs_ce_e.ps index c7eb51174e5..04b573f8199 100644 --- a/Master/tlpkg/tlgs/lib/gs_ce_e.ps +++ b/Master/tlpkg/tlgs/lib/gs_ce_e.ps @@ -1,19 +1,19 @@ % Copyright (C) 1999 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: gs_ce_e.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Define the Adobe CE (Central European) encoding vector. % We define it by differences from the ISOLatin1Encoding vector. /CEEncoding diff --git a/Master/tlpkg/tlgs/lib/gs_cmdl.ps b/Master/tlpkg/tlgs/lib/gs_cmdl.ps index 0b675b74862..848b5c73a3e 100644 --- a/Master/tlpkg/tlgs/lib/gs_cmdl.ps +++ b/Master/tlpkg/tlgs/lib/gs_cmdl.ps @@ -1,19 +1,19 @@ % Copyright (C) 1994, 1996, 1999 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: gs_cmdl.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Parse and execute the command line. % C code handles the following switches: -h/-? -I -M -v @@ -24,7 +24,7 @@ cmddict begin % Get the next argument from the parsed argument list. /nextarg % - nextarg true - % - nextarg false + % - nextarg false { argv length 0 eq { false } { argv dup 0 get exch dup length 1 sub 1 exch getinterval /argv exch def } @@ -51,12 +51,12 @@ cmddict begin { pop /expand@ false def } { expand@ { (@) anchorsearch } { false } ifelse - { pop findlibfile - { exch pop } - { (r) file } % let the error happen - expandargfile - } - if + { pop findlibfile + { exch pop } + { (r) file } % let the error happen + expandargfile + } + if } ifelse } @@ -91,7 +91,7 @@ cmddict begin argv 0 get (-) anchorsearch { pop pop exit } if pop nextarg token { exch pop % Probably should check for empty. - end exec //cmddict begin + end exec //cmddict begin } if } @@ -146,29 +146,29 @@ cmddict begin { //cmddict begin /expand@ true def [ - % Process the GS_OPTIONS environment variable. + % Process the GS_OPTIONS environment variable. (GS_OPTIONS) getenv { 0 () /SubFileDecode filter expandargfile } if - % Process the actual command line. + % Process the actual command line. .getargv { expandarg } forall ] readonly /argv exch def - % Now interpret the commands. + % Now interpret the commands. { nextarg not { exit } if dup 0 get (-) 0 get eq { dup length 1 eq - { pop (%stdin) (r) file runjob - } - { dup length 2 gt - { dup dup length 2 sub 2 exch getinterval exch 1 1 getinterval } - if currentdict .knownget - { exec - } - { (Ignoring unknown switch ) print - dup length 1 eq { (-) print print } if print - () = flush - } - ifelse - } - ifelse + { pop (%stdin) (r) file runjob + } + { dup length 2 gt + { dup dup length 2 sub 2 exch getinterval exch 1 1 getinterval } + if currentdict .knownget + { exec + } + { (Ignoring unknown switch ) print + dup length 1 eq { (-) print print } if print + () = flush + } + ifelse + } + ifelse } { runfilejob } diff --git a/Master/tlpkg/tlgs/lib/gs_fform.ps b/Master/tlpkg/tlgs/lib/gs_fform.ps index ee2a870dee0..49aac44c5f2 100644 --- a/Master/tlpkg/tlgs/lib/gs_fform.ps +++ b/Master/tlpkg/tlgs/lib/gs_fform.ps @@ -1,19 +1,19 @@ % Copyright (C) 1995, 1996, 1998, 1999 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: gs_fform.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Form caching implemented in PostScript. % This implementation doesn't do the right thing about halftone or @@ -38,32 +38,32 @@ true setglobal /.execform1 { dup /Implementation known not { dup /FormType get 1 ne { /rangecheck signalerror } if - % The Implementation is a Pattern that will draw the form. + % The Implementation is a Pattern that will draw the form. currentglobal 1 index gcheck setglobal - % Stack: form global + % Stack: form global 10 dict begin /PatternType 1 def /PaintType 1 def % colored /TilingType 1 def % irrelevant - % Copy the BBox to the correct VM. + % Copy the BBox to the correct VM. /BBox 2 index /BBox get 4 array copy exch 1 index def - % Set XStep and YStep to very large numbers, - % so we won't get multiple copies of the form. + % Set XStep and YStep to very large numbers, + % so we won't get multiple copies of the form. /XStep 1 index dup 2 get exch 0 get sub 100 mul def /YStep exch dup 3 get exch 1 get sub 100 mul def /PaintProc 2 index /PaintProc get def currentdict end readonly - % Stack: form global impl + % Stack: form global impl exch setglobal 1 index /Implementation 3 -1 roll .forceput } if .formcachedict 1 index .knownget { - % Check whether we can use the cached value. - % Stack: form cachevalue + % Check whether we can use the cached value. + % Stack: form cachevalue matrix currentmatrix true 0 1 3 { - % Stack: form cachevalue curmat true index + % Stack: form cachevalue curmat true index 3 index 0 get 1 index get exch 3 index exch get ne { - pop pop false exit + pop pop false exit } if } for exch pop } { @@ -72,14 +72,14 @@ true setglobal { % Make a new cache entry. gsave matrix currentmatrix dup 4 0 put dup 5 0 put dup setmatrix - % Stack: form mat + % Stack: form mat 1 index /Implementation get 2 index /Matrix get makepattern 2 array astore .formcachedict 2 index 2 index put grestore } if - % Stack: form cachevalue + % Stack: form cachevalue -1 0 0 transform 2 { exch round cvi } repeat .setscreenphase 1 get setpattern diff --git a/Master/tlpkg/tlgs/lib/gs_il2_e.ps b/Master/tlpkg/tlgs/lib/gs_il2_e.ps index 3e44c3bd7c5..cbfb1d74d98 100644 --- a/Master/tlpkg/tlgs/lib/gs_il2_e.ps +++ b/Master/tlpkg/tlgs/lib/gs_il2_e.ps @@ -1,19 +1,19 @@ % Copyright (C) 1999 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: gs_il2_e.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Define the ISO Latin-2 (8859-2) encoding vector. % The original version of this encoding vector used Unicode names, rather diff --git a/Master/tlpkg/tlgs/lib/gs_kanji.ps b/Master/tlpkg/tlgs/lib/gs_kanji.ps index 6d1f9844742..5d025e614fc 100644 --- a/Master/tlpkg/tlgs/lib/gs_kanji.ps +++ b/Master/tlpkg/tlgs/lib/gs_kanji.ps @@ -1,19 +1,19 @@ % Copyright (C) 1994, 1995, 1996 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: gs_kanji.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Scaffolding for Kanji fonts. This is based on the Wadalab free font % from the University of Tokyo; it may not be appropriate for other % Kanji fonts. @@ -27,45 +27,45 @@ ifelse /KanjiEncoding % \x00 - 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 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 % \x20 - 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 + 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 - 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 + 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 % \x60 - 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 + 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 - 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 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 % \xA0 - 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 + 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 % \xC0 - 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 + 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 % \xE0 - 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 + 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 256 packedarray def % Define a stub for the base font encoding. @@ -127,7 +127,7 @@ FontName currentdict end definefont /newname1 exch def newname1 dup length string cvs /str exch def str length /len exch def -/fdepvector 78 array def +/fdepvector 78 array def /j 1 def 16#21 1 16#74 { /i exch def diff --git a/Master/tlpkg/tlgs/lib/gs_ksb_e.ps b/Master/tlpkg/tlgs/lib/gs_ksb_e.ps index 06617fe0431..15c02e18e64 100644 --- a/Master/tlpkg/tlgs/lib/gs_ksb_e.ps +++ b/Master/tlpkg/tlgs/lib/gs_ksb_e.ps @@ -1,19 +1,19 @@ % Copyright (C) 1994 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: gs_ksb_e.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Define the KanjiSub encoding vector. /currentglobal where { pop currentglobal { setglobal } true setglobal } diff --git a/Master/tlpkg/tlgs/lib/gs_lgo_e.ps b/Master/tlpkg/tlgs/lib/gs_lgo_e.ps index dea11774640..5b405a452bc 100644 --- a/Master/tlpkg/tlgs/lib/gs_lgo_e.ps +++ b/Master/tlpkg/tlgs/lib/gs_lgo_e.ps @@ -1,19 +1,19 @@ % Copyright (C) 1999, 2000 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: gs_lgo_e.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Define the Adobe "original" Latin glyph set. % This is not an Encoding strictly speaking, but we treat it like one. /currentglobal where diff --git a/Master/tlpkg/tlgs/lib/gs_lgx_e.ps b/Master/tlpkg/tlgs/lib/gs_lgx_e.ps index 16a8adc2287..7b2899914eb 100644 --- a/Master/tlpkg/tlgs/lib/gs_lgx_e.ps +++ b/Master/tlpkg/tlgs/lib/gs_lgx_e.ps @@ -1,19 +1,19 @@ % Copyright (C) 1999 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: gs_lgx_e.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Define the Adobe "extension" Latin glyph set. % This is not an Encoding strictly speaking, but we treat it like one. /currentglobal where diff --git a/Master/tlpkg/tlgs/lib/gs_pfile.ps b/Master/tlpkg/tlgs/lib/gs_pfile.ps index d56c6b47c14..264fa2beb5b 100644 --- a/Master/tlpkg/tlgs/lib/gs_pfile.ps +++ b/Master/tlpkg/tlgs/lib/gs_pfile.ps @@ -1,19 +1,19 @@ % Copyright (C) 1994, 1995 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: gs_pfile.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Runtime support for minimum-space fonts and packed files. % ****** NOTE: This file must be kept consistent with @@ -30,29 +30,29 @@ % the starting address and length of the outer compressed file, % and the starting address and length of the inner file. /.packedfilefilter % - % .packedfilefilter + % .packedfilefilter { 4 index systemdict begin token pop end 6 1 roll - % Stack: fproc file ostart olength istart ilength + % Stack: fproc file ostart olength istart ilength 4 index 5 -1 roll setfileposition - % Stack: fproc file olength istart ilength + % Stack: fproc file olength istart ilength 4 -2 roll () /SubFileDecode filter - % Stack: fproc istart ilength ofilter + % 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 + % 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 + % 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 + % Stack: ilength save dfilter exch restore exch () /SubFileDecode filter } bind def % Run a packed library file. /.runpackedlibfile % - % .runpackedlibfile + % .runpackedlibfile { 5 -1 roll findlibfile { exch pop dup 6 2 roll .packedfilefilter currentobjectformat exch 1 setobjectformat run @@ -69,18 +69,18 @@ % 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 + /PaintType 0 + /FontMatrix [0.001 0 0 0.001 0 0] readonly + /FontType 1 + /Encoding StandardEncoding .dicttomark readonly def /.checkexistingfont % - % .checkexistingfont - % {} ( on d-stack) - % - % .checkexistingfont - % -save- --restore-- ( on d-stack) + % .checkexistingfont + % {} ( on d-stack) + % + % .checkexistingfont + % -save- --restore-- ( on d-stack) { FontDirectory 4 index .knownget { dup /UniqueID .knownget { 4 index eq exch /FontType get 1 eq and } @@ -118,8 +118,8 @@ { 2 index exch get } { % Stack: encrypt dict dict key value - 4 index { 4330 exch dup .type1encrypt exch pop } if - readonly + 4 index { 4330 exch dup .type1encrypt exch pop } if + readonly } ifelse put dup } diff --git a/Master/tlpkg/tlgs/lib/gs_rdlin.ps b/Master/tlpkg/tlgs/lib/gs_rdlin.ps index a28f9a406ab..204d9f65d69 100644 --- a/Master/tlpkg/tlgs/lib/gs_rdlin.ps +++ b/Master/tlpkg/tlgs/lib/gs_rdlin.ps @@ -1,19 +1,19 @@ % Copyright (C) 1999 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: gs_rdlin.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Patch for systems with readline support in the interpreter. % Disable the prompt message, since readline will generate it. diff --git a/Master/tlpkg/tlgs/lib/gs_wl1_e.ps b/Master/tlpkg/tlgs/lib/gs_wl1_e.ps index f6dda7ae3ae..9e8c604942c 100644 --- a/Master/tlpkg/tlgs/lib/gs_wl1_e.ps +++ b/Master/tlpkg/tlgs/lib/gs_wl1_e.ps @@ -1,19 +1,19 @@ % Copyright (C) 1996 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: gs_wl1_e.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Define the Windows 3.1 Latin 1 encoding vector (H-P Symbol set 19U). /currentglobal where { pop currentglobal { setglobal } true setglobal } @@ -30,37 +30,37 @@ ISOLatin1Encoding 97 30 getinterval aload pop /graybox % \20x /.notdef /.notdef /quotesinglbase /florin - /quotedblbase /ellipsis /dagger /daggerdbl + /quotedblbase /ellipsis /dagger /daggerdbl /circumflex /perthousand /Scaron /guilsinglleft - /OE /.notdef /.notdef /.notdef + /OE /.notdef /.notdef /.notdef /.notdef /quoteleft /quoteright /quotedblleft - /quotedblright /bullet /endash /emdash + /quotedblright /bullet /endash /emdash /tilde /trademark /scaron /guilsinglright - /oe /.notdef /.notdef /Ydieresis + /oe /.notdef /.notdef /Ydieresis /.notdef /exclamdown /cent /sterling - /currency /yen /brokenbar /section + /currency /yen /brokenbar /section /dieresis /copyright /ordfeminine /guillemotleft - /logicalnot /softhyphen /registered /overscore + /logicalnot /softhyphen /registered /overscore /degree /plusminus /twosuperior /threesuperior - /acute /mu /paragraph /periodcentered + /acute /mu /paragraph /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright - /onequarter /onehalf /threequarters /questiondown + /onequarter /onehalf /threequarters /questiondown % \30x /Agrave /Aacute /Acircumflex /Atilde - /Adieresis /Aring /AE /Ccedilla + /Adieresis /Aring /AE /Ccedilla /Egrave /Eacute /Ecircumflex /Edieresis - /Igrave /Iacute /Icircumflex /Idieresis + /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde /Ograve /Oacute - /Ocircumflex /Otilde /Odieresis /multiply + /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute /Ucircumflex - /Udieresis /Yacute /Thorn /germandbls + /Udieresis /Yacute /Thorn /germandbls /agrave /aacute /acircumflex /atilde - /adieresis /aring /ae /ccedilla + /adieresis /aring /ae /ccedilla /egrave /eacute /ecircumflex /edieresis - /igrave /iacute /icircumflex /idieresis + /igrave /iacute /icircumflex /idieresis /eth /ntilde /ograve /oacute - /ocircumflex /otilde /odieresis /divide + /ocircumflex /otilde /odieresis /divide /oslash /ugrave /uacute /ucircumflex - /udieresis /yacute /thorn /ydieresis + /udieresis /yacute /thorn /ydieresis 256 packedarray .defineencoding exec diff --git a/Master/tlpkg/tlgs/lib/gs_wl2_e.ps b/Master/tlpkg/tlgs/lib/gs_wl2_e.ps index c5aa17cc34b..5cf476fd03b 100644 --- a/Master/tlpkg/tlgs/lib/gs_wl2_e.ps +++ b/Master/tlpkg/tlgs/lib/gs_wl2_e.ps @@ -1,19 +1,19 @@ % Copyright (C) 1996 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: gs_wl2_e.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Define the Windows 3.1 Latin 2 encoding vector (H-P Symbol set 9E). /currentglobal where { pop currentglobal { setglobal } true setglobal } @@ -30,37 +30,37 @@ ISOLatin1Encoding 97 30 getinterval aload pop /graybox % \20x /.notdef /.notdef /quotesinglbase /.notdef - /quotedblbase /ellipsis /dagger /daggerdbl + /quotedblbase /ellipsis /dagger /daggerdbl /.notdef /perthousand /Scaron /guilsinglleft - /Sacute /Tcaron /Zcaron /Zacute + /Sacute /Tcaron /Zcaron /Zacute /.notdef /quoteleft /quoteright /quotedblleft - /quotedblright /bullet /endash /emdash + /quotedblright /bullet /endash /emdash /.notdef /trademark /scaron /guilsinglright - /sacute /tcaron /zcaron /zacute + /sacute /tcaron /zcaron /zacute /.notdef /caron /breve /Lslash - /currency /Aogonek /brokenbar /section + /currency /Aogonek /brokenbar /section /dieresis /copyright /Scedilla /guillemotleft - /logicalnot /softhyphen /registered /Zdotaccent + /logicalnot /softhyphen /registered /Zdotaccent /degree /plusminus /ogonek /lslash - /acute /mu /paragraph /periodcentered + /acute /mu /paragraph /periodcentered /cedilla /aogonek /scedilla /guillemotright - /Lcaron /hungarumlaut /lcaron /zdotaccent + /Lcaron /hungarumlaut /lcaron /zdotaccent % \30x /Racute /Aacute /Acircumflex /Abreve - /Adieresis /Lacute /Cacute /Ccedilla + /Adieresis /Lacute /Cacute /Ccedilla /Ccaron /Eacute /Eogonek /Edieresis - /Ecaron /Iacute /Icircumflex /Dcaron + /Ecaron /Iacute /Icircumflex /Dcaron /Dcroat /Nacute /Ncaron /Oacute - /Ocircumflex /Ohungarumlaut /Odieresis /multiply + /Ocircumflex /Ohungarumlaut /Odieresis /multiply /Rcaron /Uring /Uacute /Uhungarumlaut - /Udieresis /Yacute /Tcommaaccent /germandbls + /Udieresis /Yacute /Tcommaaccent /germandbls /racute /aacute /acircumflex /abreve - /adieresis /lacute /cacute /ccedilla + /adieresis /lacute /cacute /ccedilla /ccaron /eacute /eogonek /edieresis - /ecaron /iacute /icircumflex /dcaron + /ecaron /iacute /icircumflex /dcaron /dcroat /nacute /ncaron /oacute - /ocircumflex /ohungarumlaut /odieresis /divide + /ocircumflex /ohungarumlaut /odieresis /divide /rcaron /uring /uacute /uhungarumlaut - /udieresis /yacute /tcommaaccent /dotaccent + /udieresis /yacute /tcommaaccent /dotaccent 256 packedarray .defineencoding exec diff --git a/Master/tlpkg/tlgs/lib/gs_wl5_e.ps b/Master/tlpkg/tlgs/lib/gs_wl5_e.ps index f68b9e6461a..d5daa6aa497 100644 --- a/Master/tlpkg/tlgs/lib/gs_wl5_e.ps +++ b/Master/tlpkg/tlgs/lib/gs_wl5_e.ps @@ -1,19 +1,19 @@ % Copyright (C) 1996 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: gs_wl5_e.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Define the Windows 3.1 Latin 5 encoding vector (H-P Symbol set 5T). /currentglobal where { pop currentglobal { setglobal } true setglobal } @@ -30,37 +30,37 @@ ISOLatin1Encoding 97 30 getinterval aload pop /graybox % \20x /.notdef /.notdef /quotesinglbase /florin - /quotedblbase /ellipsis /dagger /daggerdbl + /quotedblbase /ellipsis /dagger /daggerdbl /circumflex /perthousand /Scaron /guilsinglleft - /OE /.notdef /.notdef /.notdef + /OE /.notdef /.notdef /.notdef /.notdef /quoteleft /quoteright /quotedblleft - /quotedblright /bullet /endash /emdash + /quotedblright /bullet /endash /emdash /tilde /trademark /scaron /guilsinglright - /oe /.notdef /.notdef /Ydieresis + /oe /.notdef /.notdef /Ydieresis /.notdef /exclamdown /cent /sterling - /currency /yen /brokenbar /section + /currency /yen /brokenbar /section /dieresis /copyright /ordfeminine /guillemotleft - /logicalnot /softhyphen /registered /overscore + /logicalnot /softhyphen /registered /overscore /degree /plusminus /twosuperior /threesuperior - /acute /mu /paragraph /periodcentered + /acute /mu /paragraph /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright - /onequarter /onehalf /threequarters /questiondown + /onequarter /onehalf /threequarters /questiondown % \30x /Agrave /Aacute /Acircumflex /Atilde - /Adieresis /Aring /AE /Ccedilla + /Adieresis /Aring /AE /Ccedilla /Egrave /Eacute /Ecircumflex /Edieresis - /Igrave /Iacute /Icircumflex /Idieresis + /Igrave /Iacute /Icircumflex /Idieresis /Gbreve /Ntilde /Ograve /Oacute - /Ocircumflex /Otilde /Odieresis /multiply + /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute /Ucircumflex - /Udieresis /Idotaccent /Scedilla /germandbls + /Udieresis /Idotaccent /Scedilla /germandbls /agrave /aacute /acircumflex /atilde - /adieresis /aring /ae /ccedilla + /adieresis /aring /ae /ccedilla /egrave /eacute /ecircumflex /edieresis - /igrave /iacute /icircumflex /idieresis + /igrave /iacute /icircumflex /idieresis /gbreve /ntilde /ograve /oacute - /ocircumflex /otilde /odieresis /divide + /ocircumflex /otilde /odieresis /divide /oslash /ugrave /uacute /ucircumflex - /udieresis /dotlessi /scedilla /ydieresis + /udieresis /dotlessi /scedilla /ydieresis 256 packedarray .defineencoding exec diff --git a/Master/tlpkg/tlgs/lib/gslp.ps b/Master/tlpkg/tlgs/lib/gslp.ps index 264984af968..742e2399a83 100644 --- a/Master/tlpkg/tlgs/lib/gslp.ps +++ b/Master/tlpkg/tlgs/lib/gslp.ps @@ -1,19 +1,19 @@ % Copyright (C) 1991, 1995, 1996, 1997, 1998, 1999 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: gslp.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % gslp.ps - format and print text % This utility provides functionality approximately equivalent to the Unix @@ -63,7 +63,7 @@ lpdict begin %% reencode for iso latin1; from the 2nd edition red book, sec 5.6.1 dup length dict begin {1 index /FID ne {def} {pop pop} ifelse} forall /Encoding ISOLatin1Encoding def currentdict end - dup /FontName get 80 string cvs (-ISOLatin1) concatstrings cvn + dup /FontName get 80 string cvs (-ISOLatin1) concatstrings cvn exch definefont } def @@ -136,7 +136,7 @@ lpdict begin } def /lpmoveto { % lpmoveto - - % Round the coordinates for smaller output. + % Round the coordinates for smaller output. 2 { exch 100 mul round 100 div dup dup cvi eq { cvi } if @@ -146,23 +146,23 @@ lpdict begin /lpshow { % lpshow - dup length 0 ne { addspace 0 ne { - addspace 0 32 + addspace 0 32 addwidth 0 ne { - addwidth 0 6 -1 roll /awidthshow 6 true lpexec + addwidth 0 6 -1 roll /awidthshow 6 true lpexec } { - 4 -1 roll /widthshow 4 true lpexec + 4 -1 roll /widthshow 4 true lpexec } ifelse } { addwidth 0 ne { - addwidth 0 3 -1 roll /ashow 3 true lpexec + addwidth 0 3 -1 roll /ashow 3 true lpexec } { - OutFile null ne { - dup dup length =string length gt { - /show 1 false lpexec - } { - (S ) ws ws (\n) ws - } ifelse - } if show + OutFile null ne { + dup dup length =string length gt { + /show 1 false lpexec + } { + (S ) ws ws (\n) ws + } ifelse + } if show } ifelse } ifelse } { @@ -183,9 +183,9 @@ lpdict begin 3 -1 roll bannerstring pop 0 4 index pwidth showline2 pop exch bannerstring pwidth exch sub 2 div 3 index pwidth showline2 pop bannerstring - % Prevent the last character of the heading from grazing - % the right margin. - % ****** WHY DOES IT REQUIRE SO MUCH PADDING? ****** + % Prevent the last character of the heading from grazing + % the right margin. + % ****** WHY DOES IT REQUIRE SO MUCH PADDING? ****** ( ) stringwidth pop 2 mul add pwidth exch sub 3 -1 roll pwidth showline2 pop @@ -258,7 +258,7 @@ lpdict begin /outfont { % outfont - OutFile null ne { exch wo - dup /FontName get + dup /FontName get dup wosp (-ISOLatin1) ws wosp ( RE) ws /FontMatrix get 0 get 1000 mul round cvi wosp ( scalefont def\n) ws @@ -296,7 +296,7 @@ lpdict begin /showline2 { % string x y xlimit -> leftover_string (handles tabs) 2 index exch 5 2 roll setxy { - % Stack: xinit xlimit string + % Stack: xinit xlimit string showline3 dup length 0 eq { exit } if dup 0 get CharTAB ne { exit } if tx 3 index sub tabwx div @@ -307,11 +307,11 @@ lpdict begin } def /showline3 { % xlimit string -> xlimit leftover_string - % (finds line break / tab / formfeed) + % (finds line break / tab / formfeed) 1 index tx sub cwx div 0.1 add cvi 0 .max 1 index length .min 1 index 0 3 -1 roll getinterval - % look for \f or \t + % look for \f or \t StringFF search { exch pop exch pop } if StringTAB search { exch pop exch pop } if dup length 0 ne { @@ -367,15 +367,15 @@ lpdict begin { mfile =string readline pop (EndFontMetrics) anchorsearch { pop pop exit } if (KPX ) anchorsearch { - pop token pop cvlit /char1 exch def - token pop cvlit /char2 exch def - token pop /kern exch def pop - kdict char1 .knownget not { - 5 dict kdict char1 2 index .growput - } if - char2 kern .growput + pop token pop cvlit /char1 exch def + token pop cvlit /char2 exch def + token pop /kern exch def pop + kdict char1 .knownget not { + 5 dict kdict char1 2 index .growput + } if + char2 kern .growput } { - pop + pop } ifelse } loop kdict } { @@ -402,7 +402,7 @@ lpdict begin /S {currentfile =string readline pop show} lpdef /RE { % RE findfont - %% reencode for iso latin1; from the 2nd edition red book, sec 5.6.1 + %% reencode for iso latin1; from the 2nd edition red book, sec 5.6.1 dup length dict begin {1 index /FID ne {def} {pop pop} ifelse} forall /Encoding ISOLatin1Encoding def currentdict end definefont @@ -448,8 +448,8 @@ lpdict begin Footers { hheight lheight add } { 0 } ifelse /botskip exch def /pskip topskip botskip add def - % Translate the page so that (0,0) corresponds to - % the top of the topmost body line. + % Translate the page so that (0,0) corresponds to + % the top of the topmost body line. pathbbox 2 index sub MarginBottom MarginTop add sub /plength exch def 2 index sub MarginLeft MarginRight add sub /pwidth exch def @@ -469,6 +469,14 @@ lpdict begin (.\n) eprint flush } if + colines 1 lt cowidth 1 lt or + { + (Page too small, it must be large to hold at least one line of text\n) eprint + (please specify a page size using for example -sPAPERSIZE=(a4|letter)\n) eprint + /gslp.ps cvx /limitcheck signalerror + } if + + % Write the kerning table, if relevant. OutFile null ne Kern length 0 ne and { (/kproc) ws /kproc load wosp ( def\n) ws @@ -493,12 +501,12 @@ lpdict begin } { % Reached CR and/or EOF first. exch length pos add lbuf exch 0 exch getinterval - 1 index { showline } if % omit final empty line - { dup length 0 eq Truncate or { pop () exit } if - showline - } - loop - exch not { exit } if + 1 index { showline } if % omit final empty line + { dup length 0 eq Truncate or { pop () exit } if + showline + } + loop + exch not { exit } if } ifelse pindex PageLast gt { exit } if @@ -626,10 +634,10 @@ lpdict begin /lp1 % filename -> { break not { dup /HeadingLeft exch def } if Noisy - { (Printing ) eprint dup eprint (\n) eprint + { (Printing ) eprint dup eprint (\n) eprint } if (r) file - % If requested, check for a PostScript file. + % If requested, check for a PostScript file. DetectFileType { dup 2 string readstring pop dup (%!) eq { % Yes, it's a PostScript file. @@ -659,11 +667,11 @@ end dup length 2 ge { dup 0 get (-) 0 get eq } { false } ifelse { dup 0 2 getinterval exch dup length 2 sub 2 exch getinterval - doswitch + doswitch } { dup /matched false def { /matched true def /any true def lp1 } lpcstring filenameforall - matched { pop } { lp1 } ifelse % let the error happen + matched { pop } { lp1 } ifelse % let the error happen } ifelse } loop @@ -679,14 +687,14 @@ end { ] dup length 0 ne { lpcommand } { false } ifelse not { (%stderr) (w) file [ (Usage: ) - /PROGNAME where { pop PROGNAME } { (gslp) } ifelse - ( [-12BclqRr] [-b
] [-f] [-F]\n) - ( [-L] [-p] [-T]\n) - ( [--add-to-(space|width) ] [--columns ]\n) - ( [--detect] [--first-page ] [--last-page ]\n) - ( [--(heading|footing)-(left|right|center) ]\n) - ( [--kern ] [--margin-(top|bottom|left|right) ]\n) - ( [--no-eject-(file|formfeed)] [--spacing ] file1 ... filen\n) + /PROGNAME where { pop PROGNAME } { (gslp) } ifelse + ( [-12BclqRr] [-b
] [-f] [-F]\n) + ( [-L] [-p] [-T]\n) + ( [--add-to-(space|width) ] [--columns ]\n) + ( [--detect] [--first-page ] [--last-page ]\n) + ( [--(heading|footing)-(left|right|center) ]\n) + ( [--kern ] [--margin-(top|bottom|left|right) ]\n) + ( [--no-eject-(file|formfeed)] [--spacing ] file1 ... filen\n) ] { 2 copy writestring pop } forall dup flushfile closefile } if diff --git a/Master/tlpkg/tlgs/lib/gsnup.ps b/Master/tlpkg/tlgs/lib/gsnup.ps index 9b4fa039d39..b990dd097dd 100644 --- a/Master/tlpkg/tlgs/lib/gsnup.ps +++ b/Master/tlpkg/tlgs/lib/gsnup.ps @@ -1,20 +1,20 @@ %! % Copyright (C) 1999 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: gsnup.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Prefix this to very well-behaved PostScript files for n-up printing. /cdef { 1 index where { pop pop } { def } ifelse } def @@ -59,23 +59,23 @@ false setglobal grestore 2 copy exch .Nx div exch .Ny div .Pn dup .Nx mod exch .Nx idiv .Ny 1 sub exch sub - % Stack: nmax pw ph pw/nx ph/ny ix iy + % Stack: nmax pw ph pw/nx ph/ny ix iy exch 3 index mul exch 2 index mul translate - % Stack: nmax pw ph pw/nx ph/ny + % Stack: nmax pw ph pw/nx ph/ny 4 -1 roll 4 index div 4 -1 roll 4 index div - % Stack: nmax pw/nx ph/ny pw/nmax ph/nmax + % Stack: nmax pw/nx ph/ny pw/nmax ph/nmax exch 4 -1 roll exch sub 2 div 3 1 roll sub 2 div translate - % Stack: nmax + % Stack: nmax 1 exch div dup scale .BP } /EndPage { dup 2 lt { .ELevel 0 vmstatus pop pop put - .Ps 0 .Pn 1 add .Nx .Ny mul mod put + .Ps 0 .Pn 1 add .Nx .Ny mul mod put .Pn 0 eq { .EP } { diff --git a/Master/tlpkg/tlgs/lib/ht_ccsto.ps b/Master/tlpkg/tlgs/lib/ht_ccsto.ps index 1d4f2ffca4b..66c86d2e48e 100644 --- a/Master/tlpkg/tlgs/lib/ht_ccsto.ps +++ b/Master/tlpkg/tlgs/lib/ht_ccsto.ps @@ -6,7 +6,7 @@ % PostScript halftone dictionaries, and hereby places this file in the % public domain as well. -% $Id: ht_ccsto.ps 8469 2007-12-31 19:06:52Z ray $ +% $Id$ % This file defines a /StochasticDefault Type 5 Halftone. % Note that the Black array is used for Default, Black, and Gray diff --git a/Master/tlpkg/tlgs/lib/image-qa.ps b/Master/tlpkg/tlgs/lib/image-qa.ps index 0606ec8ceb6..fe56600c9f9 100644 --- a/Master/tlpkg/tlgs/lib/image-qa.ps +++ b/Master/tlpkg/tlgs/lib/image-qa.ps @@ -1,24 +1,24 @@ %!PS % Copyright (C) 2000 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. % -% $Id: image-qa.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Tests for the image operators % Specifications for Image operator testing. -% +% % 1. All 8 standard orientations (0, 90, 180, 270 degree rotations with % and without reflection); ditto those orientations perturbed by +/- % 10 degrees, and by 45 degrees. @@ -26,35 +26,35 @@ % Enough space is provided around images on a test page to allow % these permutations to use the same page layout. This will make % test page construction easier and simplify page checking. -% +% % 2. All 9 image types (ImageType 1 mask, ImageType 1 opaque, % ImageType 3 with all 3 InterleaveTypes and with unequal scaling % for InterleaveType 2 and 3, ImageType 4 with both range and % single-point matching). -% +% % 3. DeviceGray, DeviceRGB, and DeviceN color, both direct and Indexed. % Indexed color will use the common pallete size of 256 colors. -% +% % 4. For simple masks, both colored and uncolored Patterns. -% +% % 5. CombineWithColor true and false; several different colors for the % true case (including black, white, other solid colors, halftones, % and patterns). -% +% % 6. Source transparency true and false. -% +% % 7. Texture transparency true and false. -% +% % 8. Different RasterOp values. -% +% % 9. For ImageType 4, different color keys (out-of-range, specific % color other than white, range without white). -% +% % 10. String, file, and procedure data sources; for multi-component % color spaces, MultipleDataSources = true. This is tested by % constructing string data sources that are used as input to % SubFileDecode filter to create a filetype data source. These -% filters are read into scratch strings for the procedure data +% filters are read into scratch strings for the procedure data % source case. The procedure data source scratch string length % does not match the raster width, and the width x height is % not an integer multiple of the string length. @@ -75,7 +75,7 @@ /WidthRGB 83 def /HeightRGB 89 def -% +% % 11. Banded and non-banded rendering. This can be tested by running % test files throuch with different page device parameters to % force banding vs. page mode. @@ -84,23 +84,23 @@ % % Testing the RasterOp-related functions (5/6/7/8) is not necessary at this % time. They are well isolated logically. -% +% % Testing orientation (1) and color masking (9) would be a good idea at some % point, because this code has broken many times in the past and has had a % long bug tail. -% +% % The really important things to test are 2 (image type), 3/4 (color space -- % but only with regard to number of components, plus DeviceN and simple masks % with a Pattern, which exercise special control paths), 10 (data source), % and 11 (banding modes). -% +% % ========================================================================== % % Procedure to generate test mask data % % WM and HM must be defined prior to invocation -% MaskGen - +% MaskGen - % % The mask data is stored into a string named /MaskData % @@ -118,23 +118,23 @@ /Y exch def 0 1 WB 1 sub { /B exch def % byte within the row - /C B Y WB mul add def + /C B Y WB mul add def /P 0 def 0 1 7 { - /b exch def % bit within the character - /X b B 8 mul add def - X WM lt - { X Y eq - X HM 1 sub Y sub eq or - Y Y0 gt X X0 sub abs 2 le and or - X X0 sub WM div dup mul Y Y0 sub HM div dup mul add sqrt 9 mul cvi 2 mod 1 eq or - } - { true } % pad bits are always set - ifelse - % stack: true if pixel is set - { - MB b get P or /P exch def - } if + /b exch def % bit within the character + /X b B 8 mul add def + X WM lt + { X Y eq + X HM 1 sub Y sub eq or + Y Y0 gt X X0 sub abs 2 le and or + X X0 sub WM div dup mul Y Y0 sub HM div dup mul add sqrt 9 mul cvi 2 mod 1 eq or + } + { true } % pad bits are always set + ifelse + % stack: true if pixel is set + { + MB b get P or /P exch def + } if } for % Bits within a byte MaskData C P put } for % Bytes within the row @@ -143,7 +143,7 @@ % % WM and HM must be defined prior to invocation -% BPC MaskGenBPC - +% BPC MaskGenBPC - % % The mask data is stored into a string named /MaskData % @@ -168,9 +168,9 @@ X BPC mul 8 div Y WB mul add exch [ { } % BPC = 0 - { { 1 } { 0 } ifelse put4bit } % BPC = 4 - { { 255 } { 0 } ifelse exch cvi exch put } % BPC = 8 - { { 1 } { 0 } ifelse put12bit } % BPC = 12 + { { 1 } { 0 } ifelse put4bit } % BPC = 4 + { { 255 } { 0 } ifelse exch cvi exch put } % BPC = 8 + { { 1 } { 0 } ifelse put12bit } % BPC = 12 ] BPC 4 div cvi get exec } for } for % Rows in the mask @@ -221,7 +221,6 @@ grestore } bind def - % ----------------------------------------------------------------------- % % Procedures for ImageMatrix creation @@ -292,7 +291,6 @@ grestore } bind def - % YY, SX, SY, WD and HD should be defined prior to invocation % X Y BPC matrix source multi decode MaskColor DoImage4 - % @@ -338,7 +336,7 @@ /DM exch def /MS exch def /S exch def % May be an array of sources - For InterleaveType 3 - % S[0] is the Mask DataSource + % S[0] is the Mask DataSource /M exch def /BPC exch def /XX 1 index def @@ -365,11 +363,11 @@ /Width WM /Height HM /ImageMatrix % construct the mask matrix using signs from the DataImage matrix - /M0 M 0 get WD abs div cvi def - /M3 M 3 get HD abs div cvi def - /M4 M 4 get WD abs div cvi def - /M5 M 5 get HD abs div cvi def - [ WM M0 mul 0 0 HM M3 mul WM M4 mul HM M5 mul ] + /M0 M 0 get WD abs div cvi def + /M3 M 3 get HD abs div cvi def + /M4 M 4 get WD abs div cvi def + /M5 M 5 get HD abs div cvi def + [ WM M0 mul 0 0 HM M3 mul WM M4 mul HM M5 mul ] IT 3 eq { /DataSource S 0 get exec % DataSource only allowed for InterleaveType 3 } if @@ -387,7 +385,6 @@ grestore } bind def - % ----------------------------------------------------------------------- % /Helvetica-Bold findfont 20 scalefont /TitleFont exch def @@ -447,7 +444,7 @@ % 0 to 4095 (12 bit) /put4bit { - 15 mul cvi + 15 mul cvi exch dup cvi dup 3 1 roll eq 3 -1 roll exch { % integer index means high nibble. 16 mul put @@ -461,7 +458,7 @@ /put12bit { 1 index cvi /I exch def 2 index /S exch def - 4095 mul cvi + 4095 mul cvi exch dup dup cvi eq { % integer index means high byte is aligned cvi exch 3 copy 16 div cvi put @@ -483,7 +480,7 @@ /sM WidthRGB 2 mul 1 sub string def % long enough to hold more than one mask line /sD WidthRGB 7 mul 1 sub string def % long enough to hold more than one 12 bit RGB line - % worst case is 12bit ImageType3 InterleaveType 1 == 48 bits + % worst case is 12bit ImageType3 InterleaveType 1 == 48 bits /MaskDProc { /FM MaskData dup length () /SubFileDecode filter def @@ -500,7 +497,7 @@ } bind def /MaskDFile { - MaskData dup length () /SubFileDecode filter + MaskData dup length () /SubFileDecode filter /MDF 1 index def } bind def @@ -510,7 +507,7 @@ } bind def /RGBDFile { - RGBData dup length () /SubFileDecode filter + RGBData dup length () /SubFileDecode filter /RGBDF 1 index def } bind def @@ -534,29 +531,29 @@ } bind def /RDFile { - RData dup length () /SubFileDecode filter + RData dup length () /SubFileDecode filter /RDF 1 index def } bind def /GDFile { - GData dup length () /SubFileDecode filter + GData dup length () /SubFileDecode filter /GDF 1 index def } bind def /BDFile { - BData dup length () /SubFileDecode filter + BData dup length () /SubFileDecode filter /BDF 1 index def } bind def % ----------------------------------------------------------------------- -% +% % Procedure to handle fileposition. Ghostscript has a private % operator .fileposition that works when fileposition does not -% +% % tryfilepos % Returns: fileposition true if successful % 0 false if not -/tryfilepos { +/tryfilepos { /.fileposition where { pop /.fileposition load } % most likely to succeed { /fileposition load } @@ -568,7 +565,7 @@ } bind def % ----------------------------------------------------------------------- -% +% % Procedure to provide =only operator if not present. Suggested % by Alex Cherepanov to use =print operator present on some Adobe % implementations. @@ -580,12 +577,12 @@ ifelse % ----------------------------------------------------------------------- -% +% % Procedure to make sure that the file is at the EOF. % added above (string == FileTailString. % % If not, it will mark the image area with a red "F" -% +% % <file> CheckFileTail - XX is the horizontal position % YY is the vertical position % SX,SY determine size of "F" if fail @@ -635,10 +632,10 @@ ifelse 200 740 moveto (Rotation Angle = ) show IR 3 string cvs show 170 720 moveto (Colorspace = ) show CSpaceName show LegendFont setfont - + .4 .1 .7 setrgbcolor % contrasting color for stencil masking /SX SX 2 mul def /SY SY 2 mul def - /YY 780 SY sub def + /YY 780 SY sub def MaskGen TX IMLRTB MaskData [1 0] DoImageMask @@ -648,8 +645,8 @@ ifelse dup 2 index 1 add G 255 mul cvi put exch 2 add B 255 mul cvi put } ImageGen - - % X BPC matrix source multi decode + + % X BPC matrix source multi decode XI 8 IMLRTB RGBData false [0 1 0 1 0 1] DoImage1 /SX SX 2 div def /SY SY 2 div def @@ -661,8 +658,8 @@ ifelse % Type 1 and Type 4 Tests % /CSpace and /IR are defined in order to generate various pages -/T1T4Tests { % - +/T1T4Tests { % + % Use an unusual (unpleasant?) underlying color .6 .95 .4 setrgbcolor clippath fill 0 0 0 setrgbcolor @@ -683,13 +680,13 @@ ifelse XH BY moveto ( Multi\nDS=string) blockshow XI BY moveto ( Multi\nDS=proc) blockshow XJ BY moveto ( Multi\nDS=file) blockshow - + .4 .1 .7 setrgbcolor % contrasting color for stencil masking - + /WM WD def /HM HD def /SX SX 2 mul def /SY SY 2 mul def - /YY 780 SY sub def + /YY 780 SY sub def MaskGen TX IMLRTB MaskData [1 0] DoImageMask @@ -699,20 +696,20 @@ ifelse dup 2 index 1 add G 255 mul cvi put exch 2 add B 255 mul cvi put } ImageGen - - % X BPC matrix source multi decode + + % X BPC matrix source multi decode XI 8 IMLRTB RGBData false [0 1 0 1 0 1] DoImage1 /SX SX 2 div def /SY SY 2 div def - + % ---------------------------------------------------------------------- % Type 1 Stencil Mask Images - + /YY YA def TX YA SY add moveto (\nType 1\nStencil\nMask) blockshow - + MaskGen - % X matrix source decode + % X matrix source decode XA IMLRTB MaskData [0 1] DoImageMask XB IMLRTB MaskData [1 0] DoImageMask XC IMLRBT MaskData [1 0] DoImageMask @@ -721,21 +718,21 @@ ifelse XF IMLRTB MaskDProc [1 0] DoImageMask XG IMLRTB MaskDFile [1 0] DoImageMask MaskData (Mask) MDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % Type 1 RGB Single Data Sources, BPC==8 - + /YY YB def TX YY SY add moveto (\nType 1\nRGB\nBPC=8) blockshow - + /RGBData WD HD mul 3 mul string def { X Y WD mul add 3 mul RGBData dup 2 index R 255 mul cvi put dup 2 index 1 add G 255 mul cvi put exch 2 add B 255 mul cvi put } ImageGen - - % X BPC matrix source multi decode + + % X BPC matrix source multi decode XA 8 IMLRTB RGBData false [1 0 1 0 1 0] DoImage1 XB 8 IMLRTB RGBData false [0 1 0 1 0 1] DoImage1 XC 8 IMLRBT RGBData false [0 1 0 1 0 1] DoImage1 @@ -744,35 +741,34 @@ ifelse XF 8 IMLRTB RGBDProc false [0 1 0 1 0 1] DoImage1 XG 8 IMLRTB RGBDFile false [0 1 0 1 0 1] DoImage1 RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % Type 1 RGB Multiple Data Sources, BPC==8 - + WD HD mul /RData 1 index string def /GData 1 index string def - /BData exch string def - { X Y WD mul add + /BData exch string def + { X Y WD mul add RData 1 index R 255 mul cvi put GData 1 index G 255 mul cvi put BData exch B 255 mul cvi put } ImageGen - - % X BPC matrix source multi decode + % X BPC matrix source multi decode XH 8 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] DoImage1 XI 8 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] DoImage1 XJ 8 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] DoImage1 RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % Type 4 RGB Single Data Sources, BPC==8, mask black - + /YY YE def TX YY SY add moveto (\nType 4\nBPC=8\nmask=black) blockshow - - % X BPC matrix source multi decode MaskColor + + % X BPC matrix source multi decode MaskColor XA 8 IMLRTB RGBData false [1 0 1 0 1 0] [ 000 000 000 ] DoImage4 XB 8 IMLRTB RGBData false [0 1 0 1 0 1] [ 000 000 000 ] DoImage4 XC 8 IMLRBT RGBData false [0 1 0 1 0 1] [ 000 000 000 ] DoImage4 @@ -781,25 +777,25 @@ ifelse XF 8 IMLRTB RGBDProc false [0 1 0 1 0 1] [ 000 000 000 ] DoImage4 XG 8 IMLRTB RGBDFile false [0 1 0 1 0 1] [ 000 000 000 ] DoImage4 RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % Type 4 RGB Multiple Data Sources, BPC==8, mask black - - % X BPC matrix source multi decode MaskColor + + % X BPC matrix source multi decode MaskColor XH 8 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] [ 000 000 000 ] DoImage4 XI 8 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] [ 000 000 000 ] DoImage4 XJ 8 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] [ 000 000 000 ] DoImage4 RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % Type 4 RGB Single Data Sources, BPC==8, mask white - + /YY YF def TX YY SY add moveto (\nType 4\nBPC=8\nmask=white) blockshow - - % X BPC matrix source multi decode MaskColor + + % X BPC matrix source multi decode MaskColor XA 8 IMLRTB RGBData false [1 0 1 0 1 0] [ 255 255 255 ] DoImage4 gsave .5 .2 .2 setrgbcolor XB YY SX 13 mul SY rectfill grestore XB 8 IMLRTB RGBData false [0 1 0 1 0 1] [ 255 255 255 ] DoImage4 @@ -809,25 +805,25 @@ ifelse XF 8 IMLRTB RGBDProc false [0 1 0 1 0 1] [ 255 255 255 ] DoImage4 XG 8 IMLRTB RGBDFile false [0 1 0 1 0 1] [ 255 255 255 ] DoImage4 RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % Type 4 RGB Multiple Data Sources, BPC==8, mask white - - % X BPC matrix source multi decode MaskColor + + % X BPC matrix source multi decode MaskColor XH 8 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] [ 255 255 255 ] DoImage4 XI 8 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] [ 255 255 255 ] DoImage4 XJ 8 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] [ 255 255 255 ] DoImage4 RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % Type 4 RGB Single Data Sources, BPC==8, mask gray - + /YY YG def TX YY SY add moveto (\nType 4\nBPC=8\nmask=gray) blockshow - - % X BPC matrix source multi decode MaskColor + + % X BPC matrix source multi decode MaskColor XA 8 IMLRTB RGBData false [1 0 1 0 1 0] [ 147 147 147 ] DoImage4 XB 8 IMLRTB RGBData false [0 1 0 1 0 1] [ 147 147 147 ] DoImage4 XC 8 IMLRBT RGBData false [0 1 0 1 0 1] [ 147 147 147 ] DoImage4 @@ -836,25 +832,25 @@ ifelse XF 8 IMLRTB RGBDProc false [0 1 0 1 0 1] [ 147 147 147 ] DoImage4 XG 8 IMLRTB RGBDFile false [0 1 0 1 0 1] [ 147 147 147 ] DoImage4 RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % Type 4 RGB Multiple Data Sources, BPC==8, mask gray - - % X BPC matrix source multi decode MaskColor + + % X BPC matrix source multi decode MaskColor XH 8 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] [ 147 147 147 ] DoImage4 XI 8 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] [ 147 147 147 ] DoImage4 XJ 8 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] [ 147 147 147 ] DoImage4 RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % Type 4 RGB Single Data Sources, BPC==8, mask range - + /YY YH def TX YY SY add moveto (\nType 4\nBPC=8\nmask range) blockshow - - % X BPC matrix source multi decode MaskColor + + % X BPC matrix source multi decode MaskColor XA 8 IMLRTB RGBData false [1 0 1 0 1 0] [ 020 200 020 200 020 200 ] DoImage4 XB 8 IMLRTB RGBData false [0 1 0 1 0 1] [ 020 200 020 200 020 200 ] DoImage4 XC 8 IMLRBT RGBData false [0 1 0 1 0 1] [ 020 200 020 200 020 200 ] DoImage4 @@ -863,33 +859,33 @@ ifelse XF 8 IMLRTB RGBDProc false [0 1 0 1 0 1] [ 020 200 020 200 020 200 ] DoImage4 XG 8 IMLRTB RGBDFile false [0 1 0 1 0 1] [ 020 200 020 200 020 200 ] DoImage4 RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % Type 4 RGB Multiple Data Sources, BPC==8, mask range - - % X Y SX SY BPC matrix source multi decode MaskColor + + % X Y SX SY BPC matrix source multi decode MaskColor XH 8 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] [ 020 200 020 200 020 200 ] DoImage4 XI 8 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] [ 020 200 020 200 020 200 ] DoImage4 XJ 8 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] [ 020 200 020 200 020 200 ] DoImage4 RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % Type 1 RGB Single Data Sources, BPC==12 - + /YY YC def TX YY SY add moveto (\nType 1\nRGB\nBPC=12) blockshow - + /RGBData WD 36 mul 7 add 8 div cvi HD mul string def - { + { X 36 mul 8 div Y WD 36 mul 7 add 8 div cvi mul add RGBData 1 index R put12bit RGBData 1 index 1.5 add G put12bit RGBData exch 3 add B put12bit } ImageGen - - % X BPC matrix source multi decode + + % X BPC matrix source multi decode XA 12 IMLRTB RGBData false [1 0 1 0 1 0] DoImage1 XB 12 IMLRTB RGBData false [0 1 0 1 0 1] DoImage1 XC 12 IMLRBT RGBData false [0 1 0 1 0 1] DoImage1 @@ -898,35 +894,35 @@ ifelse XF 12 IMLRTB RGBDProc false [0 1 0 1 0 1] DoImage1 XG 12 IMLRTB RGBDFile false [0 1 0 1 0 1] DoImage1 RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % Type 1 RGB Multiple Data Sources, BPC==12 - + WD 3 mul 1 add 2 div cvi HD mul /RData 1 index string def /GData 1 index string def - /BData exch string def - { + /BData exch string def + { X 3 mul 2 div Y WD 3 mul 1 add 2 div cvi mul add RData 1 index R put12bit GData 1 index G put12bit BData exch B put12bit } ImageGen - - % X BPC matrix source multi decode + + % X BPC matrix source multi decode XH 12 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] DoImage1 XI 12 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] DoImage1 XJ 12 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] DoImage1 RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % Type 4 RGB Single Data Sources, BPC==12, mask range - + /YY YI def TX YY SY add moveto (\nType 4\nBPC=12\nmask range) blockshow - - % X BPC matrix source multi decode MaskColor + + % X BPC matrix source multi decode MaskColor XA 12 IMLRTB RGBData false [1 0 1 0 1 0] [ 300 3000 300 3000 300 3000 ] DoImage4 XB 12 IMLRTB RGBData false [0 1 0 1 0 1] [ 300 3000 300 3000 300 3000 ] DoImage4 XC 12 IMLRBT RGBData false [0 1 0 1 0 1] [ 300 3000 300 3000 300 3000 ] DoImage4 @@ -935,33 +931,33 @@ ifelse XF 12 IMLRTB RGBDProc false [0 1 0 1 0 1] [ 300 3000 300 3000 300 3000 ] DoImage4 XG 12 IMLRTB RGBDFile false [0 1 0 1 0 1] [ 300 3000 300 3000 300 3000 ] DoImage4 RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % Type 4 RGB Multiple Data Sources, BPC==12, mask range - - % X BPC matrix source multi decode MaskColor + + % X BPC matrix source multi decode MaskColor XH 12 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] [ 300 3000 300 3000 300 3000 ] DoImage4 XI 12 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] [ 300 3000 300 3000 300 3000 ] DoImage4 XJ 12 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] [ 300 3000 300 3000 300 3000 ] DoImage4 RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % Type 1 RGB Single Data Sources, BPC==4 - + /YY YD def TX YY SY add moveto (\nType 1\nRGB\nBPC=4) blockshow - + /RGBData WD 12 mul 7 add 8 div cvi HD mul string def - { + { X 12 mul 8 div Y WD 12 mul 7 add 8 div cvi mul add RGBData 1 index R put4bit RGBData 1 index 0.5 add G put4bit RGBData exch 1.0 add B put4bit } ImageGen - - % X BPC matrix source multi decode + + % X BPC matrix source multi decode XA 4 IMLRTB RGBData false [1 0 1 0 1 0] DoImage1 XB 4 IMLRTB RGBData false [0 1 0 1 0 1] DoImage1 XC 4 IMLRBT RGBData false [0 1 0 1 0 1] DoImage1 @@ -970,35 +966,35 @@ ifelse XF 4 IMLRTB RGBDProc false [0 1 0 1 0 1] DoImage1 XG 4 IMLRTB RGBDFile false [0 1 0 1 0 1] DoImage1 RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % Type 1 RGB Multiple Data Sources, BPC==4 - + WD 1 add 2 div cvi HD mul /RData 1 index string def /GData 1 index string def - /BData exch string def - { + /BData exch string def + { X 2 div Y WD 1 add 2 div cvi mul add RData 1 index R put4bit GData 1 index G put4bit BData exch B put4bit } ImageGen - - % X BPC matrix source multi decode + + % X BPC matrix source multi decode XH 4 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] DoImage1 XI 4 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] DoImage1 XJ 4 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] DoImage1 RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % Type 4 RGB Single Data Sources, BPC==4, mask range - + /YY YJ def TX YY SY add moveto (\nType 4\nBPC=4\nmask range) blockshow - - % X BPC matrix source multi decode MaskColor + + % X BPC matrix source multi decode MaskColor XA 4 IMLRTB RGBData false [1 0 1 0 1 0] [ 1 10 1 10 1 10 ] DoImage4 XB 4 IMLRTB RGBData false [0 1 0 1 0 1] [ 1 10 1 10 1 10 ] DoImage4 XC 4 IMLRBT RGBData false [0 1 0 1 0 1] [ 1 10 1 10 1 10 ] DoImage4 @@ -1007,20 +1003,20 @@ ifelse XF 4 IMLRTB RGBDProc false [0 1 0 1 0 1] [ 1 10 1 10 1 10 ] DoImage4 XG 4 IMLRTB RGBDFile false [0 1 0 1 0 1] [ 1 10 1 10 1 10 ] DoImage4 RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % Type 4 RGB Multiple Data Sources, BPC==4, mask range - - % X BPC matrix source multi decode MaskColor + + % X BPC matrix source multi decode MaskColor XH 4 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] [ 1 10 1 10 1 10 ] DoImage4 XI 4 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] [ 1 10 1 10 1 10 ] DoImage4 XJ 4 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] [ 1 10 1 10 1 10 ] DoImage4 RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed - + showpage - + } bind def % T1T4Tests % ----------------------------------------------------------------------- @@ -1037,13 +1033,13 @@ ifelse 200 740 moveto (Rotation Angle = ) show IR 3 string cvs show 170 720 moveto (Colorspace = ) show CSpaceName show LegendFont setfont - + .4 .1 .7 setrgbcolor % contrasting color for stencil masking /WM WD def /HM HD def /SX SX 2 mul def /SY SY 2 mul def - /YY 780 SY sub def + /YY 780 SY sub def MaskGen XA IMLRTB MaskData [1 0] DoImageMask @@ -1053,17 +1049,17 @@ ifelse dup 2 index 1 add G 255 mul cvi put exch 2 add B 255 mul cvi put } ImageGen - - % X BPC matrix source multi decode + + % X BPC matrix source multi decode XH 8 IMLRTB RGBData false [0 1 0 1 0 1] DoImage1 /SX SX 2 div def /SY SY 2 div def - + % ---------------------------------------------------------------------- % InterleaveType 1, BPC==8, WM=WD, HM=HD % IT 1 is what GS calls "chunky pixel" /YY YA def TX YY SY add moveto (\nIntType 1\nBPC=8) blockshow - + % Generate the MaskData first 8 MaskGenBPC @@ -1089,13 +1085,13 @@ ifelse XH 8 IMLRTB RGBDProc false [1 0] [0 1 0 1 0 1] 1 DoImage3 XI 8 IMLRTB RGBDFile false [1 0] [0 1 0 1 0 1] 1 DoImage3 RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % InterleaveType 1, BPC==12, WM=WD, HM=HD % IT 1 is what GS calls "chunky pixel" /YY YB def TX YY SY add moveto (\nIntType 1\nBPC=12) blockshow - + % Generate the MaskData first 12 MaskGenBPC @@ -1103,11 +1099,11 @@ ifelse /RGBData WD HD mul 6 mul string def { X Y WD mul add 6 mul % 6 bytes Mask,Red,Green,Blue RGBData - dup 2 index - MaskData X 1.5 mul .5 add cvi - Y WB mul add get % get the aligned mask byte (hi or lo) - 0 eq { 0 } { 1 } ifelse - put12bit + dup 2 index + MaskData X 1.5 mul .5 add cvi + Y WB mul add get % get the aligned mask byte (hi or lo) + 0 eq { 0 } { 1 } ifelse + put12bit dup 2 index 1.5 add R put12bit dup 2 index 3.0 add G put12bit exch 4.5 add B put12bit @@ -1125,13 +1121,13 @@ ifelse XH 12 IMLRTB RGBDProc false [1 0] [0 1 0 1 0 1] 1 DoImage3 XI 12 IMLRTB RGBDFile false [1 0] [0 1 0 1 0 1] 1 DoImage3 RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % InterleaveType 1, BPC==4, WM=WD, HM=HD % IT 1 is what GS calls "chunky pixel" /YY YC def TX YY SY add moveto (\nIntType 1\nBPC=4) blockshow - + % Generate the MaskData first 4 MaskGenBPC @@ -1140,8 +1136,8 @@ ifelse { X Y WD mul add 2 mul % 2 bytes Mask,Red,Green,Blue RGBData dup 2 index MaskData X 2 div cvi Y WB mul add get - X 1 and 0 eq { 128 div cvi } { 1 and } ifelse - put4bit + X 1 and 0 eq { 128 div cvi } { 1 and } ifelse + put4bit dup 2 index 0.5 add R put4bit dup 2 index 1.0 add G put4bit exch 1.5 add B put4bit @@ -1159,14 +1155,14 @@ ifelse XH 4 IMLRTB RGBDProc false [1 0] [0 1 0 1 0 1] 1 DoImage3 XI 4 IMLRTB RGBDFile false [1 0] [0 1 0 1 0 1] 1 DoImage3 RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % InterleaveType 2, BPC==8, WM=WD, HM=HD % IT 2 is line interleave -- Mask line follwoed by Data line % RGB Image Data must be chunky (MultipleDatasources==false). /YY YD def TX YY SY add moveto (\nIntType 2\nBPC=8) blockshow - + % Generate the MaskData first MaskGen @@ -1197,12 +1193,12 @@ ifelse XH 8 IMLRTB RGBDProc false [1 0] [0 1 0 1 0 1] 2 DoImage3 XI 8 IMLRTB RGBDFile false [1 0] [0 1 0 1 0 1] 2 DoImage3 RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % InterleaveType 2, BPC==12, WM=WD, HM=HD /YY YE def TX YY SY add moveto (\nIntType 2\nBPC=12) blockshow - + % Generate the Data Image (uses the MaskData) /BPL WD 36 mul 7 add 8 div cvi WB add def % BytesPerLine /RGBData BPL HD mul string def @@ -1230,12 +1226,12 @@ ifelse XH 12 IMLRTB RGBDProc false [1 0] [0 1 0 1 0 1] 2 DoImage3 XI 12 IMLRTB RGBDFile false [1 0] [0 1 0 1 0 1] 2 DoImage3 RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % InterleaveType 2, BPC==4, WM=WD, HM=HD /YY YF def TX YY SY add moveto (\nIntType 2\nBPC=4) blockshow - + % Generate the Data Image (uses the MaskData) /BPL WD 12 mul 7 add 8 div cvi WB add def % BytesPerLine /RGBData BPL HD mul string def @@ -1270,7 +1266,7 @@ ifelse % RGB Image Data must be chunky (MultipleDatasources==false). /YY YG def TX YY SY add moveto (\nIntType 2\nBPC=8\nWM=.6*WD\nHM=HD/2) blockshow - + % Generate the MaskData first /WM WD .6 mul cvi def /HM HD 2 div cvi def @@ -1297,7 +1293,7 @@ ifelse %DEBUG /xx (xx) (w) file def %DEBUG 0 1 HM 1 sub { MaskData exch WB mul WB getinterval xx exch writehexstring xx (\n) writestring } for %DEBUG xx (----------------------------------------------------------------\n) writestring -%DEBUG 0 2 HD 1 sub { +%DEBUG 0 2 HD 1 sub { %DEBUG RGBData 1 index BPL mul 2 index 2 div cvi WB mul add %DEBUG WB getinterval xx exch writehexstring xx (\n) writestring %DEBUG RGBData 1 index BPL mul 2 index 2 div cvi 1 add WB mul add @@ -1328,7 +1324,7 @@ ifelse % RGB Image Data must be chunky (MultipleDatasources==false). /YY YH def TX YY SY add moveto (\nIntType 2\nBPC=8\nWM=1.3*WD\nHM=2*HD) blockshow - + % Generate the MaskData first /WM WD 1.3 mul cvi def /HM HD 2 mul def @@ -1366,7 +1362,7 @@ ifelse % InterleaveType 2, BPC==12, WM=1.3*WD, HM=2*HD /YY YI def TX YY SY add moveto (\nIntType 2\nBPC=12\nWM=1.3*WD\nHM=2*HD) blockshow - + % Generate the Data Image (uses the MaskData) /HR HM HD div cvi def /BPL WD 36 mul 7 add 8 div cvi WB HR mul add def % BytesPerLine @@ -1395,12 +1391,12 @@ ifelse XH 12 IMLRTB RGBDProc false [1 0] [0 1 0 1 0 1] 2 DoImage3 XI 12 IMLRTB RGBDFile false [1 0] [0 1 0 1 0 1] 2 DoImage3 RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % InterleaveType 2, BPC==4, WM=1.3*WD, HM=2*HD /YY YJ def TX YY SY add moveto (\nIntType 2\nBPC=4\nWM=1.3*WD\nHM=2*HD) blockshow - + % Generate the Data Image (uses the MaskData) /HR HM HD div cvi def /BPL WD 12 mul 7 add 8 div cvi WB HR mul add def % BytesPerLine @@ -1452,7 +1448,7 @@ ifelse % RGB Image Data chunky (MultipleDatasources==false). /YY YA def TX YY SY add moveto (BPC=8\nMulti\nfalse) blockshow - + % Generate the MaskData first /WM WD def /HM HD def @@ -1478,20 +1474,20 @@ ifelse XI 8 IMLRTB [ MaskDFile RGBDFile ] false [1 0] [0 1 0 1 0 1] 3 DoImage3 MaskData (Mask) MDF CheckFileTail % Check that the correct amount of data was consumed RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % InterleaveType 3, BPC==12, WM=WD, HM=HD /YY YB def TX YY SY add moveto (BPC=12\nMulti\nfalse) blockshow - + /RGBData WD 36 mul 7 add 8 div cvi HD mul string def - { + { X 36 mul 8 div Y WD 36 mul 7 add 8 div cvi mul add RGBData 1 index R put12bit RGBData 1 index 1.5 add G put12bit RGBData exch 3 add B put12bit } ImageGen - + % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 - XA 12 IMLRTB [ MaskData RGBData ] false [0 1] [1 0 1 0 1 0] 3 DoImage3 XB 12 IMLRTB [ MaskData RGBData ] false [1 0] [1 0 1 0 1 0] 3 DoImage3 @@ -1504,20 +1500,20 @@ ifelse XI 12 IMLRTB [ MaskDFile RGBDFile ] false [1 0] [0 1 0 1 0 1] 3 DoImage3 MaskData (Mask) MDF CheckFileTail % Check that the correct amount of data was consumed RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % InterleaveType 3, BPC==4, WM=WD, HM=HD /YY YC def TX YY SY add moveto (BPC=4\nMulti\nfalse) blockshow - + /RGBData WD 12 mul 7 add 8 div cvi HD mul string def - { + { X 12 mul 8 div Y WD 12 mul 7 add 8 div cvi mul add RGBData 1 index R put4bit RGBData 1 index 0.5 add G put4bit RGBData exch 1.0 add B put4bit } ImageGen - + % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 - XA 4 IMLRTB [ MaskData RGBData ] false [0 1] [1 0 1 0 1 0] 3 DoImage3 XB 4 IMLRTB [ MaskData RGBData ] false [1 0] [1 0 1 0 1 0] 3 DoImage3 @@ -1530,27 +1526,27 @@ ifelse XI 4 IMLRTB [ MaskDFile RGBDFile ] false [1 0] [0 1 0 1 0 1] 3 DoImage3 MaskData (Mask) MDF CheckFileTail % Check that the correct amount of data was consumed RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % InterleaveType 3, BPC==8, WM=WD, HM=HD % IT 3 is line interleave -- Mask and Data in separate sources % RGB Image Data seprate (MultipleDatasources==true). /YY YA def TX YY SY add moveto (BPC=8\nMulti\ntrue) blockshow - + % Generate the MaskData first MaskGen % Generate the Data Image WD HD mul /RData 1 index string def /GData 1 index string def - /BData exch string def - { X Y WD mul add + /BData exch string def + { X Y WD mul add RData 1 index R 255 mul cvi put GData 1 index G 255 mul cvi put BData exch B 255 mul cvi put } ImageGen - + % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 - XA 8 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3 XB 8 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3 @@ -1565,7 +1561,6 @@ ifelse RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed - % ---------------------------------------------------------------------- % InterleaveType 3, BPC==8, WM=WD, HM=HD @@ -1573,20 +1568,20 @@ ifelse % RGB Image Data seprate (MultipleDatasources==true). /YY YD def TX YY SY add moveto (BPC=8\nMulti\ntrue) blockshow - + % Generate the MaskData first MaskGen % Generate the Data Image WD HD mul /RData 1 index string def /GData 1 index string def - /BData exch string def - { X Y WD mul add + /BData exch string def + { X Y WD mul add RData 1 index R 255 mul cvi put GData 1 index G 255 mul cvi put BData exch B 255 mul cvi put } ImageGen - + % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 - XA 8 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3 XB 8 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3 @@ -1601,22 +1596,22 @@ ifelse RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % InterleaveType 3, BPC==12, WM=WD, HM=HD /YY YE def TX YY SY add moveto (BPC=12\nMulti\ntrue) blockshow - + WD 3 mul 1 add 2 div cvi HD mul /RData 1 index string def /GData 1 index string def - /BData exch string def - { + /BData exch string def + { X 3 mul 2 div Y WD 3 mul 1 add 2 div cvi mul add RData 1 index R put12bit GData 1 index G put12bit BData exch B put12bit } ImageGen - + % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 - XA 12 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3 XB 12 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3 @@ -1631,23 +1626,22 @@ ifelse RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % InterleaveType 3, BPC==4, WM=WD, HM=HD /YY YF def TX YY SY add moveto (BPC=4\nMulti\ntrue) blockshow - + WD 1 add 2 div cvi HD mul /RData 1 index string def /GData 1 index string def - /BData exch string def - { + /BData exch string def + { X 2 div Y WD 1 add 2 div cvi mul add RData 1 index R put4bit GData 1 index G put4bit BData exch B put4bit } ImageGen - - + % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 - XA 4 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3 XB 4 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3 @@ -1662,7 +1656,7 @@ ifelse RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % InterleaveType 3, BPC==8, WM=.9*WD, HM=1.1*HD % IT 3 is line interleave -- Mask and Data in separate sources @@ -1678,13 +1672,13 @@ ifelse % Generate the Data Image WD HD mul /RData 1 index string def /GData 1 index string def - /BData exch string def - { X Y WD mul add + /BData exch string def + { X Y WD mul add RData 1 index R 255 mul cvi put GData 1 index G 255 mul cvi put BData exch B 255 mul cvi put } ImageGen - + % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 - XA 8 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3 XB 8 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3 @@ -1699,22 +1693,22 @@ ifelse RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % InterleaveType 3, BPC==12, WM=WD, HM=HD /YY YI def TX YY SY add moveto (BPC=12\nMulti\ntrue\nWM=.9*WD\nHM=1.1*HD) blockshow - + WD 3 mul 1 add 2 div cvi HD mul /RData 1 index string def /GData 1 index string def - /BData exch string def - { + /BData exch string def + { X 3 mul 2 div Y WD 3 mul 1 add 2 div cvi mul add RData 1 index R put12bit GData 1 index G put12bit BData exch B put12bit } ImageGen - + % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 - XA 12 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3 XB 12 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3 @@ -1729,23 +1723,22 @@ ifelse RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % InterleaveType 3, BPC==4, WM=WD, HM=HD /YY YJ def TX YY SY add moveto (BPC=4\nMulti\ntrue\nWM=.9*WD\nHM=1.1*HD) blockshow - + WD 1 add 2 div cvi HD mul /RData 1 index string def /GData 1 index string def - /BData exch string def - { + /BData exch string def + { X 2 div Y WD 1 add 2 div cvi mul add RData 1 index R put4bit GData 1 index G put4bit BData exch B put4bit } ImageGen - - + % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 - XA 4 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3 XB 4 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3 @@ -1760,7 +1753,7 @@ ifelse RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed - + % ---------------------------------------------------------------------- % InterleaveType 3, BPC==8, WM=1.1*WD, HM=.9*HD % IT 3 is line interleave -- Mask and Data in separate sources @@ -1776,13 +1769,13 @@ ifelse % Generate the Data Image WD HD mul /RData 1 index string def /GData 1 index string def - /BData exch string def - { X Y WD mul add + /BData exch string def + { X Y WD mul add RData 1 index R 255 mul cvi put GData 1 index G 255 mul cvi put BData exch B 255 mul cvi put } ImageGen - + % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 - XA 8 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3 XB 8 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3 @@ -1797,11 +1790,10 @@ ifelse RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed - + showpage } bind def % T3Tests - % ---------------------------------------------------------------------- % Do the various rotations % diff --git a/Master/tlpkg/tlgs/lib/impath.ps b/Master/tlpkg/tlgs/lib/impath.ps index 832a9d8678c..5ecf0ab9b4a 100644 --- a/Master/tlpkg/tlgs/lib/impath.ps +++ b/Master/tlpkg/tlgs/lib/impath.ps @@ -1,19 +1,19 @@ % Copyright (C) 1992, 1996 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: impath.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % impath.ps % Reverse-rasterize a bitmap to produce a Type 1 outline. % (This was formerly a Ghostscript operator implemented in C.) @@ -92,8 +92,8 @@ begin { % Convert curve to relative form x y 3 { exch neg 7 index add rc - exch neg 6 index add rc - 8 -2 roll + 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 @@ -101,10 +101,10 @@ begin } { dup 0 eq 6 index 0 eq and % dx1=dy3=0, vh { 6 -1 roll pop pop /vhcurveto - } - { /rrcurveto % none of the above - } - ifelse + } + { /rrcurveto % none of the above + } + ifelse } ifelse } @@ -117,7 +117,7 @@ end % type1imagepath_dict % The main program /type1imagepath % image width height wx wy ox oy string -> - % substring + % substring { type1imagepath_dict begin /tsave save def /ostring exch def diff --git a/Master/tlpkg/tlgs/lib/jispaper.ps b/Master/tlpkg/tlgs/lib/jispaper.ps index b6b9e44a62d..e524d8c8e30 100644 --- a/Master/tlpkg/tlgs/lib/jispaper.ps +++ b/Master/tlpkg/tlgs/lib/jispaper.ps @@ -1,19 +1,19 @@ % Copyright (C) 1999 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: jispaper.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Select JIS B paper sizes for b0...b6. userdict begin diff --git a/Master/tlpkg/tlgs/lib/jobseparator.ps b/Master/tlpkg/tlgs/lib/jobseparator.ps index 43fc63329ff..e9816be199d 100644 --- a/Master/tlpkg/tlgs/lib/jobseparator.ps +++ b/Master/tlpkg/tlgs/lib/jobseparator.ps @@ -1,4 +1,4 @@ % Execute the "real" system version of the ^D to separate jobs % when -dJOBDSERVER is being used. -% $Id: jobseparator.ps 8022 2007-06-05 22:23:38Z giles $ +% $Id$ <04> cvn .systemvar exec diff --git a/Master/tlpkg/tlgs/lib/landscap.ps b/Master/tlpkg/tlgs/lib/landscap.ps index 16f453ea443..6d8aff8dc1d 100644 --- a/Master/tlpkg/tlgs/lib/landscap.ps +++ b/Master/tlpkg/tlgs/lib/landscap.ps @@ -1,21 +1,21 @@ %! % landscap.ps % -% This file can be prepended to most PostScript pages to force +% This file can be prepended to most PostScript pages to force % rotation to "landscape" mode. % % There are (at least) four possible ways to reasonably position a % page after rotation. Any of the four old corners (llx,lly e.g.) % can be moved to match the corresonding new corner. -% By uncommmenting the appropriate line below (i.e., remove the +% By uncommmenting the appropriate line below (i.e., remove the % leading '%'), any such positioning can be chosen for positive or % negative rotation. The comments at the end of each "rotate" line % indicate the ORIGINAL corner to be aligned. For example, as given -% below, the lower left hand corner is aligned. When viewed, this +% below, the lower left hand corner is aligned. When viewed, this % corner will have moved to the urx,lly corner. % % originally by James E. Burns, 3/8/93, burns@nova.bellcore.com -% $Id: landscap.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % gsave clippath pathbbox grestore 4 dict begin diff --git a/Master/tlpkg/tlgs/lib/level1.ps b/Master/tlpkg/tlgs/lib/level1.ps index 07109b167b6..bb8adf517ca 100644 --- a/Master/tlpkg/tlgs/lib/level1.ps +++ b/Master/tlpkg/tlgs/lib/level1.ps @@ -1,3 +1,3 @@ %! -% $Id: level1.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ /.setlanguagelevel where { pop 1 .setlanguagelevel } if diff --git a/Master/tlpkg/tlgs/lib/lines.ps b/Master/tlpkg/tlgs/lib/lines.ps index 57e0380c786..bf05136f394 100644 --- a/Master/tlpkg/tlgs/lib/lines.ps +++ b/Master/tlpkg/tlgs/lib/lines.ps @@ -1,20 +1,20 @@ %! % Copyright (C) 1989, 1990, 1992, 1994, 1996 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: lines.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Test line rendering (stroke). % Exercise the miter limit. The left column of lines should bevel at @@ -55,14 +55,14 @@ gsave {0 1 2} % line join { setlinejoin gsave { {currentpoint lineto} - {3 7 lineto} - {3 7 lineto 5 1 lineto} - {3 7 lineto 6 3 lineto closepath} + {3 7 lineto} + {3 7 lineto 5 1 lineto} + {3 7 lineto 6 3 lineto closepath} } { gsave 0 0 moveto exec gsave stroke grestore - 0.5 setlinewidth 1 0 0 setrgbcolor stroke - grestore 8 0 translate + 0.5 setlinewidth 1 0 0 setrgbcolor stroke + grestore 8 0 translate } forall grestore 35 0 translate } forall @@ -141,7 +141,7 @@ gsave { newpath gsave gsave 0.5 setgray 0 0 rad 0 360 arc stroke grestore 0 90 359 - { rotate + { rotate 0 3 14 { ray } for 15 15 89 { ray } for } for diff --git a/Master/tlpkg/tlgs/lib/markhint.ps b/Master/tlpkg/tlgs/lib/markhint.ps index c494d8e3749..f764c93e97f 100644 --- a/Master/tlpkg/tlgs/lib/markhint.ps +++ b/Master/tlpkg/tlgs/lib/markhint.ps @@ -1,19 +1,19 @@ % Copyright (C) 1994, 1995, 1996 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: markhint.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % markhint.ps % Draw the hints for a Type 1 font. @@ -83,9 +83,9 @@ /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 + mhprint { (replace) = } if + % We're replacing hints; lighten the color. + currentrgbcolor 3 { 2 mul 3 div 3 1 roll } repeat setrgbcolor } { { pop } repeat } ifelse diff --git a/Master/tlpkg/tlgs/lib/markpath.ps b/Master/tlpkg/tlgs/lib/markpath.ps index f492352c9f0..a218211a4c9 100644 --- a/Master/tlpkg/tlgs/lib/markpath.ps +++ b/Master/tlpkg/tlgs/lib/markpath.ps @@ -1,19 +1,19 @@ % Copyright (C) 1993 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: markpath.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % markpath.ps % Mark the corners of a path, drawing it slowly if desired. @@ -50,7 +50,7 @@ } def /markpath % <matrix> markpath - - { /mpmx exch def + { /mpmx exch def gsave initgraphics 9 dup dtransform grestore /epsy exch def /epsx exch def gsave 0 setlinewidth diff --git a/Master/tlpkg/tlgs/lib/mkcidfm.ps b/Master/tlpkg/tlgs/lib/mkcidfm.ps index 718d8c4ea44..2a54a462072 100644 --- a/Master/tlpkg/tlgs/lib/mkcidfm.ps +++ b/Master/tlpkg/tlgs/lib/mkcidfm.ps @@ -1,23 +1,23 @@ % Copyright (C) 2004 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: mkcidfm.ps 8022 2007-06-05 22:23:38Z giles $ +% $Id$ -% Generate a cidfmap file for substituting CID fonts with TrueType +% Generate a cidfmap file for substituting CID fonts with TrueType % fonts, based on fonts found in the directory FONTDIR. -% +% % The directory FONTDIR is searched for fonts whose filename % matches a Path in the cidsubs dictionary. % Any matches are written out as a CID font substitution. @@ -26,18 +26,19 @@ % write out each alias that matches a substituted font. % Where multiple aliases are possible, use the first match. % -% Note that the substitutions and aliases in this file were created -% by someone who doesn't understand Chinese, Japanese or Korean. +% Note that the substitutions and aliases in this file were created +% by someone who doesn't understand Chinese, Japanese or Korean. % The initial list contains only font files found in Windows XP. % Please submit corrections and additions. % -% Font filenames must match case. +% See the end of file for references and further information. +% +% Font filenames must match case. % All font filenames are currently lower case. % % Usage: gswin32c -q -dBATCH -sFONTDIR=c:/windows/fonts % -sCIDFMAP=c:/gs/cidfmap mkcidfm.ps - systemdict /FONTDIR known not { /FONTDIR (c:/windows/fonts) def } if systemdict /CIDFMAP known { CIDFMAP } { (%stdout) } ifelse @@ -50,35 +51,50 @@ systemdict /CIDFMAP known { CIDFMAP } { (%stdout) } ifelse % The first matching substitution in the array will be used. /fontaliases << + % otf's /AdobeMingStd-Light /AdobeHeitiStd-Regular /AdobeSongStd-Light + % /KozMinPr6N-Regular /AdobeMyungjoStd-Medium came with Acroread 9 unix CJK pack. + + % ArialUnicode and a common font are used as a last-resort catch-all + % in most cases. + % Traditional Chinese - /MSung-Light [ /MingLiU ] - /MSung-Medium [ /MingLiU ] - /MHei-Medium [ /MingLiU ] - /MKai-Medium [ /Arial-Unicode-MS /MingLiU ] + % Mingliu and Kaiu are known to use patented TT instructions + /MSung-Light [ /MingLiU /ArialUnicodeMS-CNS ] + /MSung-Medium [ /MingLiU /ArialUnicodeMS-CNS ] + /MHei-Medium [ /MicrosoftJhengHeiRegular /ArialUnicodeMS-CNS /MingLiU ] + /MKai-Medium [ /DFKaiShu-SB-Estd-BF /Arial-Unicode-MS /MingLiU /ArialUnicodeMS-CNS ] + /AdobeMingStd-Light [ /MingLiU /ArialUnicodeMS-CNS ] % Simplified Chinese - /STSong-Light [ /SimSun ] - /STFangsong-Light [ /SimSun ] - /STHeiti-Regular [ /SimHei ] - /STKaiti-Regular [ /SimHei ] + /STSong-Light [ /SimSun /SimSun-18030 /ArialUnicodeMS-GB ] + /STFangsong-Light [ /FangSong /SimSun /ArialUnicodeMS-GB ] + /STHeiti-Regular [ /MicrosoftYaHei /SimHei /ArialUnicodeMS-GB ] + /STKaiti-Regular [ /KaiTi /SimHei /ArialUnicodeMS-GB ] + /AdobeHeitiStd-Regular [ /MicrosoftYaHei /SimHei /ArialUnicodeMS-GB ] + /AdobeSongStd-Light [ /SimSun /ArialUnicodeMS-GB ] % Japanese - /Ryumin-Light [ /MS-Mincho ] - /Ryumin-Medium [ /MS-Mincho ] - /GothicBBB-Medium [ /MS-Gothic ] - /HeiseiMin-W3 [ /MS-Mincho ] - /HeiseiKakuGo-W5 [ /MS-Gothic ] + /Ryumin-Light [ /MS-Mincho04 /MS-Mincho /ArialUnicodeMS-JP ] + /Ryumin-Medium [ /MS-Mincho04 /MS-Mincho /ArialUnicodeMS-JP ] + /GothicBBB-Medium [ /MS-Gothic04 /MS-Gothic /Meiryo /ArialUnicodeMS-JP ] + /HeiseiMin-W3 [ /MS-Mincho04 /MS-Mincho /ArialUnicodeMS-JP ] + /HeiseiKakuGo-W5 [ /MS-Gothic04 /MS-Gothic /Meiryo /ArialUnicodeMS-JP ] + /KozMinPr6N-Regular [ /MS-Mincho04 /MS-Mincho /ArialUnicodeMS-JP ] % Korean - /HYSMyeongJo-Medium [ /Batang ] - /HYRGoThic-Medium [ /Gulim ] - /HYGoThic-Medium [ /Dotum ] + % Malgun seems to have a full set of Hangu but not much of Kanji glyphs + % "Gulim Old Hangul Jamo" has Hangu but no Kanji, and PMmy has Kanji but + % no Hangu. Neither are useful for Korean users. + /HYSMyeongJo-Medium [ /Batang /NewBatang /GulimChe /ArialUnicodeMS-KR /MalgunGothicRegular ] + /HYRGoThic-Medium [ /Gulim /NewGulim /GulimChe /ArialUnicodeMS-KR /MalgunGothicRegular ] + /HYGoThic-Medium [ /Dotum /NewGulim /GulimChe /ArialUnicodeMS-KR /MalgunGothicRegular ] + /AdobeMyungjoStd-Medium [ /Batang /NewBatang /GulimChe /ArialUnicodeMS-KR /MalgunGothicRegular ] >> def - % This dictionary contains a list of CID substitutions -/cidsubs +% Many ttc's have an older ttf version - be sure to put the ttf entries later. +/cidsubs << % Simplified Chinese /SimHei @@ -105,6 +121,102 @@ def /CSI [(GB1) 2] >> + /SimSun-oldttf + << + /FileType /TrueType + /Path (simsun.ttf) + /SubfontID 0 + /CSI [(GB1) 2] + >> + + /KaiTi + << + /FileType /TrueType + /Path (simkai.ttf) + /SubfontID 0 + /CSI [(GB1) 2] + >> + + /LiSu + << + /FileType /TrueType + /Path (simli.ttf) + /SubfontID 0 + /CSI [(GB1) 2] + >> + + /SimSun-18030 + << + /FileType /TrueType + /Path (simsun18030.ttc) + /SubfontID 0 + /CSI [(GB1) 2] + >> + + /NSimSun-18030 + << + /FileType /TrueType + /Path (simsun18030.ttc) + /SubfontID 1 + /CSI [(GB1) 2] + >> + + /YouYuan + << + /FileType /TrueType + /Path (simyou.ttf) + /SubfontID 0 + /CSI [(GB1) 2] + >> + + /FangSong + << + /FileType /TrueType + /Path (simfang.ttf) + /SubfontID 0 + /CSI [(GB1) 2] + >> + + /MicrosoftYaHei + << + /FileType /TrueType + /Path (msyh.ttf) + /SubfontID 0 + /CSI [(GB1) 2] + >> + + /MicrosoftYaHeiBold + << + /FileType /TrueType + /Path (msyhbd.ttf) + /SubfontID 0 + /CSI [(GB1) 2] + >> + + /MS-Song + << + /FileType /TrueType + /Path (mssong.ttf) + /SubfontID 0 + /CSI [(GB1) 2] + >> + + /MS-Hei + << + /FileType /TrueType + /Path (mshei.ttf) + /SubfontID 0 + /CSI [(GB1) 2] + >> + + /ArialUnicodeMS-GB + << + /FileType /TrueType + /Path (arialuni.ttf) + /SubfontID 0 + /CSI [(GB1) 2] + >> + % Traditional Chinese /MingLiU << @@ -122,6 +234,7 @@ def /CSI [(CNS1) 2] >> + % It probably should be ttf (ttc a typo), but we'll keep this entry just in case. /Arial-Unicode-MS << /FileType /TrueType @@ -130,6 +243,46 @@ def /CSI [(CNS1) 2] >> + /MicrosoftJhengHeiRegular + << + /FileType /TrueType + /Path (msjh.ttf) + /SubfontID 0 + /CSI [(CNS1) 2] + >> + + /MicrosoftJhengHeiBold + << + /FileType /TrueType + /Path (msjhbd.ttf) + /SubfontID 0 + /CSI [(CNS1) 2] + >> + + /MingLiU-oldttf + << + /FileType /TrueType + /Path (mingliu.ttf) + /SubfontID 0 + /CSI [(CNS1) 2] + >> + + /DFKaiShu-SB-Estd-BF + << + /FileType /TrueType + /Path (kaiu.ttf) + /SubfontID 0 + /CSI [(CNS1) 2] + >> + + /ArialUnicodeMS-CNS + << + /FileType /TrueType + /Path (arialuni.ttf) + /SubfontID 0 + /CSI [(CNS1) 2] + >> + % Japanese /MS-Gothic << @@ -171,6 +324,104 @@ def /CSI [(Japan1) 3] >> + % An XP update ships the Vista (JIS2004) version of msgothic.ttc/msmincho.ttc renamed + /MS-Gothic04 + << + /FileType /TrueType + /Path (msgoth04.ttc) + /SubfontID 0 + /CSI [(Japan1) 3] + >> + + /MS-PGothic04 + << + /FileType /TrueType + /Path (msgoth04.ttc) + /SubfontID 1 + /CSI [(Japan1) 3] + >> + + /MS-UI-Gothic04 + << + /FileType /TrueType + /Path (msgoth04.ttc) + /SubfontID 2 + /CSI [(Japan1) 3] + >> + + /MS-Mincho04 + << + /FileType /TrueType + /Path (msmin04.ttc) + /SubfontID 0 + /CSI [(Japan1) 3] + >> + + /MS-PMincho04 + << + /FileType /TrueType + /Path (msmin04.ttc) + /SubfontID 1 + /CSI [(Japan1) 3] + >> + + /MS-Mincho-oldttf + << + /FileType /TrueType + /Path (msmincho.ttf) + /SubfontID 0 + /CSI [(Japan1) 3] + >> + + /MS-Gothic-oldttf + << + /FileType /TrueType + /Path (msgothic.ttf) + /SubfontID 0 + /CSI [(Japan1) 3] + >> + + % Newer meiryo.ttc and meiryob.ttc have subfont 2,3. Leave those out for the time being + /Meiryo + << + /FileType /TrueType + /Path (meiryo.ttc) + /SubfontID 0 + /CSI [(Japan1) 3] + >> + + /Meiryo-Italic + << + /FileType /TrueType + /Path (meiryo.ttc) + /SubfontID 1 + /CSI [(Japan1) 3] + >> + + /Meiryo-Bold + << + /FileType /TrueType + /Path (meiryob.ttc) + /SubfontID 0 + /CSI [(Japan1) 3] + >> + + /Meiryo-BoldItalic + << + /FileType /TrueType + /Path (meiryob.ttc) + /SubfontID 1 + /CSI [(Japan1) 3] + >> + + /ArialUnicodeMS-JP + << + /FileType /TrueType + /Path (arialuni.ttf) + /SubfontID 0 + /CSI [(Japan1) 3] + >> + % Korean /Batang << @@ -236,10 +487,56 @@ def /CSI [(Korea1) 3] >> + /MalgunGothicRegular + << + /FileType /TrueType + /Path (malgun.ttf) + /SubfontID 0 + /CSI [(Korea1) 3] + >> + + /MalgunGothicBold + << + /FileType /TrueType + /Path (malgunbd.ttf) + /SubfontID 0 + /CSI [(Korea1) 3] + >> + + /NewBatang + << + /FileType /TrueType + /Path (nbatang.ttf) + /SubfontID 0 + /CSI [(Korea1) 3] + >> + + /NewGulim + << + /FileType /TrueType + /Path (ngulim.ttf) + /SubfontID 0 + /CSI [(Korea1) 3] + >> + + /GulimChe-oldttf + << + /FileType /TrueType + /Path (gulimche.ttf) + /SubfontID 0 + /CSI [(Korea1) 3] + >> + + /ArialUnicodeMS-KR + << + /FileType /TrueType + /Path (arialuni.ttf) + /SubfontID 0 + /CSI [(Korea1) 3] + >> >> def - % A dictionary for storing the names and paths of found fonts /foundfonts 50 dict def @@ -253,11 +550,28 @@ def } loop } def +% Convert string (font file name) to lowercase, take care not to touch +% non-upper case letters. There are a few similiar routines elsewhere +% for reference: +% /.ToLower in lib/pdf2dsc.ps +% /toupper in lib/printafm.ps +% /.lowerstring in Resource/Init/gs_fonts.ps +/lowercase { + dup length 1 sub -1 0 { + 1 index exch 2 copy + get + dup dup 65 ge exch 90 le and { + 2#00100000 or + } if + put + } for +} def -% Check if a font basename matches one of the possible cid substitutions. +% Check if a font basename matches one of the possible cid substitutions. % If it does, add the font and full path to the foundfonts dictionary /checkfont { dup basename + lowercase cidsubs { /Path get @@ -283,19 +597,18 @@ def /checkfont load 256 string filenameforall } def - % Write out a cid substition, using the full font path % name is the font name, e.g. /MS-Mincho -% path is the full path to the font file, e.g. (c:\windows\fonts\msmincho.ps) +% path is the full path to the font file, e.g. (c:\windows\fonts\msmincho.ttc) % subs is the dictionary for CID font substition, from cidsubs -/emitsubs { % name path subs -- +/emitsubs { % name path subs -- 3 -1 roll cidfmap exch write==only % name cidfmap ( << ) writestring % path subs { 1 index /Path eq {pop 1 index} if % use full path, not basename - exch cidfmap exch write==only cidfmap ( ) writestring - cidfmap exch write==only cidfmap ( ) writestring + exch cidfmap exch write==only cidfmap ( ) writestring + cidfmap exch write==only cidfmap ( ) writestring } forall cidfmap (>> ;\n) writestring pop @@ -322,19 +635,19 @@ def % Write out aliases for which the cid substituted font exists. /writealiases { % -- cidfmap (\n% Aliases\n) writestring - fontaliases + fontaliases { % name aliasarray { % name alias foundfonts 1 index known { - 1 index cidfmap exch write==only cidfmap ( ) writestring - cidfmap exch write==only cidfmap ( ;\n) writestring - exit % after first match + 1 index cidfmap exch write==only cidfmap ( ) writestring + cidfmap exch write==only cidfmap ( ;\n) writestring + exit % after first match } { - pop % didn't find this name + pop % didn't find this name } ifelse } forall @@ -344,7 +657,6 @@ def forall } def - % Write out a new cidfmap file to stdout /writecidfmap { % path -- cidfmap (%!\n% cidfmap generated automatically by mkcidfm.ps from fonts found in\n) writestring @@ -355,5 +667,106 @@ def writealiases } def - FONTDIR writecidfmap + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% For what fonts ship with which microsoft product, see: +% http://www.microsoft.com/typography/Fonts/product.aspx +% +% A reasonably clean Vista box comes with: +% ARIALUNI.TTF meiryob.ttc msjh.ttf simhei.ttf +% batang.ttc meiryo.ttc msmincho.ttc simkai.ttf +% gulim.ttc mingliub.ttc MSMINCHO.TTF simsunb.ttf +% kaiu.ttf mingliu.ttc msyhbd.ttf simsun.ttc +% malgunbd.ttf msgothic.ttc msyh.ttf +% malgun.ttf msjhbd.ttf simfang.ttf +% +% Here is a non-exhaustive list of CJK fonts found on various MS systems for reference: +% File Size Version Glyphs Charmaps Postscript Name Codepage +% ====================================================================================================================== +% arialuni.ttf 24172892 0.86 51180 (1,0)(3,1) ArialUnicodeMS +% arialuni.ttf 23275812 1.01 50377 (3,1) ArialUnicodeMS 932,936,949,950 +% batang.ttc 16258580 2.21 39680 (3,1) Batang/BatangChe/Gungsuh/GungsuhChe +% batang.ttc 16265128 2.21 39680 (3,1) Batang/BatangChe/Gungsuh/GungsuhChe +% batang.ttc 16264732 5.00 39680 (3,1) Batang/BatangChe/Gungsuh/GungsuhChe 949 +% gulimche.ttf 5512432 1.00 20792 (3,1) GulimChe +% gulim.ttc 13518660 2.21 40194 (3,1) Gulim/GulimChe/Dotum/DotumChe +% gulim.ttc 13525204 2.21 40194 (3,1) Gulim/GulimChe/Dotum/DotumChe +% gulim.ttc 13524720 5.00 40194 (3,1) Gulim/GulimChe/Dotum/DotumChe 949 +% kaiu.ttf 4282984 2.00 18193 (1,0)(3,1) DFKaiShu-SB-Estd-BF +% kaiu.ttf 4279576 2.10 18193 (1,0)(3,1) DFKaiShu-SB-Estd-BF +% kaiu.ttf 5172084 3.00 22134 (1,0)(3,1) DFKaiShu-SB-Estd-BF +% kaiu.ttf 5178844 5.00 22134 (1,0)(3,1) DFKaiShu-SB-Estd-BF 950 +% malgun.ttf 4337480 0.85 12747 (0,3)(3,1) MalgunGothicRegular +% malgun.ttf 4337080 1.00 12747 (0,3)(3,1) MalgunGothicRegular +% malgun.ttf 4337104 5.00 12747 (0,3)(3,1) MalgunGothicRegular +% malgun.ttf 4337296 6.11 12747 (0,3)(3,1) MalgunGothicRegular 949 +% malgunbd.ttf 4514980 0.85 12740 (0,3)(3,1) MalgunGothicBold +% malgunbd.ttf 4513504 1.00 12740 (0,3)(3,1) MalgunGothicBold +% malgunbd.ttf 4513520 5.00 12740 (0,3)(3,1) MalgunGothicBold +% malgunbd.ttf 4515044 6.00 12740 (0,3)(3,1) MalgunGothicBold +% meiryo.ttc 7682568 0.97 20682 (0,3)(3,1)(3,10) Meiryo/Meiryo-Italic 932 +% meiryo.ttc 7815292 5.00 20684 (0,3)(3,1)(3,10) Meiryo/Meiryo-Italic +% meiryo.ttc 9533888 6.02 23942 (0,3)(3,1)(3,10) Meiryo/Meiryo-Italic/MeiryoUI/MeiryoUI-Italic +% meiryob.ttc 7924644 0.97 20682 (0,3)(3,1)(3,10) Meiryo-Bold/Meiryo-BoldItalic +% meiryob.ttc 8054096 5.00 20684 (0,3)(3,1)(3,10) Meiryo-Bold/Meiryo-BoldItalic +% meiryob.ttc 9749256 6.02 23942 (0,3)(3,1)(3,10) Meiryo-Bold/Meiryo-BoldItalic/MeiryoUI-Bold/MeiryoUI-BoldItalic +% mingliu.ttf 6272080 2.00 18362 (1,0)(3,1) MingLiU +% mingliu.ttc 8823308 3.21 22753 (1,0)(3,1) MingLiU/PMingLiU +% mingliu.ttc 8829856 3.21 22753 (1,0)(3,1) MingLiU/PMingLiU +% mingliu.ttc 27496184 6.02 33987 (3,1) MingLiU/PMingLiU/Ming-Lt-HKSCS-UNI-H +% mingliu.ttc 32217124 7.00 34046 (3,1) MingLiU/PMingLiU/Ming-Lt-HKSCS-UNI-H 950 +% mingliub.ttc 33791880 5.00 44857 (3,1)(3,10) MingLiU-ExtB/PMingLiU-ExtB/Ming-Lt-HKSCS-ExtB +% mingliub.ttc 33805700 7.00 44875 (3,1)(3,10) MingLiU-ExtB/PMingLiU-ExtB/Ming-Lt-HKSCS-ExtB +% msgothic.ttf 4170144 2.00 13104 (1,0)(3,1) MS-Gothic +% msgothic.ttc 8272028 2.30 20458 (1,0)(3,1) MS-Gothic/MS-PGothic/MS-UIGothic +% msgothic.ttc 8278584 2.30 20458 (1,0)(3,1) MS-Gothic/MS-PGothic/MS-UIGothic +% msgothic.ttc 9165480 5.00 22213 (3,1)(3,10) MS-Gothic/MS-PGothic/MS-UIGothic +% msgothic.ttc 9176636 5.01 22213 (3,1)(3,10) MS-Gothic/MS-PGothic/MS-UIGothic 932 +% mshei.ttf 1902464 1.00 26272 (1,0)(3,1) MS Hei +% mshei.ttf 1902556 1.00 26272 (1,0)(3,1) MS Hei +% msjh.ttf 14698792 0.71 28969 (0,3)(3,1) MicrosoftJhengHeiRegular 950 +% msjh.ttf 14713712 0.75 28969 (0,3)(3,1) MicrosoftJhengHeiRegular +% msjh.ttf 14713760 5.00 28969 (0,3)(3,1) MicrosoftJhengHeiRegular +% msjh.ttf 21663376 6.02 29220 (0,3)(3,1) MicrosoftJhengHeiRegular +% msjhbd.ttf 14498048 0.71 28961 (0,3)(3.1) MicrosoftJhengHeiBold +% msjhbd.ttf 14509708 0.75 28961 (0,3)(3.1) MicrosoftJhengHeiBold +% msjhbd.ttf 14509756 5.00 28961 (0,3)(3.1) MicrosoftJhengHeiBold +% msmincho.ttf 5151192 2.00 13104 (1,0)(3,1) MS-Mincho +% msmincho.ttc 9136456 2.30 17807 (1,0)(3,1) MS-Mincho/MS-PMincho +% msmincho.ttc 9135960 2.31 17807 (1,0)(3,1) MS-Mincho/MS-PMincho +% msmincho.ttc 9142516 2.31 17807 (1,0)(3,1) MS-Mincho/MS-PMincho +% msmincho.ttc 10056872 5.00 19321 (3,1)(3,10) MS-Mincho/MS-PMincho +% msmincho.ttc 10057108 5.01 19321 (3,1)(3,10) MS-Mincho/MS-PMincho 932 +% mssong.ttf 2569040 1.00 26304 (1,0)(3,1) MS Song +% mssong.ttf 2569116 1.00 26304 (1,0)(3,1) MS Song +% msyh.ttf 12263452 6.01 22562 (0,3)(3,1)(3,10) MSYH +% msyh.ttf 15067744 0.71 29207 (0,3)(3,1)(3,10) MicrosoftYaHei +% msyh.ttf 15043584 0.75 29126 (0,3)(3,1)(3,10) MicrosoftYaHei +% msyh.ttf 15044440 5.00 29126 (0,3)(3,1)(3,10) MicrosoftYaHei +% msyh.ttf 21767952 6.02 29354 (0,3)(3,1) MicrosoftYaHei 936 +% msyhbd.ttf 14707012 0.71 29240 (0,3)(3,1)(3,10) MicrosoftYaHei +% msyhbd.ttf 14685876 5.00 29126 (0,3)(3,1)(3,10) MicrosoftYaHei +% nbatang.ttf 32472240 3.00 49636 (3,1) New Batang +% ngulim.ttf 8862844 2.00 23181 (3,1) New Gulim +% ngulim.ttf 25719724 3.10 49284 (3,1) New Gulim +% ogulim.ttf 830340 1.00 2921 (3,1) Gulim Old Hangul Jamo +% palmm.ttf 13816928 001.003 27560 (3,1) PMmy +% simfang.ttf 3996872 2.00 7580 (1,0)(3,1) FangSong_GB2312 +% simfang.ttf 10576012 5.01 28562 (3,1) FangSong 936 +% simhei.ttf 10044356 3.02 22021 (1,0)(3,1) SimHei +% simhei.ttf 10050868 3.02 22021 (1,0)(3,1) SimHei +% simhei.ttf 9751960 5.01 28562 (3,1) SimHei 936 +% simkai.ttf 4135804 2.00 7580 (1,0)(3,1) KaiTi_GB2312 +% simkai.ttf 11785184 5.01 28562 (3,1) KaiTi 936 +% simli.ttf 9317908 3.00 21992 (1,0)(3,1) LiSu +% simsun.ttc 10500792 3.03 22141 (1,0)(3,1) SimSun/NSimSun +% simsun.ttc 10507340 3.03 22141 (1,0)(3,1) SimSun/NSimSun +% simsun.ttc 13747080 5.00 28762 (1,0)(3,1) SimSun/NSimSun +% simsun.ttc 15323200 5.03 28762 (1,0)(3,1) SimSun/NSimSun 936 +% simsun18030.ttc 12642204 2.06 30533 (1,0)(3,1) SimSun-18030/NSimSun-18030 +% simsunb.ttf 15406216 0.90 42809 (1,0)(3,1)(3,10) SimSun-ExtB +% simsunb.ttf 15406288 5.00 42809 (1,0)(3,1)(3,10) SimSun-ExtB +% simyou.ttf 6794984 3.00 21991 (1,0)(3,1) YouYuan +% simyou.ttf 6788204 3.00 21991 (1,0)(3,1) YouYuan diff --git a/Master/tlpkg/tlgs/lib/opdfread.ps b/Master/tlpkg/tlgs/lib/opdfread.ps new file mode 100644 index 00000000000..f934f085134 --- /dev/null +++ b/Master/tlpkg/tlgs/lib/opdfread.ps @@ -0,0 +1,4594 @@ +%!PS-Adobe-2.0 +% +% Copyright (C) 2002 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. +% +% For more information about licensing, please refer to +% http://www.ghostscript.com/licensing/. For information on +% commercial licensing, go to http://www.artifex.com/licensing/ or +% contact Artifex Software, Inc., 101 Lucas Valley Road #110, +% San Rafael, CA 94903, U.S.A., +1(415)492-9861. + +% $Id: opdfread.ps 11951 2010-12-15 08:22:58Z ken $ +% pdfread.ps - A procset for interpreting an ordered PDF 1.3 file. + +% This module defines routines for interpreting a PDF file with +% a Postscript interpreter. To convert a PDF file into Postscript +% just pre-contcatenate this file. The PDF file must satisfy +% few constraints : +% +% 1. It must contain only Postscript level 2 objects encoded with +% the PDF 1.3 language. Higher PDF levels must be re-distilled +% with CompatibilityLevel=1.3 . +% +% 2. Objects must be ordered so that any resource be defined before +% its usage. +% +% 3. The PDF file must not include other PDF files. +% Consequently we have a single instance of the PDF reader. +% We use this fact to simplify binding of the routines. +% +% 4. The PDF root object must always have the object id 1. +% +% 5. Generations besides 0 are not allowed. +% +% 6. xref must appear after all objects. +% +% Assuming the currentfile isn't positionable. +% As a consequence, the reader fully ignores xref. + +% ====================== Error handler ======================= +% A general error handler prints an error to page. + +% +% See if our notification from ps2write is present. If it is +% then pick it up. Otherwise define it as false. Used to prevent +% use of setmatrix at start of each page. The DSC-compliant +% output from ps2write wraps pages in a save/restore, so we don't +% need the setmatrix, and it breaks use of psnup with the output. +% +currentdict /DSC_OPDFREAD known { + currentdict /DSC_OPDFREAD get +}{ + false +} ifelse + +10 dict begin % A dictionary for local binding + +% This switch used to control paeg independent values, like +% whether to use InitialMatrix in SetupPageView +% +/DSC_OPDFREAD exch def + +/this currentdict def +/y 720 def +/ebuf 200 string def + +/prnt { + 36 //this /y get moveto //ebuf cvs show + //this /y 2 copy get 12 sub put +} bind def + +/newline { + 36 //this /y get moveto + //this /y 2 copy get 12 sub put +} bind def + +errordict /handleerror +{ systemdict begin + $error begin + newerror + { (%%[ Error handled by opdfread.ps : ) print errorname //ebuf cvs print (; OffendingCommand: ) + print /command load //ebuf cvs print ( ]%%) = flush + /newerror false store vmstatus pop pop 0 ne + { grestoreall + } if + errorname (VMerror) ne + { showpage + } if + initgraphics + 0 720 moveto + errorname (VMerror) eq + { //this /ehsave known + { clear //this /ehsave get restore 2 vmreclaim + } if + vmstatus exch pop exch pop + } + /Courier 12 selectfont + { + (ERROR: ) //prnt exec errorname //prnt exec + (OFFENDING COMMAND: ) //prnt exec + /command load //prnt exec + $error /ostack known { + (%%[STACK:) = + (STACK:) //prnt exec + $error /ostack get aload length { + //newline exec + dup mark eq { + (-mark-) dup = show + } { + dup type /nametype eq { + dup xcheck not { + (/) show + (/) print + } if + } if + dup = //ebuf cvs show + } ifelse + } repeat + } if + } ifelse + (%%]%) = + //systemdict /showpage get exec + quit + } if + end + end +} bind readonly put + +end % A dictionary for local binding + + +50 dict begin + +% ===================== Debugging ========================================= + +/DefaultSwitch % <name> DefaultSwitch - +{ + dup where { + pop pop + } { + false def + } ifelse +} bind def + +/=string 256 string def + +/=only { + //=string cvs print +} bind def + +/HexDigits (0123456789ABCDEF) readonly def + +/PrintHex % <int> PrintHex - +{ 8 { + dup -28 bitshift //HexDigits exch 1 getinterval //=only exec + 4 bitshift + } repeat + pop +} bind def + +/PDFR_DEBUG DefaultSwitch +/PDFR_DUMP DefaultSwitch +/PDFR_STREAM DefaultSwitch +/TTFDEBUG DefaultSwitch +/RotatePages DefaultSwitch +/FitPages DefaultSwitch +/CenterPages DefaultSwitch +/SetPageSize DefaultSwitch + +/error % mark <object> .... error - +{ % A stub for a while. + counttomark 1 sub -1 0 { + index dup type /arraytype eq { == } { =only } ifelse + } for + () = + cleartomark + % Assuming ....Undefined is never defined. + % Use it to emit an error. + ....Undefined +} bind def + +//SetPageSize { + //RotatePages //FitPages or //CenterPages or{ + mark (/RotatePages, /FitPages and CenterPages are not allowed with /SetPageSize) //error exec + } if +} +{ + //FitPages //CenterPages and { + mark (CenterPages is not allowed with /FitPages) //error exec + } if +} +ifelse + +% ===================== Utilities ========================================= + +/knownget % <dict> <key> knownget <value> true + % <dict> <key> knownget false +{ + 2 copy known { + get true + } { + pop pop false + } ifelse +} bind def + +/IsUpper % <int> IsUpper <bool> +{ dup (A) 0 get ge exch (Z) 0 get le and +} bind def + +% Copy (recursive) packedarray|array to to global VM +% NOTE: a packedarray will be converted to non-packed (too bad) +/cpa2g { % <packedarray|array> cpa2g <packedarray|array> + dup length array % <src> <dest> + 0 1 2 index length 1 sub { + % <src> <dest> index + dup 3 index exch get cp2g + % <src> <dest> index <globalelement> + 3 copy put pop pop + } for + exch pop +} bind def + +% Copy (recursive) dict to to global VM +/cpd2g { + dup length dict exch { + cp2g 2 index 3 1 roll put + } forall +} bind def + +% Copy string to to global VM +/cps2g { % <string> cps2g <string> + dup length string copy +} bind def + +/cp2gprocs +<< /arraytype //cpa2g /dicttype //cpd2g /packedarraytype //cpa2g /stringtype //cps2g >> +def + +/cp2g { % <any> cp2g <any> + % where <any> is array | dict | string | packedarray + % NOTE: The object must be readable (not executeonly or noaccess) + dup gcheck not { + dup //cp2gprocs 1 index type + 2 copy known { + get currentglobal 3 1 roll true setglobal exec exch setglobal + % set the attributes appropriately (we must have 'read' access to get this far) + 1 index wcheck not { readonly } if + 1 index xcheck { cvx } if + exch pop % discard original (local) object + } { + pop pop % discard type + } ifelse + } if +} bind def + +% ===================== Work Data ========================================= + +/BlockBuffer 65535 string def % Make it big to load entire TrueType font +/PDFReader currentdict def +/ObjectRegistryMaxLength 50000 def +/ObjectRegistry 10 dict def +ObjectRegistry +begin + 0 ObjectRegistryMaxLength dict def +end +/CurrentObject null def +/DoneDocumentStructure false def +/GraphicState 20 dict begin + /InitialTextMatrix matrix def + /InitialMatrix matrix currentmatrix def +currentdict end def +/TempMatrix matrix def +/GraphicStateStack 20 array def +/GraphicStateStackPointer 0 def +/InitialTextMatrixStack 20 array def +/InitialTextMatrixStackPointer 0 def +/PDFColorSpaces 50 dict def +/InstalledFonts 50 dict def +/MacRomanEncodingInverse null def + +% We need some structures in local VM, put then into the userdict : +currentglobal false setglobal +userdict /PDFR_InitialGS gstate put +userdict /PDFR_Patterns 50 dict put +userdict /FuncDataReader 10 dict put +setglobal + +% ===================== Constants ========================================= + +% The ExtGState elements are composite, thus need to be copied to +% global VM (in case they aren't already global). +/InitialExtGState 20 dict begin + /BG2 currentblackgeneration cp2g def + /UCR2 currentundercolorremoval cp2g def + /TR2 currentglobal false setglobal [ currentcolortransfer ] exch setglobal cp2g def + /HT currenthalftone cp2g def +currentdict end readonly def + +/InitialGraphicState 20 dict begin + /FontSize 0 def + /CharacterSpacing 0 def + /TextLeading 0 def + /TextRenderingMode 0 def + /WordSpacing 0 def +currentdict end readonly def + +/SimpleColorSpaceNames 15 dict begin + /DeviceGray true def + /DeviceRGB true def + /DeviceCMYK true def +currentdict end readonly def + +/1_24_bitshift_1_sub 1 24 bitshift 1 sub def + +/ReadFontProcs 10 dict def % Will be filled below. + +/GetObject % <id> GetObject obj true + % <id> GetObject false +{ + dup ObjectRegistryMaxLength idiv + //PDFReader /ObjectRegistry get exch knownget { + exch knownget + } { + pop false + }ifelse +} bind def + +/PutObject % <id> <obj> PutObject +{ + 1 index ObjectRegistryMaxLength idiv % id obj oregnr + //PDFReader /ObjectRegistry get 1 index knownget { + % object already defined in Objectregistry + % id obj oregnr dict + exch pop % id obj dict + 3 1 roll put + }{ + % object not already defined in ObjectRegistry + % id obj oregnr + //PDFReader /ObjectRegistry get dup + begin % new Objectregistry entry: + 1 index ObjectRegistryMaxLength dict def + end + exch get % id obj dict + 3 1 roll put + }ifelse +} bind def + +% ===================== Reading PDF objects =============================== + +/Register % <DefaultDaemon> <id> <obj> Register - +{ + 1 index GetObject { + % d id obj e + dup xcheck { + 4 3 roll pop % id obj e + //PDFR_DEBUG { + (Have a daemon for ) print 2 index == + } if + %% We've got a definition daamon, execute it: + exec + } { + dup null ne { + mark (The object ) 4 index (is already defined : ) 4 index //error exec + } { + pop % d id obj + } ifelse + 3 2 roll % id obj d + %% Execute the default Daemon + exec + }ifelse + } { + % d id obj + 3 2 roll % id obj d + exec % execute the default deamon + }ifelse + PutObject +} bind def + +/IsRegistered % <id> GetRegistered <bool> +{ + GetObject { + null ne + } { + false + }ifelse +} bind def + +/GetRegistered % <id> GetRegistered <obj> +{ + dup GetObject not { + exch mark exch (Object ) exch ( isn't defined before needed (1).) //error exec + } if + % id obj + dup xcheck { + exch mark exch (Object ) exch ( isn't defined before needed (2).) //error exec + } { + dup null eq { + exch mark exch (Object ) exch ( isn't defined before needed (3).) //error exec + } if + exch pop % e + } ifelse +} bind def + +/StandardFontNames << + /Times-Roman true + /Helvetica true + /Courier true + /Symbol true + /Times-Bold true + /Helvetica-Bold true + /Courier-Bold true + /ZapfDingbats true + /Times-Italic true + /Helvetica-Oblique true + /Courier-Oblique true + /Times-BoldItalic true + /Helvetica-BoldOblique true + /Courier-BoldOblique true +>> def + +/CleanAllResources % - CleanAllResources - +{ //PDFR_DEBUG { + (CleanAllResources beg) = + } if + //PDFReader /ObjectRegistry get { + dup length 0 exch 1 exch 1 sub { % R i + 2 copy get dup xcheck { + % Don't clean a daemon. + pop pop + } { + dup null eq { + pop pop + } { + dup type /dicttype eq { /.Global known } { pop false } ifelse { + pop + } { + //PDFR_DEBUG { + (Dropping ) print dup = + } if + 1 index exch /DroppedObject put + } ifelse + } ifelse + } ifelse + } for + pop + }forall % Check each dictionary in the ObjectRegistry + FontDirectory length dict begin + FontDirectory { + pop + dup //StandardFontNames exch known not { + dup null def + } if + pop + } forall + currentdict + end { + pop + //PDFR_DEBUG { + (Undefining font ) print dup = + } if + undefinefont + } forall + //PDFR_DEBUG { + (CleanAllResources end) = + } if +} bind def + +/PrintReference % <array> PrintReference <array> +{ + //PDFR_DEBUG { + ({ ) print + dup { + =only ( ) print + } forall + ( }) = + } if +} bind def + +/R % <id> <gen> R <daemon> +{ % Make a reference daemon. + 0 ne { + exch mark exch (A referred object generation ) exch ( isn't 0.) //error exec + } if % id + [ % <id> proc <obj> + exch //GetRegistered /exec load + ] cvx + //PrintReference exec +} bind def + +/IsObjRef % <any> IsObjRef <bool> +{ + dup type /arraytype eq { + dup length 3 eq { + dup xcheck exch + dup 0 get type /integertype eq 3 2 roll and exch + dup 1 get //GetRegistered eq 3 2 roll and exch + 2 get /exec load eq and + } { + pop false + } ifelse + } { + pop false + } ifelse +} bind def + +/DoNothing +{ +} def + +/RunTypeDaemon % <id> <obj> RunTypeDaemon <id> <obj> +{ + dup type /dicttype eq { + dup /Type //knownget exec { + //PDFReader /TypeDaemons get exch + //knownget exec { + exec + } if + } if + } if +} bind def + +/obj % <id> <generation> obj <id> +{ + //PDFR_DEBUG { + (Defining ) print 1 index =only ( ) print dup =only ( obj) = + } if + 0 ne { + exch mark exch (An object generation ) exch ( isn't 0.) //error exec + } if +} bind def + +/endobj % <id> <obj> endobj - +{ + //PDFR_DEBUG { + (endobj ) = + } if + dup type /dicttype eq { + dup /.endobj_daemon //knownget exec { + //PDFR_DEBUG { (.endobj_daemon for ) print 2 index = } if + exec + } if + } if + dup type /dicttype eq { dup /ImmediateExec known } { false } ifelse { + pop pop + } { + //PDFR_DEBUG { + (Storing ) print 1 index = + } if + //RunTypeDaemon exec + //DoNothing 3 1 roll //Register exec + } ifelse +} bind def + +/StoreBlock % <buf> StoreBlock - +{ % Stores a (encoded) stream data block to the current object. + //PDFR_DEBUG { + (StoreBlock ) print //PDFReader /BlockCount get =only (, Length = ) print dup length = + } if + dup length string copy + //PDFReader /BlockCount get exch % i s + //PDFReader /CurrentObject get 3 1 roll % o i s + put % + //PDFReader /BlockCount get 1 add + //PDFReader exch /BlockCount exch put +} bind def + +/CheckLength % <val> CheckNumber <val> +{ dup type /integertype ne { + mark (Object length isn't an integer.) //error exec + } if +} bind def + +/ResolveD % <dict> <key> <check> ResolveD <value> +{ + 3 copy pop get % <> key {} e + dup //IsObjRef exec { + % We've got a reference daemon, execute it : + //PDFR_DEBUG { + (Resolving ) print //PrintReference exec + } if + exec % <> key {} val + exch exec % <> key val + } { + exch pop + } ifelse + dup 4 1 roll % val <> key val + put % val +} bind def + +/ResolveA % <array> <index> <check> ResolveA <value> +{ 2 index 2 index get + dup //IsObjRef exec { + exec + exch exec + 3 copy put + } { + exch pop + } ifelse + exch pop exch pop +} bind def + +/StoreStream % <id> <obj> StoreStream <id> <obj> +{ % Stores a (encoded) data stream copy to the current object. + dup //PDFReader exch /CurrentObject exch put % id obj + //PDFReader /BlockCount 0 put + dup /Length //CheckLength //ResolveD exec % id obj l + //PDFR_DEBUG { + (StoreStream Length = ) print dup = + } if + currentfile exch () /SubFileDecode filter % id obj file + { dup //BlockBuffer readstring { % id obj file buf + //StoreBlock exec + } { + //StoreBlock exec + exit + } ifelse % id obj file + } loop + pop % id obj + //PDFReader /CurrentObject null put + //PDFR_DEBUG { + (StoreStream end.) = + } if +} bind def + +/MakeStreamDumper % <file> MakeStreamDumper <file> +{ % Debug purpose only. + //PDFR_DEBUG { + (MakeStreamDumper beg.) = + } if + currentglobal exch dup gcheck setglobal + [ exch % f + 1 dict dup /c 0 put exch % d f + 1024 string % d f s + { readstring pop % d s + (StreamDumper ) print 1 index /c get =string cvs print ( ) print + dup length =string cvs print ( <) print dup print (>\n) print + dup length % d s l + 3 2 roll % s l d + dup /c get % s l d c + 3 2 roll % s d c l + add /c exch put % s + } /exec load + ] + cvx 0 () /SubFileDecode filter + exch setglobal + //PDFR_DEBUG { + (MakeStreamDumper end.) = + } if +} bind def + +/ShortFilterNames 15 dict begin + /AHx /ASCIIHexDecode def + /A85 /ASCII85Decode def + /LZW /LZWDecode def + /Fl /FlateDecode def + /RL /RunLengthDecode def + /CCF /CCITTFaxDecode def + /DCT /DCTDecode def +currentdict end readonly def + +/AppendFilters % <file> <dict> AppendFilters <file> +{ + //PDFR_DEBUG { + (AppendFilters beg.) = + } if + dup 3 1 roll % d f d + /Filter //knownget exec { % d f F + dup type /nametype eq { % d f /F + dup //ShortFilterNames exch //knownget exec { + exch pop + } if + 2 index /DecodeParms //knownget exec { % d f p /F + exch + } if + filter % d f' + } { % d f [] + dup 0 exch 1 exch length 1 sub { % d f [] i + 2 copy get % d f [] i /F + dup //ShortFilterNames exch //knownget exec { + exch pop + } if + 3 1 roll % d f /F [] i + 4 index /DecodeParms //knownget exec { % d f /F [] i DP + exch get % d f /F [] dp + } { % d f /F [] i + pop null % d f /F [] dp + } ifelse + dup null eq { % d f /F [] dp + pop 3 1 roll filter exch % d f' [] + } { % d f /F [] dp + 3 1 roll % d f dp /F [] + 4 1 roll filter exch % d f' [] + } ifelse + } for + pop % d f' + } ifelse + //PDFR_DEBUG //PDFR_DUMP and { + //MakeStreamDumper exec + } if + } if + exch pop + //PDFR_DEBUG { + (AppendFilters end.) = + } if +} bind def + +/ExecuteStream % <id> <obj> ExecuteStream <id> <obj> +{ % Executes a (encoded) data stream. + dup //PDFReader exch /CurrentObject exch put % id obj + dup /Length //CheckLength //ResolveD exec % id obj l + //PDFR_DEBUG { + (ExecuteStream id = ) print 2 index =only ( Length = ) print dup = + } if + //PDFReader /InitialGraphicState get + //PDFReader /GraphicState get copy pop + //PDFReader /Operators get begin + % currentfile exch () /SubFileDecode filter % id obj file + % We would like to use the code above, + % but HP LaserJet 1320 continues parsing after the byte count exceeds. + pop currentfile 0 (endstream) /SubFileDecode filter % id obj file + 1 index //AppendFilters exec + cvx mark exch % id obj mark file + exec + counttomark 0 ne { + mark (Data left on ostack after an immediate stream execution.) //error exec + } if + cleartomark % id obj + end % Operators + //PDFR_DEBUG { + (ExecuteStream end.) = + } if + //PDFReader /CurrentObject null put + dup /IsPage known { + dup /Context get /NumCopies //knownget exec { + 1 sub { + copypage + } repeat + } if + showpage + } if +} bind def + +/stream % <id> <obj> stream <id> <obj> +{ + //PDFR_DEBUG { + 1 index =only ( stream) = + } if % id obj + % Run the object definition daemon, if exists : + 1 index GetObject { + % id obj e + dup xcheck { + exec + % Disable the daemon : + 1 index null PutObject + } { + pop + } ifelse + }if + dup /ImmediateExec known { + dup /GlobalExec //knownget exec { + currentglobal 4 1 roll + setglobal + //ExecuteStream exec + 3 2 roll setglobal + } { + //ExecuteStream exec + } ifelse + } { + //StoreStream exec + } ifelse + dup /.CleanResources //knownget exec { + /All eq { + //CleanAllResources exec + } if + } if +} bind def + +/HookFont % <id> <obj> <font_descriptor> HookFont <id> <obj> +{ + //PDFR_DEBUG { + (Loaded the font ) print dup /FontName get = + } if + { + dup /FontFileType get dup /Type1 eq exch /MMType1 eq or { % id obj fd + % We assume that the Type 1 font has same name with no prefix + % due to pdfwrite specifics. + % We use it to find the font after it is defined. + % We could redefine 'definefont' for hooking the font, + % but we don't think that it could be guaranteedly portable : + % a 3d party PS interpreter may set a special context + % when running the font file. + % Note that this mechanizm does not depend on the + % font name uniquity, because the last 'definefont' + % is only important. + dup /FontName get % id obj fd fn + //PDFReader /RemoveFontNamePrefix get exec + findfont % id obj fd g f + exit + } if + dup /FontFileType get /TrueType eq { % id obj fd + //PDFReader /MakeType42 get exec + //PDFR_DEBUG { + (Font dict <<) = + dup { + 1 index /sfnts eq { + exch pop + (/sfnts [) print + { + (-string\() print length //=only exec (\)- ) = + } forall + (]) = + } { + exch //=only exec ( ) print == + } ifelse + } forall + (>>) = + } if + dup /FontName get exch definefont + exit + } if + mark (FontHook has no proc for ) 2 index /FontFileType get //error exec + } loop + /Font exch put % id obj +} bind def + +/endstream % <id> <obj> endstream <id> <obj> +{ +} bind def + +/xref % - xref - +{ + //PDFR_DEBUG { + (xref) = + //PDFR_DUMP { + //PDFReader /ObjectRegistry get == + } if + } if + end % The procset + count 0 ne { + mark (Excessive data on estack at the end of the interpretation.) //error exec + } if + currentfile 1 (%%EOF) /SubFileDecode filter + flushfile + cleardictstack +} bind def + +% ===================== Restoring the PDF Document Structure =============== + +/ResolveDict % <dict> /ResolveDict - +{ dup { % d key val + pop 1 index exch % d cp key + //DoNothing //ResolveD exec % d obj + pop % d + } forall + pop % +} bind def + +/SetupPageView % <obj> SetupPageView - +{ + //PDFR_DEBUG { + (SetupPageView beg) = + } if +//DSC_OPDFREAD not { + //GraphicState /InitialMatrix get setmatrix +} if + /MediaBox get aload pop % bx0 by0 bx1 by1 + 3 index neg 3 index neg translate % Temporary move to origin + 3 -1 roll sub 3 1 roll exch sub exch % bw bh + userdict /.HWMargins //knownget exec { + aload pop + } { + currentpagedevice /.HWMargins //knownget exec { + aload pop + } { + 0 0 0 0 + } ifelse + } ifelse + currentpagedevice /PageSize get aload pop + 3 -1 roll sub 3 1 roll exch sub exch % bw bh px0 py0 px1 py1 + exch 3 index sub exch 3 index sub % bw bh px0 py0 pw ph + //SetPageSize { + //PDFR_DEBUG { + (Setting page size to ) print 1 index //=only exec ( ) print dup = + } if + pop pop 3 index 3 index 2 copy % bw bh px0 py0 bw bh bw bh + currentglobal false setglobal 3 1 roll % bw bh px0 py0 bw bh bool bw bh + 2 array astore % bw bh px0 py0 bw bh bool [] + << exch /PageSize exch >> setpagedevice % bw bh px0 py0 bw bh bool + userdict /PDFR_InitialGS gstate put + setglobal % bw bh px0 py0 bw bh + } if + //RotatePages { + 2 copy gt 6 index 6 index gt ne { + % a rotation is useful except it fits with no rotation. + 1 index 5 index le 1 index 5 index le and not + } { + false + } ifelse + } { + false + } ifelse + { //CenterPages { + //PDFR_DEBUG { + (Rotating page, and then centering it) == + } if + 90 rotate + 0 5 index neg translate + 5 index 1 index exch sub 2 div + 2 index 6 index sub 2 div neg % bw bh px0 py0 pw ph lm bm + translate + } { + //FitPages { + 1 index 5 index div 1 index 7 index div % bw bh px0 py0 pw ph sx sy + 2 copy gt { + exch + } if + pop dup scale % bw bh px0 py0 pw ph + } if + 90 rotate + 0 5 index neg translate + } ifelse + } { + //CenterPages { + //PDFR_DEBUG { + (Ccentering page) == + } if + 1 index 6 index sub 2 div + 1 index 6 index sub 2 div % bw bh px0 py0 pw ph lm bm + translate + } { + //FitPages { + 1 index 6 index div 1 index 6 index div % bw bh px0 py0 pw ph sx sy + 2 copy gt { + exch + } if + pop dup scale % bw bh px0 py0 pw ph + } if + } ifelse + } ifelse + pop pop % bw bh px0 py0 + translate % bw bh + pop pop % + //PDFR_DEBUG { + (SetupPageView end) = + } if +} bind def + +/PageContentsDaemon % <id> <obj> <node> PageContentsDaemon <id> <obj> +{ % Note: an excessive operand from a prebond procedure. + //PDFR_DEBUG { + (Executing PageContentsDaemon for ) print 2 index = + } if % id obj node + 1 index exch /Context exch put % id obj + dup /ImmediateExec true put + dup /IsPage true put + dup /Context get //SetupPageView exec +} bind def + +/FontFileDaemon % <id> <obj> <font_descriptor> FontFileDaemon <id> <obj> +{ % Note: an excessive operand from a prebond procedure. + //PDFR_DEBUG { + (Executing FontFileDaemon for ) print 2 index = + } if + % We need any font resource that refers this descriptor + % to know the font type. Assuming that FontDescriptorDaemon + % provided FontFileType. + dup /FontFileType get % id obj fd ft + 2 index exch % id obj fd obj ft + dup //ReadFontProcs exch //knownget exec { % id obj fd obj ft proc + exch pop exec % id obj fd + } { + mark (FontFile reader for ) 2 index ( isn't implemented yet.) //error exec + } ifelse + //PDFR_DEBUG { + (FontFileDaemon end) = + } if % id obj fd + pop +} bind def + +/FontDescriptorDaemon % <id> <obj> <font_resource> FontDescriptorDaemon <id> <obj> +{ % Note: an excessive operand from a prebond procedure. + //PDFR_DEBUG { + (Executing FontDescriptorDaemon for ) print 2 index = + } if % id obj fr + %HACK BEG assuming an own font for each font descriptor + % to provide an access to PDFEncoding + % from MakeType42, ComposeCharStrings. + 2 copy /FontResource exch put + %HACK END + /Subtype get 1 index exch /FontFileType exch put +} bind def + +/UnPDFEscape { % <namepdf> UnPDFEscape <nameps> + dup dup length string cvs % /namepdf (name) + dup (#) search { + % name contains PDF-style escapes ("#hh") that need to be removed + { % ... (po..st) (#) (pre) + pop % ... (po..st) (#) + (16#--) 2 index 0 2 getinterval % ... (po..st) (#) (16#--) (po) + 1 index 3 2 getinterval copy pop % ... (po..st) (#) (16#po) + cvi % ... (po..st) (#) 16#po + 0 exch put % ... (po..st); 16#po patched into (#) + 0 % ... (po..st) 0 + 1 index 2 1 index length 2 sub getinterval % ... (po..st) 0 (..st) + 3 copy putinterval % ... (..stst) 0 (XXst) + length % ... (..stst) 0 LEN_OF_(po..st)-2 + 3 copy exch put % ... (..st\0t) 0 LEN_OF_(po..st)-2 + getinterval % ... (..st), stored at begining of old (po..st) + (#) search not { + pop exit % /namepdf (nameps\0..) + } if + } loop + % we have a '\0' marker (not allowed in PDF names) after all usefull characters + (\0) search pop exch pop exch pop + cvn + exch pop + } { + pop pop + } ifelse +} bind def + +/TypeDaemons << % <id> <obj> proc <id> <obj> + /Page + { //PDFR_DEBUG { + (Recognized a page.) = + } if + dup /Contents //knownget exec { % id obj c + 0 get //DoNothing exch % id obj dn id1 + [ % <id> <obj> proc <id> <obj> + 3 index //PageContentsDaemon /exec load + ] cvx % id obj {} + //Register exec % id obj + } { + (fixme: page with no Contents won't be printed.) = + } ifelse + } bind + /FontDescriptor + { //PDFR_DEBUG { + (Recognized a font descriptor.) = + } if + dup /FontName //knownget exec { + 1 index /FontName 3 -1 roll //UnPDFEscape exec put + } if + dup dup /FontFile known {/FontFile} {/FontFile2} ifelse + //knownget exec { % id obj ff + 0 get //DoNothing exch % id obj dn id1 + [ % <id> <obj> proc <id> <obj> + 3 index //FontFileDaemon /exec load + ] cvx % id obj {} + //Register exec % id obj + } { + % FontFile3 are not implemented yet. + (Font descriptor ) print 1 index =only ( has no FontFile.) = + } ifelse + } bind + /Font + { //PDFR_DEBUG { + (Recognized a font resource.) = + } if + dup /BaseFont //knownget exec { + //UnPDFEscape exec 2 copy /BaseFont exch put + % cache the installed font (if any) before replacing it. + //PDFReader /RemoveFontNamePrefix get exec + currentglobal exch % A hack against HP LaserJet 1320 bug : + % It sets the local allocation mode + % when 'resourcestatus' fails. + dup /Font resourcestatus { + pop pop + //PDFReader /GetInstalledFont get exec pop + } { + pop + } ifelse + setglobal + } if + dup /FontDescriptor //knownget exec { % id obj fd + 0 get % id obj id1 + dup //IsRegistered exec { % id obj id1 + //PDFR_DEBUG { + (already registered ) print dup = + } if + pop + } { + //DoNothing exch % id obj dn id1 + [ % <id> <obj> proc <id> <obj> + 3 index //FontDescriptorDaemon /exec load + ] cvx % id obj {} + //Register exec % id obj + } ifelse + } if + } bind +>> def + +/MakeStreamReader % <obj> MakeStreamReader <file> +{ dup + [ + exch + //PDFR_DEBUG { + (Stream proc ) + /print load + //PDFR_STREAM { + (<) + /print load + } if + } if + 1 dict dup /i -1 put + /dup load + /i + /get load + 1 + /add load + /dup load + 3 + 1 + /roll load + /i + /exch load + /put load + //knownget + /exec load + /not load + { () } + /if load + //PDFR_DEBUG { + //PDFR_STREAM { + /dup load + /print load + (>) + /print load + } if + ( end of stream proc.\n) + /print load + } if + ] cvx + //PDFR_DEBUG { + (Stream reader ) print dup == + } if + 0 () /SubFileDecode filter + exch //AppendFilters exec +} bind def + +/RunDelayedStream % <stream_obj> RunDelayedStream - +{ + % Save InitialTextMatrix, as this is local to each content stream + //GraphicState /InitialTextMatrix get + //InitialTextMatrixStack //PDFReader /InitialTextMatrixStackPointer get + 2 copy get null eq { + 2 copy currentglobal true setglobal matrix exch setglobal put + } if + get copy pop + //PDFReader /InitialTextMatrixStackPointer 2 copy get 1 add put + % Execute the stream + //MakeStreamReader exec % file + mark exch + cvx exec % + counttomark 0 ne { + mark (Data left on ostack after a delayed stream execution.) //error exec + } if + cleartomark + % Restore InitialTextMatrix + //PDFReader /InitialTextMatrixStackPointer 2 copy get 1 sub put + //InitialTextMatrixStack //PDFReader /InitialTextMatrixStackPointer get get + //GraphicState /InitialTextMatrix get + copy pop +} bind def + +% ===================== Font Management ====================== + +//ReadFontProcs begin + /Type1 % <font_descriptor> <FontFile_object> Type1 <font_descriptor> + { //PDFR_DEBUG { + (ReadFontProcs.Type1) = + } if + dup /.endobj_daemon [ 4 index //HookFont /exec load ] cvx put + dup /ImmediateExec true put + /GlobalExec true put + } bind def + /MMType1 //Type1 def + /TrueType % <font_descriptor> <FontFile_object> TrueType <font_descriptor> + { //PDFR_DEBUG { + (ReadFontProcs.TrueType) = + } if + dup /.endobj_daemon [ 4 index //HookFont /exec load ] cvx put + pop + } bind def +end + +% A working dictionary to hold items related to reading a TrueType font +% and converting into a type 42 font, especially regarding creating the sfnts +% array of strings, and ensuring strings are split on table boundaries and +% for the glyf table, on glyph boundaries. +% +/.opdloadttfontdict 50 dict def +.opdloadttfontdict begin + +/maxstring 65400 def % less than the maximum length of a PostScript string, + % must be a multiple of 4 (for hmtx / loca / vmtx) +end + +% Uses an insertion sort to sort the contents of an array, +% the sorted array is returned. Takes the array to sort and a +% comparison procedure. The comparison procedure must take two +% arguments, and return a boolean. The return value should be +% false if arguments incorrectly ordered, true if they are +% already in the correct order. +% +% [Array to sort] {comparisaon proc} InsertionSort [Sorted array] +% +/.InsertionSort +{ + /CompareProc exch def + /Array exch def + 1 1 Array length 1 sub + { + /Ix exch def + /Value1 Array Ix get def + + /Jx Ix 1 sub def + { + Jx 0 lt { + exit + } if + /Value2 Array Jx get def + Value1 Value2 CompareProc { + exit + } if + + Array Jx 1 add Value2 put + /Jx Jx 1 sub def + } loop + Array Jx 1 add Value1 put + } for + Array +} bind def + +% +% Utility rourtines to insert a TrueType data type +% +% <string> <index> <integer> putu16 - +/putu16 { + 3 copy -8 bitshift put + exch 1 add exch 16#ff and put +} bind def +% <string> <index> <integer> putu32 - +/putu32 { + 3 copy -16 bitshift putu16 + exch 2 add exch 16#ffff and putu16 +} bind def + +% +% Utility routines to read TrueType table data, returning +% either a string or an array of strings depending on the +% table length. +% + +% Read a table as a single string. +% <file> <length> .readtable <string> +/.readtable { + dup dup 1 and add string + % Stack: f len str + dup 0 4 -1 roll getinterval + % Stack: f str str1 + % Because of the absurd PostScript specification that gives an + % error for reading into an empty string, we have to check for + % this explicitly here. + 3 -1 roll exch + dup () ne { readstring } if pop pop +} bind def + +% Read a big table (one that may exceed 64K). +% <file> <length> .readbigtable <string[s]> +/.readbigtable { + dup maxstring lt { + .readtable + } { + currentuserparams /VMReclaim get -2 vmreclaim + [ 4 2 roll { + % Stack: mark ... f left + dup maxstring le { exit } if + 1 index maxstring string readstring pop 3 1 roll maxstring sub + } loop .readtable ] + exch vmreclaim + } ifelse +} bind def + +% ReadTTF reads the tables and so on from a TreuType font into memory +% so that they are available for later processing. +% +% <filename> ReadTTF - +% +/ReadTTF +{ + .opdloadttfontdict begin + /TTFontFile exch def + + % Table directory: + % version - fixed (4 bytes) + % numTables - USHORT (2 bytes) + % searchRange - USHORT (2 bytes) + % entrySelector - USHORT (2 bytes) + % Read Table + /TableDir TTFontFile 12 string readstring pop def + + % There are numTables table directory entries: + % tag - ULONG (4 bytes) + % checkSum - ULONG (4 bytes) + % offset - ULONG (4 bytes) + % length - ULONG (4 bytes) + % Read entries + /tables TTFontFile TableDir 4 getu16 16 mul string readstring pop def + + % Create dictionary to store directory entries. + /tabarray tables length 16 idiv array def + + % Check version for TrueType collection + TableDir 0 4 getinterval (ttcf) eq { + QUIET not { (Can't handle TrueType font Collections.) = } if + /.loadttfonttables cvx /invalidfont signalerror + } { + % There are ((length of tables string) / 16) Table directory entries + % Get and store each in turn + 0 16 tables length 1 sub { + % Get each directory entry as a 16-byte string + dup % index index + tables exch 16 getinterval % index (string) + exch 16 div cvi exch % index/16 (string) + tabarray 3 1 roll put + } for + } ifelse + + % We need the tables in the order they occur in the file, so sort + % by 'offset'. + tabarray { exch 8 getu32 exch 8 getu32 gt} .InsertionSort pop + + % Now we read the content of each table in turn. If the table is < 64K + % then we store it in a single string. If its more, we store it in an + % array of strings. The table contents are stored in 'tabs' in the same + % order as they are read from the file, as per the sorted array 'tabarray'. + /Read TableDir length tables length add def + /tabs [ + tabarray { + % Get offset (from start of file) of next table + dup 8 getu32 % () offset + % Subtract amount read so far + Read sub % () offset-Read + dup 0 gt { + % Read and discard any extra padding bytes % () offset-Read + dup string TTFontFile exch readstring pop pop % () offset-Read + % Update bytes read + Read add /Read exch def % () + } { + pop % () + } ifelse + % Find length of this table and add it to bytes read + 12 getu32 % () tablelength + dup Read add % () tablelength tablelength+Read + /Read exch def % () tablelength + TTFontFile exch .readbigtable + } forall + ] def + end % .opdloadttfontdict +} bind def + +% GetLocaType finds the head table in tabarray, which gives +% an index into the 'tabs' array where the data is stored. +% From that data we extract the loca type (short or long). +% +% - GetLocaType - +% +/GetLocaType +{ + 0 1 tabarray length 1 sub{ + % control-variable + dup tabarray exch get % control-variable () + 0 4 getinterval (head) eq{ % control-variable bool + tabs exch get % () + 50 gets16 + /LocaType exch def + exit + } { + pop % control variable % - + } ifelse + } for +} bind def + +% GetNumGlyphs finds the maxp table in tabarray, which gives +% an index into the 'tabs' array where the data is stored. +% From that data we extract the number of glyphs in the font. +% +% - GetNumGlyphs - +% +/GetNumGlyphs +{ + 0 1 tabarray length 1 sub{ + % control-variable + dup tabarray exch get % control-variable () + 0 4 getinterval (maxp) eq{ % control-variable bool + % Get the maxp string + % from the tabs array + tabs exch get % () + 4 getu16 % int + /NumGlyphs exch def + exit % int + } { + pop % control variable % - + } ifelse + } for +} bind def + +% StringtoLoca takes a string, and an index in to an array +% where the loca results should be stored from. It reads +% along the string getting either 2-byte or 4-byte values +% (depends on loca type) and stores them in the array at +% successive locations. Leaves the next unused location +% on the stack at end (easy to process multiple strings). +% +% string ArrayIndex StringToLoca ArrayIndex +% +/StringToLoca +{ + /LocaIndex exch def % () + /StringOffset 0 def % () + { + dup length StringOffset gt { % () + dup % () + LocaType 1 eq{ + StringOffset getu32 % () loca + LocaArray LocaIndex 3 -1 roll put % () + /LocaIndex LocaIndex 1 add def % () + /StringOffset StringOffset 4 add % () + def + } { + dup % () loca + StringOffset getu16 % () + LocaArray LocaIndex 3 -1 roll put % () + /LocaIndex LocaIndex 1 add def % () + /StringOffset StringOffset 4 add % () + def + } ifelse + }{ % () + pop % - + LocaIndex % return index + exit + }ifelse + } loop +} bind def + +% GetSortedLoca reads the loca table, and sorts it by offset +% this is so that we can walk up the array looking for an approporiate +% place to split strings. The result is stored in LocArray +% +% - GetSortedLoca - +% +/GetSortedLoca +{ + NumGlyphs 1 add array /LocaArray exch def + + % Get the loca table + 0 1 tabarray length 1 sub{ + % control-variable + dup tabarray exch get % control-variable () + 0 4 getinterval (loca) eq{ % control-variable bool + % Get the loca string + % from the tabs array + tabs exch get % () + exit + } { + pop % control variable % - + } ifelse + } for + + % If its a single string handle the easy way + dup type /stringtype eq { + 0 StringToLoca pop + }{ + % Otherwise its an array, process each string in the array + 0 exch % Starting LocaArray index + { + exch StringToLoca + }forall + pop % final LocaArray index + }ifelse + + % Now we've read all the locations, sort them so + % we can figure out where to break the strings + LocaArray {gt} .InsertionSort pop +} bind def + +% Updates internal storage with a new string from the +% GlyfArray +% - GetWorkingString - +/GetWorkingString +{ + WorkString 0 + GlyfArray GlyfStringIndex get + putinterval + % Update the available bytes + /WorkBytes GlyfArray GlyfStringIndex get length def + % Set index to get data from next string in array + /GlyfStringIndex GlyfStringIndex 1 add def +} bind def + +% Returns a string with the requested number of bytes taken +% from WorkingString. There must be enough data in WorkingString to +% satisfy the request +% +/GetWorkingBytes +{ + /BytesToRead exch def + % Get 'BytesToRead' bytes from working store + WorkString 0 BytesToRead getinterval + dup length string copy + % Get remaining bytes from working store + WorkString BytesToRead WorkBytes BytesToRead sub getinterval + dup length string copy + % replace first 'n' bytes of working store with unread bytes + WorkString 0 3 -1 roll putinterval + % Subtract bytes read from bytes available + /WorkBytes WorkBytes BytesToRead sub def +} bind def + +% Read 'int' bytes from GlyfArray strings, return string composed +% of those bytes +% +% int GetGlyfBytes string +/GetGlyfBytes +{ + /ToRead exch def + + % If we have no available data, get soem from the array of + % glyf strings + WorkBytes 0 eq { + GetWorkingString + } if + + WorkBytes ToRead ge { + ToRead string dup 0 + ToRead GetWorkingBytes putinterval + }{ + % Create a string sized to hold the target data + ToRead string + % Get remaining stored bytes, and put at the start + % of the string + dup + % Start of string + 0 + % Get remaining bytes + WorkString 0 WorkBytes getinterval + % store at start of output string + putinterval + + dup + % Location in output to store data from next string + WorkBytes + % amout of data required to read from next string + ToRead WorkBytes sub + % Get the next string from the array of strings + GetWorkingString + % Get a string containing the required data, updating + % the internal data storage + GetWorkingBytes + % put the data at the end of the stored data in the + % output string + putinterval + } ifelse +} bind def + +% Given an array of glyf strings, returns an array of strings +% split on glyf boundaries +% +% [] SplitGlyf [] +% +/SplitGlyf +{ + /GlyfArray exch def + /DestArray GlyfArray length 2 mul array def + /DestArrayIndex 0 def + + /LastLoca 0 def + /NextLocaIndex 0 def + /LastLocaIndex 0 def + + /GlyfStringIndex 0 def + /WorkString maxstring string def + /WorkBytes 0 def + + % Find appropriate next loca + { + % Get location of next glyph + LocaArray NextLocaIndex get % int + % subtract location of last point to get + % the actual bytes between + LastLoca sub maxstring gt % int bool + { + LocaArray LastLocaIndex get LastLoca sub + GetGlyfBytes % () + DestArray DestArrayIndex 3 -1 roll put % - + /DestArrayIndex DestArrayIndex 1 add def % - + LocaArray LastLocaIndex get /LastLoca exch def % - + } { % int + /LastLocaIndex NextLocaIndex def % - + /NextLocaIndex NextLocaIndex 1 add def % - + NextLocaIndex NumGlyphs gt % bool + { + WorkBytes % int + GlyfStringIndex GlyfArray length lt { % int bool + GlyfArray GlyfStringIndex get length % int + add string dup % (d) (d) + 0 % (d) (d) 0 + WorkString 0 WorkBytes getinterval % (d) (d) (s) + putinterval % (d) + dup % (d) (d) + WorkBytes % (d) (d) int + GetWorkingString % (d) (d) int + WorkString 0 WorkBytes getinterval % (d) (d) int (s) + putinterval % (d) + } { + pop % - + WorkString 0 WorkBytes getinterval % () + } ifelse + dup length string copy + DestArray DestArrayIndex 3 -1 roll put + exit + } if + } ifelse + } loop + DestArray + +} bind def + +% ProcessTTData looks at the data stored in the 'tabs' array and does several things: +% 1) Make sure strings representing tables are multiples of 4 bytes long +% 2) For arrays representing tables, make sure the total string length is a multiple +% of 4 bytes long, to ensure the table is a multiple of 4 bytes. +% 3) Handle the glyf table specislly, each string in this array must be split on the +% boundary of a glyf. Use the loca table to determine where the split should happen +% and build a new array of strings split appropriately. +% +% - ProcessTTData - +% +/ProcessTTData +{ + .opdloadttfontdict begin + % Make sure all the strings are a multiple of 4 bytes + 0 1 tabarray length 1 sub{ + /ix exch def + tabarray ix get + 12 getu32 dup maxstring le { + % String < 64Kb, still need to check if its a multiple of 4 + dup 4 mod 0 ne { + 4 div cvi 1 add 4 mul string /newstring exch def + /oldstring tabs ix get def + newstring 0 oldstring putinterval + 0 1 newstring length oldstring length sub 1 sub { + newstring exch oldstring length add 0 put + } for + tabs ix newstring put + } { + % table size is a multiple of 4, don't need to promote it + pop + } ifelse + }{ + % table size > 64K, so this is an array of strings, not a string + % We still need to make sure that the tables end on 4-byte + % boundaries. + dup 4 mod 0 ne { + % First we need to work out how many strings of size maxstring + % are present, and how much they contribute to the overall size. + dup maxstring idiv maxstring mul sub + % Promote final string length to multiple of 4 + 4 idiv 1 add 4 mul string /newstring exch def + % Get array of strings + tabs ix get + % find size of table and get last string + dup length 1 sub dup /iy exch def get /oldstring exch def + newstring 0 oldstring putinterval + 0 1 newstring length oldstring length sub 1 sub { + newstring exch oldstring length add 0 put + } for + tabs ix get iy newstring put + } { + % table size is a multiple of 4, don't need to promote it + pop + } ifelse + } ifelse + } for + + % Now, if glyf table > 64Kb, then it will be an array of strings + % We need to make sure the strings are split on glyph boundaries + 0 1 tabarray length 1 sub { % int + dup tabarray exch get % int () + dup 12 getu32 maxstring gt { % int () bool + 0 4 getinterval dup (glyf) eq{ % int () bool + % Need to split the glyf strings on glyph boundaries, hmmm. + pop % int + % We need to know the number of glyphs (from the maxp table) and the + % position of each glyph (from the loca table). + GetLocaType % int + GetNumGlyphs % int + GetSortedLoca % int + % Get the array of strings from tabs + dup tabs exch get % int + SplitGlyf % int [] + tabs 3 1 roll put % - + } { % int () + (Warning, table ) print print ( > 64Kb\n) print + pop % - + } ifelse + }{ % int () + % Table less than 64K, so don't worry + pop % directory entry % int + pop % 'for' control variable % - + } ifelse + } for + end % .opdloadttfontdict +} bind def + +% Makesfnts uses the accumulated data to create an array of strings +% containing only the required data. +% +% - Makesfnts array +% +/Makesfnts +{ + .opdloadttfontdict begin + % Determine size of sfnts array + % length of tabarray + header + 0 + tabs { % int obj + dup type /stringtype eq { % int obj bool + pop % int + 1 add % int + }{ % int obj + { % int obj + type /stringtype eq { % int bool + 1 add % int + } if + } forall + } ifelse + } forall + + 1 add % add header and table directory + % to determine total # strings + % Need to recalculate the lengths of the TT + % tables, just in case any have changed. If required we + % could also resort the tables here, ideally we should do so + % and recalculate checksums, but this should never be necessary + % for fonts produced by pdfwrite. + /TTOffset + TableDir length % initial table offset is header length + tabarray length 16 mul add % + (NumTables * 16) bytes + def + + 0 + tabarray { % index () + exch dup 1 add % () index index+1 + 3 1 roll % index+1 () index + dup % index+1 () index index + tabs exch get % index+1 () index ()/[] + dup type /stringtype eq { % index+1 () index ()/[] bool + length % index+1 () index int + 2 index exch % index+1 () index () int + TTOffset + dup 3 1 roll add % add the running total of offsets + /TTOffset exch def % update running total of offsets + 8 exch putu32 % index+1 () index + exch tabarray 3 1 roll % index+1 [] index () + put % index+1 + } { % index+1 () index ()/[] + 0 exch % add all string lengths + { % starting from 0 + dup type /stringtype eq { + length add % + } { + pop + } ifelse + } forall % + 2 index exch % index+1 () index () int + TTOffset + dup 3 1 roll add % add the running total of offsets + /TTOffset exch def % update running total of offsets + 8 exch putu32 % index+1 () index + exch tabarray 3 1 roll % index+1 [] index () + put % index+1 + } ifelse + } forall + pop % index+1 + + array % [] + dup 0 % [] [] 0 + TableDir length + tables length add % [] [] 0 header_length + string % [] [] 0 () + dup 0 TableDir putinterval % [] [] 0 () + dup 12 tables putinterval % [] [] 0 () + put % [] + dup % [] [] + /ix 1 def + tabs { % [] [] obj + dup type /stringtype eq { % [] [] obj bool + ix exch % [] [] int obj + put dup % [] [] + /ix ix 1 add def % [] [] + }{ + { + dup type /stringtype eq { % [] [] obj bool + ix exch put dup % [] [] + /ix ix 1 add def % + } { + pop % [] [] + } ifelse + } forall + } ifelse + } forall + pop % [] + end %.opdloadttfontdict +} bind def + +/MakeType42 % <FontFile_object> <font_descriptor> MakeType42 <FontFile_object> <font_descriptor> <font> +{ + //PDFR_DEBUG { + (MakeType42 beg) = + } if + 10 dict begin + /FontName 1 index /FontName get def + /FontType 42 def + /FontMatrix [1 0 0 1 0 0] def + /FontBBox 1 index /FontBBox get def % fo fd + dup /FontResource get % fo fd fr + dup /Encoding known { % fo fd fr + //PDFReader /ObtainEncoding get exec % fo fd fr + /Encoding get % fo fd e + } { + pop null + } ifelse + /PDFEncoding exch def % fo fd + /CharStrings 2 index //PDFReader /MakeTTCharStrings get exec def + /sfnts 2 index //MakeStreamReader exec + ReadTTF + ProcessTTData + Makesfnts + def + /Encoding StandardEncoding def % A stub - will be replaced by font resource. + /PaintType 0 def + currentdict end + //PDFR_DEBUG { + (MakeType42 end) = + } if +} bind def + +/GetInstalledFont % <name> GetInstalledFont <font> +{ + dup //InstalledFonts exch knownget { % n f + exch pop % f + } { % n + dup findfont dup 3 1 roll % f n f + //InstalledFonts 3 1 roll put % f + } ifelse +} bind def + +/RemoveFontNamePrefix % <name> RemoveFontNamePrefix <name> +{ //=string cvs true + 0 1 5 { + 2 index exch get //IsUpper exec not { + pop false exit + } if + } for + { (+) search { + pop pop + } if + } if + cvn +} bind def + +/CheckFont % <key> <val> CheckFont <key> <val> +{ dup /Type get /Font ne { + mark (Resource ) 3 index ( must have /Type/Font .) //error exec + } if +} bind def + +/CheckEncoding % <key> <val> CheckEncoding <key> <val> +{ dup type /nametype ne { + dup /Type get /Encoding ne { + mark (Resource ) 3 index ( must have /Type/Encoding .) //error exec + } if + } if +} bind def + +/ObtainEncoding % <font_resource> ObtainEncoding <font_resource> +{ dup /Encoding known { + dup dup /Encoding //CheckEncoding //ResolveD exec % fr fr er|e|n + dup type dup /arraytype eq exch /packedarraytype eq or { + % Already resolved. + pop pop + } { + dup type /nametype eq { + /Encoding findresource % fr fr e + } { + dup /BaseEncoding //knownget exec not { + /StandardEncoding + } if + /Encoding findresource % fr fr er e + exch % fr fr e er + /Differences //knownget exec { % fr fr e d + exch dup length array copy exch + 0 exch % fr fr e 0 d + { % fr fr e i v + dup type /integertype eq { + exch pop + } { + 3 copy put pop % fr fr e i + 1 add + } ifelse + } forall + pop % fr fr e + } if % fr fr e + } ifelse % fr fr e + /Encoding exch put % fr + } ifelse + } { + dup /Encoding /StandardEncoding /Encoding findresource put + } ifelse +} bind def + +/ObtainMetrics % <font_resource> ObtainMetrics <font_resource> +{ dup /Widths //knownget exec { % fr W + 1 index /Encoding get % fr W E + 256 dict % fr W E M + 3 index /Subtype get /TrueType eq { + 1000 + } { + 1 + } ifelse % fr W E M s + 4 index /MissingWidth //knownget exec not { + 0 + } if % fr W E M s mw + 5 index /FirstChar //knownget exec not { + 0 + } if % fr W E M s mw c0 + 6 5 roll % fr E M s mw c0 W + dup 0 exch 1 exch length 1 sub { % fr E M s mw c0 W i + 2 copy get % fr E M s mw c0 W i w + exch 3 index add % fr E M s mw c0 W w c + 7 index exch get % fr E M s mw c0 W w n + dup null ne { + 6 index 3 1 roll exch % fr E M s mw c0 W M n w + 6 index div + 3 copy pop //knownget exec { + 0 eq + } { + true + } ifelse + { put % fr E M s mw c0 W + } { + pop pop pop + } ifelse + } { + pop pop + } ifelse + } for + pop pop pop pop exch pop % fr M + 1 index exch /Metrics exch put % fr + } { + dup /MissingWidth //knownget exec { % fr mw + 256 dict % fr mw M + 2 index /Encoding get { % fr mw M e + dup null ne { + 3 copy 3 2 roll put % fr mw M e + } if + pop % fr mw M + } forall + exch pop % fr M + 1 index exch /Metrics exch put % fr + } if + } ifelse +} bind def + +/NotDef % - NotDef - +{ % A Type 3 font is on dstack. + FontMatrix aload pop pop pop exch pop exch pop % sx sy + 1 exch div exch + 1 exch div exch % wx wy + 1 index 0 setcharwidth + 0 setlinewidth + 0 0 moveto + 2 copy rlineto + 1 index 0 rlineto + neg exch neg exch rlineto % + closepath stroke +} bind def + +/BuildChar % <font> <char_code> BuildChar - +{ //PDFR_DEBUG { + (BuildChar ) print dup //=only exec ( ) print + } if + exch begin + Encoding exch get % n + //PDFR_DEBUG { + dup = + } if + dup null eq { + pop //NotDef exec % + } { % n + CharProcs exch //knownget exec { % cp_stream + //RunDelayedStream exec + } { + //NotDef exec + } ifelse + } ifelse % + end % font +} bind def + +/printdict % <dict> printdict - +{ (<<) = + { exch = == } forall + (>>) = +} bind def + +/printfont % <dict> printfont - +{ + dup { + exch dup = + dup /Encoding eq { + pop = + } { + dup /FontInfo eq exch /Private eq or { + //printdict exec + } { + == + } ifelse + } ifelse + } forall +} bind def + +/ScaleMetrics % <Metrics> <scale> ScaleMetrics <Metrics> +{ 1 index { % M s n v + 2 index div % M s n v' + 3 index % M s n v' M + 3 1 roll put % M s + } forall + pop +} bind def + +/ResolveAndSetFontAux % <resource_name> <size> ResolveAndSetFont - +{ exch dup % s rn rn + //PDFReader /CurrentObject get /Context get /Resources get + /Font //DoNothing //ResolveD exec + exch //CheckFont //ResolveD exec % s rn fr + dup /Font //knownget exec { % s rn fr f + exch pop exch pop + } { + { + dup /Subtype get dup dup /Type1 eq exch /TrueType eq or exch /MMType1 eq or { + % s rn fr + exch pop % s fr + dup /BaseFont get % s fr n + //RemoveFontNamePrefix exec % s fr n + //PDFR_DEBUG { + (Font ) print dup = + } if % s fr n + 1 index /FontDescriptor known { % s fr n + //PDFR_DEBUG { + (Font from a font descriptor.) = + } if + 1 index % s fr n fr + /FontDescriptor //DoNothing //ResolveD exec % s fr n fd + /Font //knownget exec { + exch pop % s fr fd + } { + //PDFR_DEBUG { + (Font descriptor has no Font resolved.) = + } if + //GetInstalledFont exec % s fr f + } ifelse + } { + //GetInstalledFont exec % s fr f + } ifelse + exch % s f fr + dup /Encoding known not { + 1 index /Encoding get 1 index exch /Encoding exch put + } if + //ObtainEncoding exec + //ObtainMetrics exec + exch + dup length dict copy % s fr f + dup 2 index /Encoding get % s fr f f e + /Encoding exch put % s fr f + 1 index /Metrics //knownget exec { % s fr f M + 2 index /Subtype get /TrueType ne { + 1 index /FontMatrix get 0 get + dup 0 eq { + % FontMatrix[0] == 0, so cannot downscale by it + % HACK: downscale by FontMatrix[1], and will get the target value of wx as wy + pop + 1 index /FontMatrix get 1 get + dup 0 eq { pop 1 } if % sorry, FontMatrix is singular so cannot enforce the PDF metrics + } if + 0.001 div + //ScaleMetrics exec + }{ + % Check if we got a /sfnts key in the dict + % If we did then we are probably OK (TT font from GS) + 1 index /sfnts known not { + % otherwise we need to check the FontMatrix + 1 index /FontMatrix get 0 get + dup 0 eq { + % FontMatrix[0] == 0, so cannot downscale by it + % HACK: downscale by FontMatrix[1], and will get the target value of wx as wy + pop + 1 index /FontMatrix get 1 get + dup 0 eq { pop 1 } if % sorry, FontMatrix is singular so cannot enforce the PDF metrics + } if + //ScaleMetrics exec + } if + } ifelse + 1 index exch /Metrics exch put % s fr f + } if + 1 index /BaseFont get % s fr f n + exch + dup /FID undef + dup /UniqueID undef + definefont % s fr f + dup 3 1 roll % s f fr f + /Font exch put % s f + exit + } if + dup /Subtype get /Type3 eq { % s rn fr + //ObtainEncoding exec + 2 copy exch /FontName exch put + dup /CharProcs get //ResolveDict exec + dup /FontType 3 put + dup /BuildChar //BuildChar put + dup dup /Font exch put + % Ignore Metrics because pdfwrite duplicates it + % from setcharwidth/setcachedevice. + dup 3 1 roll % s fr rn fr + definefont % s fr f + 2 copy ne { + % The interpreter copied the font dictionary while 'definefont' + % Need to update the font pointer in the resource. + 2 copy /Font exch put % s fr f + } if + exch pop % s f + exit + } if + dup /Subtype get /Type0 eq { % s rn fr + } if + dup /Subtype get /CIDFontType0 eq { % s rn fr + } if + dup /Subtype get /CIDFontType2 eq { % s rn fr + } if + mark (Unknown font type ) 2 index /Subtype get //error exec + } loop + } ifelse % s f + exch scalefont setfont % +} bind def + +/ResolveAndSetFont % <resource_name> <size> ResolveAndSetFont - +{ + //ResolveAndSetFontAux exec +} bind def + +%%beg TrueType +% ================= Auxiliary procedures for True Type cmap Decoder ============= + +/.knownget +{ 2 copy known { + get true + } { + pop pop false + } ifelse +} bind def + +/.min +{ 2 copy lt { + exch + } if + pop +} bind def + +/.max +{ 2 copy gt { + exch + } if + pop +} bind def + +/.dicttomark +{ >> +} bind def + +% ===================== True Type cmap Decoder ============= +% The following procedures are copied from gs/lib/gs_ttf.ps with no change. + +% <string> <index> getu16 <integer> +/getu16 { + 2 copy get 8 bitshift 3 1 roll 1 add get add +} bind def + +% <string> <index> gets16 <integer> +/gets16 { + getu16 16#8000 xor 16#8000 sub +} bind def + +% <string> <index> getu32 <integer> +/getu32 { + 2 copy getu16 16 bitshift 3 1 roll 2 add getu16 add +} bind def + +% <string> <index> gets32 <integer> +/gets32 { + 2 copy gets16 16 bitshift 3 1 roll 2 add getu16 add +} bind def + +% Each procedure in this dictionary is called as follows: +% <encodingtable> proc <glypharray> +/cmapformats mark + 0 { % Apple standard 1-to-1 mapping. + 6 256 getinterval { } forall 256 packedarray + } bind + 2 { % Apple 16bit CJK (ShiftJIS etc) + + % /sHK_sz subHeaderKey_size % 1 * uint16 + % /sH_sz subHeader_size % 4 * uint16 + % /sH_len subHeader_length + % /cmapf2_tblen total table length + % /cmapf2_lang language code (not used) + % /sHKs subHeaderKeys + + /sHK_sz 2 def + /sH_sz 8 def + dup 2 getu16 /cmapf2_tblen exch def + + dup 4 getu16 /cmapf2_lang exch def + + dup 6 256 sHK_sz mul getinterval /sHKs exch def + + 0 % initialization value for /sH_len + 0 1 255 { + sHKs exch + 2 mul getu16 + 1 index % get current max + 1 index % get current subHeaderKey + lt {exch} if pop + } for + /sH_len exch def + + dup 6 256 sHK_sz mul add + cmapf2_tblen 1 index sub getinterval + /sH_gIA exch def + + /cmapf2_glyph_array 65535 array def + + /.cmapf2_putGID { + /cmapf2_ch cmapf2_ch_hi 8 bitshift cmapf2_ch_lo add def + firstCode cmapf2_ch_lo le + cmapf2_ch_lo firstCode entryCount add lt + and { % true: j is inside + sH_offset idRangeOffset add % offset to gI + cmapf2_ch_lo firstCode sub 2 mul % rel. pos. in range + add 6 add % offset in sH_gIA + sH_gIA exch getu16 + dup 0 gt { % + idDelta add + cmapf2_glyph_array exch cmapf2_ch exch put + } { + pop + % cmapf2_glyph_array cmapf2_ch 0 put + } ifelse + } { % false: j is outside + % cmapf2_glyph_array cmapf2_ch 0 put + } ifelse + } def + + 16#00 1 16#ff { % hi_byte scan + /cmapf2_ch_hi exch def + sHKs cmapf2_ch_hi sHK_sz mul getu16 + /sH_offset exch def + sH_gIA sH_offset sH_sz getinterval + dup 0 getu16 /firstCode exch def + dup 2 getu16 /entryCount exch def + dup 4 gets16 /idDelta exch def + dup 6 getu16 /idRangeOffset exch def + pop + sH_offset 0 eq { + /cmapf2_ch_lo cmapf2_ch_hi def + /cmapf2_ch_hi 0 def + .cmapf2_putGID + } { + 16#00 1 16#ff { % lo_byte scan + /cmapf2_ch_lo exch def + .cmapf2_putGID + } for + } ifelse + } for + pop + 0 1 cmapf2_glyph_array length 1 sub { % rewrite null -> 0. + dup cmapf2_glyph_array exch get + null eq { cmapf2_glyph_array exch 0 put } {pop} ifelse + } for + cmapf2_glyph_array + } bind + 4 { % Microsoft/Adobe segmented mapping. + /etab exch def + /nseg2 etab 6 getu16 def + 14 /endc etab 2 index nseg2 getinterval def + % The Apple TrueType documentation omits the 2-byte + % 'reserved pad' that follows the endCount vector! + 2 add + nseg2 add /startc etab 2 index nseg2 getinterval def + nseg2 add /iddelta etab 2 index nseg2 getinterval def + nseg2 add /idroff etab 2 index nseg2 getinterval def + % The following hack allows us to properly handle + % idiosyncratic fonts that start at 0xf000: + pop + /firstcode startc 0 getu16 16#ff00 and dup 16#f000 ne { pop 0 } if def + /putglyph { + glyphs code 3 -1 roll put /code code 1 add def + } bind def + % Do a first pass to compute the size of the glyphs array. + /numcodes 0 def /glyphs 0 0 2 nseg2 3 sub { + % Stack: /glyphs numglyphs i2 + /i2 exch def + /scode startc i2 getu16 def + /ecode endc i2 getu16 def + numcodes scode firstcode sub + % Hack for fonts that have only 0x0000 and 0xf000 ranges + %dup 16#e000 ge { 255 and } if + % the previous line is obstructive to CJK fonts, so it was removed + exch sub 0 .max ecode scode sub 1 add add + exch 1 index add exch + numcodes add /numcodes exch def + } for array def + % prefill the array with 0's faster than a { 0 putglyph } repeat + glyphs length 1024 ge { + .array1024z 0 1024 glyphs length 1023 sub { glyphs exch 2 index putinterval } for + glyphs dup length 1024 sub 3 -1 roll + putinterval + } { + 0 1 glyphs length 1 sub { glyphs exch 0 put } for + } ifelse + % Now fill in the array. + /numcodes 0 def /code 0 def + 0 2 nseg2 3 sub { + /i2 exch def + /scode startc i2 getu16 def + /ecode endc i2 getu16 def + numcodes scode firstcode sub + % Hack for fonts that have only 0x0000 and 0xf000 ranges + %dup 16#e000 ge { 255 and } if + % the previous line is obstructive to CJK fonts, so it was removed + exch sub 0 .max dup /code exch code exch add def + ecode scode sub 1 add add numcodes add /numcodes exch def + /delta iddelta i2 gets16 def + TTFDEBUG { + (scode=) print scode =only + ( ecode=) print ecode =only + ( delta=) print delta =only + ( droff=) print idroff i2 getu16 = + } if + idroff i2 getu16 dup 0 eq { + pop scode delta add 65535 and 1 ecode delta add 65535 and + { putglyph } for + } { % The +2 is for the 'reserved pad'. + /gloff exch 14 nseg2 3 mul add 2 add i2 add add def + 0 1 ecode scode sub { + 2 mul gloff add etab exch getu16 + dup 0 ne { delta add 65535 and } if putglyph + } for + } ifelse + } for glyphs /glyphs null def % for GC + } bind + 6 { % Single interval lookup. + dup 6 getu16 /firstcode exch def dup 8 getu16 /ng exch def + firstcode ng add array + % Stack: tab array + % Fill elements 0 .. firstcode-1 with 0 + 0 1 firstcode 1 sub { 2 copy 0 put pop } for + dup firstcode ng getinterval + % Stack: tab array subarray + % Fill elements firstcode .. firstcode+nvalue-1 with glyph values + 0 1 ng 1 sub { + dup 2 mul 10 add 4 index exch getu16 3 copy put pop pop + } for pop exch pop + } bind +.dicttomark readonly def % cmapformats + +% <cmaptab> cmaparray <glypharray> +/cmaparray { + dup 0 getu16 cmapformats exch .knownget { + TTFDEBUG { + (cmap: format ) print 1 index 0 getu16 = flush + } if exec + } { + (Can't handle format ) print 0 getu16 = flush + 0 1 255 { } for 256 packedarray + } ifelse + TTFDEBUG { + (cmap: length=) print dup length = dup == + } if +} bind def + +% Define remapping for misnamed glyphs in TrueType 'post' tables. +% There are probably a lot more than this! +/postremap mark + /Cdot /Cdotaccent + /Edot /Edotaccent + /Eoverdot /Edotaccent + /Gdot /Gdotaccent + /Ldot /Ldotaccent + /Zdot /Zdotaccent + /cdot /cdotaccent + /edot /edotaccent + /eoverdot /edotaccent + /gdot /gdotaccent + /ldot /ldotaccent + /zdot /zdotaccent +.dicttomark readonly def + +/get_from_stringarray % <array|string> <offset> get_from_stringarray <int> +{ 1 index type /stringtype eq { + get + } { + exch { % o () + 2 copy length ge { + length sub + } { + exch get exit + } ifelse + } forall + } ifelse +} bind def + +/getinterval_from_stringarray % <array|string> <offset> <length> getinterval_from_stringarray <string> +{ % May allocate a string in VM. + 2 index type /stringtype eq { + getinterval + } { + string exch 0 % [] s o p + 4 3 roll { % s o p Si + dup length % s o p Si lSi + dup 4 index lt { + 3 index exch sub % s o p Si o' + exch pop 3 1 roll exch pop % s o' p + } { % s o p Si lSi + dup 3 1 roll % s o p lSi Si lSi + 4 index sub % s o p lSi Si lSi-o + 5 index length 4 index sub % s o p lSi Si lSi-o ls-p + 2 copy gt { exch } if pop % s o p lSi Si minl + dup 3 1 roll % s o p lSi minl Si minl + 5 index exch getinterval % s o p lSi minl from + 5 index 4 index 3 index % s o p lSi minl from s p minl + getinterval % s o p lSi minl from to + copy pop % s o p lSi minl + exch pop add exch pop 0 exch % s 0 p' + dup 3 index length ge { exit } if + } ifelse + } forall + pop pop % s + } ifelse +} bind def + +/string_array_size % <array|string> string_array_size <int> + { dup type /stringtype eq { + length + } { + 0 exch { length add } forall + } ifelse +} bind def + +% Each procedure in this dictionary is called as follows: +% posttable <<proc>> glyphencoding +/postformats mark + 16#00010000 { % 258 standard Macintosh glyphs. + pop MacGlyphEncoding + } + 16#00020000 { % Detailed map, required by Microsoft fonts. + dup dup type /arraytype eq { 0 get } if length 36 lt { + TTFDEBUG { (post format 2.0 invalid.) = flush } if + pop [ ] + } { + /postglyphs exch def + /post_first postglyphs dup type /arraytype eq { 0 get } if def + post_first 32 getu16 /numglyphs exch def + /glyphnames numglyphs 2 mul 34 add def + % Build names array in the order they occur in the 'post' table + /postpos glyphnames def + /total_length postglyphs //string_array_size exec def + numglyphs array 0 1 numglyphs 1 sub { + postpos total_length ge { + % Fill the rest with .notdef + 1 numglyphs 1 sub { 1 index exch /.notdef put } for + exit + } if + % No name available, /postnames will be defined as an empty + % array and the glyph won't get a name attached. + postglyphs postpos //get_from_stringarray exec + postglyphs postpos 1 add 2 index //getinterval_from_stringarray exec cvn + exch postpos add 1 add /postpos exch def + 2 index 3 1 roll + put + } for + /postnames exch def + numglyphs array 0 1 numglyphs 1 sub { + dup 2 mul 34 add postglyphs exch 2 //getinterval_from_stringarray exec + dup 0 get 8 bitshift exch 1 get add dup 258 lt { + MacGlyphEncoding exch get + } { + dup 32768 ge { + % According to the published TrueType spec, such values are + % "reserved for future use", but at least some PDF files + % produced by the Adobe PDF library contain entries with a + % value of 16#ffff. + pop /.notdef + } { + % Get the name for this glyph + 258 sub dup postnames length ge { + TTFDEBUG { ( *** warning: glyph index past end of 'post' table) = flush } if + pop + exit + } if + postnames exch get + % At least some of Microsoft's TrueType fonts use incorrect + % (Adobe-incompatible) names for some glyphs. + % Correct for this here. + postremap 1 index .knownget { exch pop } if + } ifelse + } ifelse + 2 index 3 1 roll put + } for + + } + ifelse + } bind + 16#00030000 { % No map. + pop [ ] + } bind +.dicttomark readonly def % postformats + +/first_post_string % - first_post_string <string> +{ + post dup type /arraytype eq { 0 get } if +} bind def + +% - .getpost - +% Uses post, defines glyphencoding +/.getpost { + /glyphencoding post null eq { + TTFDEBUG { (post missing) = flush } if [ ] + } { + postformats first_post_string 0 getu32 .knownget { + TTFDEBUG { + (post: format ) print + first_post_string + dup 0 getu16 =only (,) print 2 getu16 = flush + } if + post exch exec + } { + TTFDEBUG { (post: unknown format ) print post 0 getu32 = flush } if [ ] + } ifelse + } ifelse def +} bind def + +% ===================== True Type Interpretation ============= + +/TTParser << + /Pos 0 + /post null +>> def + +/readu8 % <file> readu8 <int> +{ read not { + mark (Insufficient data in the stream.) //error exec + } if +} bind def + +/readu16 % <file> readu16 <int> +{ dup //readu8 exec 8 bitshift exch //readu8 exec or +} bind def + +/reads16 % <file> reads16 <int> +{ //readu16 exec 16#8000 xor 16#8000 sub +} bind def + +/readu32 % <file> readu32 <int> +{ dup //readu16 exec 16 bitshift exch //readu16 exec or +} bind def + +/reads32 % <file> reads32 <int> +{ dup //reads16 exec 16 bitshift exch //readu16 exec or +} bind def + +/SkipToPosition % <file> <int> SkipToPosition - +{ dup //TTParser /Pos get % f P P p + exch //TTParser exch /Pos exch put % f P p + sub % f P-p + //PDFR_DEBUG { + (Skipping ) print dup //=only exec ( bytes.) = + } if + dup 0 eq { + pop pop + } { + dup 3 1 roll % P-p f P-p + () /SubFileDecode filter % P-p f' + exch % f' P-p + { 1 index //BlockBuffer readstring pop length + dup 0 eq { pop exch pop exit } if + sub + } loop + 0 ne { + mark (Insufficient data in the stream for SkipToPosition.) //error exec + } if + } ifelse +} bind def + +/TagBuffer 4 string def + +/ParseTTTableDirectory % <file> ParseTTTableDirectory <dict> +{ //PDFR_DEBUG { + (ParseTTTableDirectory beg) = + } if + 15 dict begin + dup //readu32 exec 16#00010000 ne { + mark (Unknown True Type version.) //error exec + } if + dup //readu16 exec /NumTables exch def + dup //readu16 exec /SearchRange exch def + dup //readu16 exec /EntrySelector exch def + dup //readu16 exec /RangeShift exch def + //PDFR_DEBUG { + (NumTables = ) print NumTables = + } if + NumTables { + dup //TagBuffer readstring not { + mark (Could not read TT tag.) //error exec + } if + cvn + [ 2 index //readu32 exec pop % CheckSum + 2 index //readu32 exec % Offset + 3 index //readu32 exec % Length + ] + //PDFR_DEBUG { + 2 copy exch //=only exec ( ) print == + } if + def + } repeat + pop % file + //TTParser /Pos 12 NumTables 16 mul add put + currentdict end + //PDFR_DEBUG { + (ParseTTTableDirectory end) = + } if +} bind def + +/ParseTTcmap % <file> <TableDirectory> ParseTTcmap <dict> +{ //PDFR_DEBUG { + (ParseTTcmap beg) = + } if + /cmap get aload pop % f o L + 3 1 roll % L f o + 7 dict begin + //PDFR_DEBUG { + (Current position = ) print //TTParser /Pos get = + (cmap position = ) print dup = + } if + 1 index exch //SkipToPosition exec % L f + //TTParser /Pos get /TablePos exch def + dup //readu16 exec pop % version + dup //readu16 exec /NumEncodings exch def + //PDFR_DEBUG { + (NumEncodings = ) print NumEncodings = + } if + null % L f null + NumEncodings { + 1 index //readu32 exec % platformID, specificID % L f null id + 2 index //readu32 exec % offset % L f null id o + 3 array dup 3 2 roll 0 exch put % L f []|null id [] + 2 index null ne { + dup 0 get 3 index 0 get sub % L f []|null id [] l + 3 index exch 1 exch put % L f []|null id [] + } if + dup 4 3 roll pop 3 1 roll % L f [] id [] + def + } repeat % L f [] + dup 0 get % L f [] o + 4 3 roll exch sub % f [] L-o + 1 exch put % f + //PDFR_DEBUG { + currentdict { + exch dup type /integertype eq { + //PrintHex exec ( ) print == + } { + pop pop + } ifelse + } forall + } if + 4 NumEncodings 8 mul add /HeaderLength exch def + //TTParser /Pos //TTParser /Pos get HeaderLength add put + 0 % f o + NumEncodings { + 16#7FFFFFF null % f o om null|[] + % Choosing a table with minimal offset greater than 'o' : + currentdict { + 1 index type /integertype eq { % f o om null|[] id [] + exch pop dup 0 get % f o om null|[] [] oi + dup 5 index gt { + dup 4 index lt { + 4 1 roll % f o oi om null|[] [] + exch pop exch pop % f o oi [] + } { + pop pop + } ifelse + } { + pop pop + } ifelse % f o oi [] + } { + pop pop + } ifelse + } forall % f o om' [] + //PDFR_DEBUG { + (Obtaining subtable for ) print dup == + } if + 3 2 roll pop % f o' [] + 3 copy pop % f o' [] f o' + TablePos add //SkipToPosition exec % f o' [] + 3 copy exch pop 1 get % f o' [] l + //TTParser /Pos //TTParser /Pos get 3 index add put + string % f o' [] f () + readstring not { + mark (Can't read a cmap subtable.) //error exec + } if % f o' [] () + 2 exch put % f o' + } repeat + pop pop % + currentdict end + //PDFR_DEBUG { + (ParseTTcmap end) = + } if +} bind def + +/GetTTEncoding % <file> <TTcmapHeader> <platformIDspecificID> GetTTEncoding <array> +{ //PDFR_DEBUG { + (GetTTEncoding beg) = + } if + get % f [] + exch pop % [] + 2 get + 10 dict begin % For local variables. + /TTFDEBUG //PDFR_DEBUG def + //cmaparray exec + end + //PDFR_DEBUG { + (GetTTEncoding end) = + dup == + } if +} bind def + +/InverseEncoding % <encoding> InverseEncoding <dict> +{ + 256 dict begin + dup length 1 sub -1 0 { % E i + 2 copy get % E i n + exch % E n i + 1 index currentdict exch //knownget exec { % E n i e + dup type /arraytype eq { + aload length 1 add array astore % E n e' + } { + 2 array astore % E n e' + } ifelse + } if + def + } for + pop + currentdict end +} bind def + +/GetMacRomanEncodingInverse +{ //PDFReader /MacRomanEncodingInverse get + dup null eq { + pop + MacRomanEncoding //InverseEncoding exec + dup //PDFReader exch /MacRomanEncodingInverse exch put + } if +} bind def + +/PutCharStringSingle % <cmap_array> <glyph_name> <char_code> PutCharStringSingle <cmap_array> +{ + dup 3 index length lt { % cmap name code + 2 index exch get % cmap name glyphindex + dup 0 ne { + def % cmap + } { + pop pop + } ifelse + } { + pop pop % cmap + } ifelse +} bind def + +/PutCharString % <cmap_array> <glyph_name> <char_code> PutCharString <cmap_array> +{ 1 index type /nametype ne { + mark (Bad charstring name) //error exec + } if + dup type /arraytype eq { + { % cmap name code + 3 copy //PutCharStringSingle exec % cmap name code cmap + pop pop % cmap name + } forall + pop % cmap + } { + //PutCharStringSingle exec + } ifelse +} bind def + +/ComposeCharStrings % <cmaparray> <dict> ComposeCharStrings <dict> +{ + //PDFR_DEBUG { + (ComposeCharStrings beg) = + } if + 1 index length 1 add dict begin % cmap d + % fixme : the dict length estimation doesn't account 'post'. + /.notdef 0 def + exch % d cmap + //TTParser /post get % d cmap [post]|null + dup null ne { + exch % d [] cmap + 1 index length 1 sub -1 0 { % d [] cmap code + dup 3 index exch get exch % d [] cmap name code + dup 0 eq 2 index /.notdef eq or { % do not re-encode GID 0, or the + % /.notdef glyph name + pop pop + } { + def + } ifelse + } for + } if + exch pop exch % cmap d + { % cmap name code + //PutCharString exec + } forall % cmap + pop % + currentdict end + //PDFR_DEBUG { + (ComposeCharStrings end) = + } if +} bind def + +/ParseTTpost % <file> <TableDirectory> ParseTTpost - +{ % Defines TTparser.post - an array, + % which maps glyph indices to glyph names. + //PDFR_DEBUG { + (ParseTTpost beg) = + } if + /post get aload pop % f o L + 3 1 roll % L f o + //PDFR_DEBUG { + (Current position = ) print //TTParser /Pos get = + (post position = ) print dup = + } if + 1 index exch //SkipToPosition exec % L f + //TTParser /Pos //TTParser /Pos get 4 index add put + exch dup 65535 le { + string % f s + readstring not { + mark (Insufficient data in the stream for ParseTTpost.) //error exec + } if % s + } { + % f s + [ 3 1 roll % [ f s + dup 16384 div floor cvi % [ f s numblocks + exch 1 index 16384 mul % [ f numblocks s bytesinblocks + sub exch % [ f remainder numblocks + 1 sub 0 1 3 -1 roll % [ f remainder 0 1 numblocks + { + 1 add index % [ f remainder () ()... f + 16384 string readstring not { + mark (Insufficient data in the stream for ParseTTpost.) //error exec + } if + } for + % [ f remainder () ()... + counttomark -2 roll % [ () ()... f remainder + string readstring not{ + mark (Insufficient data in the stream for ParseTTpost.) //error exec + } if + ] + } ifelse + 1 dict begin % A bridge to the code from /gs/lib/gs_ttf.ps . + /post exch def + //.getpost exec + //TTParser /post glyphencoding put + //PDFR_DEBUG { + (ParseTTpost end) = + glyphencoding == + } if + end +} bind def + +/MakeTTCharStrings % <FontFile_object> MakeTTCharStrings <CharStrings> +{ //MakeStreamReader exec % f + dup dup //ParseTTTableDirectory exec % f f d + % Since the file isn't positionable, + % we must pick up either 'post' or 'cmap' first. + % Deside which one we do first : + //TTParser /post null put + dup /post //knownget exec { + 0 get + 1 index /cmap get 0 get + lt { + 2 copy //ParseTTpost exec % f f d + //ParseTTcmap exec % f ch + } { + 2 copy //ParseTTcmap exec % f f d ch + 3 1 roll % f ch f d + //ParseTTpost exec % f ch + } ifelse + } { + //ParseTTcmap exec % f ch + } ifelse + { + dup 16#00030001 known { + //PDFR_DEBUG { + (Using the TT cmap encoding for Windows Unicode.) = + } if + 16#00030001 //GetTTEncoding exec + AdobeGlyphList //ComposeCharStrings exec + exit + } if + dup 16#00010000 known { + //PDFR_DEBUG { + (Using the TT cmap encoding for Macintosh Roman.) = + } if + 16#00010000 //GetTTEncoding exec + PDFEncoding dup null eq { + pop //GetMacRomanEncodingInverse exec + } { + //InverseEncoding exec + } ifelse + //ComposeCharStrings exec + exit + } if + dup 16#00030000 known { + //PDFR_DEBUG { + (Using the TT cmap encoding 3.0 - not sure why Ghostscript writes it since old versions.) = + } if + % Same algorithm as for 16#00010000. + 16#00030000 //GetTTEncoding exec + PDFEncoding dup null eq { + pop //GetMacRomanEncodingInverse exec + } { + //InverseEncoding exec + } ifelse + //ComposeCharStrings exec + exit + } if + mark (True Type cmap has no useful encodings.) //error exec + } loop + //PDFR_DEBUG { + (CharStrings <<) = + dup { + exch + dup type /nametype eq { + //=only exec + } { + == + } ifelse + ( ) print == + } forall + (>>) = + } if +} bind def + +%%end TrueType + +% ===================== Functions ============================ + +/ScaleVal % <value> <Range> ScaleVal <scaled_value> +{ + aload pop % v r0 r1 + 1 index sub % v r0 r1-r0 + 3 2 roll mul add +} bind def + +/ScaleArg % <arg> <Domain> ScaleArg <scaled_arg> +{ + aload pop % a d0 d1 + 1 index sub % a d0 d1-d0 + 3 1 roll % d1-d0 a d0 + sub exch div % (a-d0)/(d1-d0) +} bind def + +/ScaleArgN % <arg1> ... <argN> <Domain> ScaleArg <scaled_arg1> ... <scaled_argN> +{ + dup length 2 sub -2 0 { % a1 ... an [] 2i + 2 % a1 ... an [] 2i 2 + 2 index 3 1 roll getinterval % a1 ... an [] [] + 3 2 roll % a1 ... [] [] an + exch //ScaleArg exec % a1 ... [] an' + 1 index length 2 idiv 1 add 1 roll % an' a1 ... [] + } for % a1' ... an' [] + pop % a1' ... an' +} bind def + + +/ComputeFunction_10 % <scaled_arg> <sample_array> ComputeFunction_10 <result> +{ % Assuming a 1-argument 1-result function type 0. + //PDFR_DEBUG { + (ComputeFunction_10 beg ) print 1 index //=only exec ( stack=) print count = + } if + exch % [] x + dup 1 eq { + pop dup length 1 sub get % y + } { + 1 index length 1 sub mul % [] x*(l-1) + dup dup floor sub % [] x*(l-1) f + dup 0 eq { + pop cvi get % y + } { + 3 1 roll floor cvi % f [] i + 2 getinterval % f [] + aload pop % f y0 y1 + 2 index mul 3 2 roll 1 exch sub 3 2 roll mul add % y1*f+(1-f)*y0 + } ifelse + } ifelse + //PDFR_DEBUG { + (ComputeFunction_10 end ) print dup //=only exec ( stack=) print count = + } if +} bind def + +/ComputeFunction_n0 % <arg1> .... <argn> <sample_array> <n> ComputeFunction_n0 <result> +{ % Assuming a n-argument 1-result function type 0. + //PDFR_DEBUG { + (ComputeFunction_n0 beg N=) print dup //=only exec ( stack=) print count = + } if + dup 0 eq { % v 0 + pop % v + } { + dup 2 add -1 roll % a2 .... an [] n a1 + dup 3 index length 1 sub ge { + pop 1 sub % a2 .... an [] n-1 + exch dup length 1 sub get exch + //PDFReader /ComputeFunction_n0 get exec + } { + dup floor cvi dup % a2 .... an [] n a1 i i + 4 index exch get % a2 .... an [] n a1 i [i] + 3 index dup % a2 .... an [] n a1 i [i] n n + 5 add copy % a2 .... an [] n a1 i [i] n a2 .... an [] n a1 i [i] n + 6 2 roll % a2 .... an [] n a1 i [i] n a2 .... an [i] n [] n a1 i + pop pop pop pop % a2 .... an [] n a1 i [i] n a2 .... an [i] n + 1 sub % a2 .... an [] n a1 i [i] n a2 .... an [i] n-1 + //PDFReader /ComputeFunction_n0 get exec % a2 .... an [] n a1 i [i] n v0 + 3 2 roll pop % a2 .... an [] n a1 i n v0 + exch % a2 .... an [] n a1 i v0 n + 4 3 roll exch % a2 .... an [] n i v0 a1 n + 4 add 2 roll 1 add % v0 a1 a2 .... an [] n i+1 + 3 2 roll exch get % v0 a1 a2 .... an n [i+1] + exch 1 sub % v0 a1 a2 .... an [i+1] n-1 + //PDFReader /ComputeFunction_n0 get exec % v0 a1 v1 + 1 index mul % v0 a1 v1*a1 + 3 1 roll % v1*a1 v0 a1 + 1 exch sub mul add % v1*a1+v0*(1-a1) + } ifelse + } ifelse + //PDFR_DEBUG { + (ComputeFunction_n0 end ) print dup //=only exec ( stack=) print count = + } if +} bind def + +/FunctionToProc_x01 % <function_dict> FunctionToProc_x01 <proc> +{ % Assuming a n-argument 1-result function type 0. + % The stream is already converted to the array /Data. + dup /Domain get exch + dup /Data get 0 get exch + /Size get length + [ 4 1 roll + //PDFR_DEBUG { + { (function beg, stack =) print count //=only exec (\n) print } /exec load + 5 2 roll + } if + dup 1 gt { % a1 ... an Domain Data n + { mark exch % a1 ... an Domain Data [ n + 3 add 2 roll % Data [ a1 ... an Domain + //ScaleArgN exec % Data [ a1 ... an + counttomark dup % Data [ a1 ... an n n + 3 add -2 roll % a1 ... an n Data [ + pop exch % a1 ... an Data n + //ComputeFunction_n0 exec + } /exec load + } { + pop % a1 Domain Data + 3 1 /roll load //ScaleArg /exec load % Data a1s + /exch load + //ComputeFunction_10 /exec load + } ifelse + //PDFR_DEBUG { + (function end, stack =) /print load /count load //=only /exec load (\n) /print load + } if + ] cvx + //PDFR_DEBUG { + (Made a procedure for the 1-result function :) = + dup == + } if +} bind def + +/FunctionProcDebugBeg % - FunctionProcDebugBeg - +{ (FunctionProcDebugBeg ) print count = +} bind def + +/FunctionProcDebugEnd % - FunctionProcDebugEnd - +{ (FunctionProcDebugEnd ) print count = +} bind def + +/FunctionToProc_x0n % <function_dict> <m> FunctionToProc_x0n <proc> +{ % Assuming a n-argument m-result function type 0. + % The stream is already converted to the array /Data. + % + % Making the procedure : { Domain //ScaleArg exec ... n copy {} exec n+1 1 roll ... } + % except "n copy" for the last chunk. + % + PDFR_DEBUG { + (FunctionToProc_x0n beg m=) print dup = + } if + 1 index /Size get length exch % f n m + dup 7 mul 2 add array % f n m [] + PDFR_DEBUG { + dup 0 //FunctionProcDebugBeg put + } { + dup 0 //DoNothing put + } ifelse + dup 1 /exec load put + dup 2 5 index /Domain get put + 2 index 1 eq { + dup 3 //ScaleArg put + } { + dup 3 //ScaleArgN put + } ifelse + dup 4 /exec load put + 1 index 1 sub 0 exch 1 exch { % f n m [] i + dup 7 mul 5 add % f n m [] i i1 + 1 index 4 index 1 sub ne { + dup 3 index exch 6 index put 1 add + dup 3 index exch /copy load put 1 add + } if + [ % f n m [] i i1 [ + 6 index /Data get 3 index get % f n m [] i i1 [ di + 6 index 1 eq { + //ComputeFunction_10 /exec load + } { + 6 index + //ComputeFunction_n0 /exec load + } ifelse + ] cvx % f n m [] i i1 {} + 3 index exch 2 index exch put 1 add % f n m [] i i1 + 2 index 1 index /exec load put 1 add + 1 index 4 index 1 sub ne { + 2 index 1 index 6 index 1 add put 1 add + 2 index 1 index 1 put 1 add + 2 index 1 index /roll load put % f n m [] i i1 + } if + pop pop % f n m [] + } for + PDFR_DEBUG { + dup dup length 2 sub //FunctionProcDebugEnd put + } { + dup dup length 2 sub //DoNothing put + } ifelse + dup dup length 1 sub /exec load put + cvx exch pop exch pop exch pop + //PDFR_DEBUG { + (Made a procedure for the n-argument function :) = + dup == + } if + PDFR_DEBUG { + (FunctionToProc_x0n end) = + } if +} bind def + +/MakeTableRec % <func_obj> <n> MakeTableRec <array> +{ + 0 % to be bound below + exec +} bind def + +/MakeTable % <func_obj> <n> MakeTable <array> +{ //PDFR_DEBUG { + (MakeTable beg ) print count = + } if + 1 index /Size get exch % f S N + 1 sub dup % f S n n + 3 1 roll % f n S n + get % f n s + array % f n [] + 1 index 0 eq { + exch pop exch pop % [] + } { + dup length 1 sub -1 0 { % f n [] i + 3 index 3 index //MakeTableRec exec % f n [] i [] + 2 index 3 1 roll put % f n [] + } for + exch pop exch pop + } ifelse + //PDFR_DEBUG { + (MakeTable end ) print count = + } if +} bind def + +//MakeTableRec 0 //MakeTable put + +/StoreSample % <value> <table> <dimensions> StoreSample - +{ % The reader is on the dictionary stack. + 1 sub + dup 0 eq { + pop % v [] + } { + -1 1 { % v T i + I exch get get % v T[I[i]] + } for % v [] + } ifelse + I 0 get 3 2 roll put +} bind def + +/ReadSample32 % - ReadSample32 <value> +{ + 4 { + File read not { + mark (Insufficient data for function.) //error exec + } if + } repeat + pop % Ignore the last byte because it can't fit into 'real'. + 3 1 roll exch + 256 mul add 256 mul add + //1_24_bitshift_1_sub div +} bind def + +/ReadSample % - ReadSample <value> +{ % The reader in on the dictionary stack. + Buffer BitsLeft BitsPerSample + { 2 copy ge { + exit + } if + 3 1 roll + 8 add 3 1 roll + 256 mul File read not { + mark (Insufficient data for function.) //error exec + } if + add + 3 1 roll + } loop % b bl pbs + sub dup % b bl-bps bl-bps + 2 index exch % b bl-bps b bl-bps + neg bitshift % b bl-bps v + 2 copy exch bitshift % b bl-bps v v<<(bl-bps) + 4 3 roll exch sub % bl-bps v b-(v<<(bl-bps)) + /Buffer exch def % bl-bps v + exch /BitsLeft exch def % v + Div div % v/(1<<pbs-1) +} bind def + +/ReadSamplesRec % <dimensions> ReadSamplesRec - +{ 0 % Will be bound below + exec +} bind def + +/ReadSamples % <dimensions> ReadSamples - +{ % The reader in on the dictionary stack. + //PDFR_DEBUG { + (ReadSamples beg ) print count = + } if + dup 1 eq { + pop + 0 1 Size 0 get 1 sub { + I exch 0 exch put + 0 1 M 1 sub { + dup Range exch 2 mul 2 getinterval % m r + //PDFR_DEBUG { + (Will read a sample ... ) print + } if + BitsPerSample 32 eq { //ReadSample32 } { //ReadSample } ifelse + exec exch //ScaleVal exec % m v + //PDFR_DEBUG { + (value=) print dup = + } if + exch Table exch get % v [] + Size length //StoreSample exec % + } for + } for + } { + 1 sub + dup Size exch get 0 exch 1 exch 1 sub { % d-1 i + I exch 2 index exch put % d-1 + dup //ReadSamplesRec exec % d-1 + } for + pop + } ifelse + //PDFR_DEBUG { + (ReadSamples end ) print count = + } if +} bind def + +//ReadSamplesRec 0 //ReadSamples put + +/StreamToArray % <obj> StreamToArray - +{ //PDFR_DEBUG { + (StreamToArray beg ) print count = + } if + userdict /FuncDataReader get begin % f + dup /BitsPerSample get /BitsPerSample exch def + dup /Size get length /N exch def + dup /Range get length 2 idiv /M exch def + 1 BitsPerSample bitshift 1 sub /Div exch def + /BitsLeft 0 def + /Buffer 0 def + dup /Size get /Size exch def % f + dup /Range get /Range exch def % f + /File 1 index //MakeStreamReader exec def % f + /I [ N { 0 } repeat ] def % f + M array % f [] + dup length 1 sub -1 0 { % f [] m + 2 index N //MakeTable exec % f [] m T + 2 index 3 1 roll put % f [] + } for + /Table exch def % f + N //ReadSamples exec % f + PDFR_DEBUG { + (Table = ) print Table == + } if + /Data Table put % + end + //PDFR_DEBUG { + (StreamToArray end ) print count = + } if +} bind def + +/FunctionToProc10 % <function_dict> FunctionToProc10 <proc> +{ % Assuming a 1-argument function type 0. + PDFR_DEBUG { + (FunctionToProc10 beg, Range = ) print dup /Range get == + } if + dup /Order //knownget exec { + 1 ne { + (Underimplemented function Type 0 Order 3.) = + } if + } if + dup //StreamToArray exec % f + dup /Range get length dup 2 eq { + pop //FunctionToProc_x01 exec % proc + } { + 2 idiv //FunctionToProc_x0n exec % proc + } ifelse + PDFR_DEBUG { + (FunctionToProc10 end) = + } if +} bind def + +/FunctionToProc12 % <function_dict> FunctionToProc12 <proc> +{ begin + currentdict /C0 //knownget exec { length 1 eq } { true } ifelse { + N + currentdict /C0 //knownget exec { + 0 get + } { + 0 + } ifelse + currentdict /C1 //knownget exec { + 0 get + } { + 1 + } ifelse + 1 index sub + [ 4 1 roll + { % x n c0 c1-c0 + 4 2 roll % c0 c1-c0 x n + excp mul add % y + } aload pop + ] cvx + } { + [ + 0 1 C0 length 1 sub { + N % [ ... i n + C0 2 index get % [ ... i n c0 + C1 3 index get % [ ... i n c0 c1 + 4 3 roll pop % [ ... n c0 c1 + 1 index sub % [ ... n c0 c1-c0 + [ /dup load % [ ... n c0 c1-c0 [ dup + 5 2 roll % [ ... [ dup n c0 c1-c0 + { % x x n c0 c1-c0 + 4 2 roll % x c0 c1-c0 x n + exp mul add % x y + exch % y x + } aload pop + ] cvx + /exec load + } for + /pop load + ] cvx + } ifelse + end + //PDFR_DEBUG { + (FunctionType2Proc : ) print dup == + } if +} bind def + + +/FunctionToProc14 % <function_dict> FunctionToProc14 <proc> +{ //MakeStreamReader exec cvx exec + //PDFR_DEBUG { + (FunctionType4Proc : ) print dup == + } if +} bind def + +/FunctionToProc1 % <function_dict> FunctionToProc <proc> +{ % Assuming a 1-argument function. + dup /FunctionType get + { dup 0 eq { + pop //FunctionToProc10 exec exit + } if + dup 2 eq { + pop //FunctionToProc12 exec exit + } if + dup 4 eq { + pop //FunctionToProc14 exec exit + } if + mark exch (Function type ) exch ( isn't implemented yet.) //error exec + } loop +} bind def + +/FunctionToProc20 % <function_dict> FunctionToProc20 <proc> +{ % Assuming a 2-argument function type 0. + PDFR_DEBUG { + (FunctionToProc20, Range = ) print dup /Range get == + } if + dup /Order //knownget exec { + 1 ne { + (Underimplemented function Type 0 Order 3.) = + } if + } if + dup //StreamToArray exec % f + dup /Range get length dup 2 eq { + pop //FunctionToProc_x01 exec % proc + } { + 2 idiv //FunctionToProc_x0n exec % proc + } ifelse +} bind def + +/FunctionToProc % <function_dict> FunctionToProc <proc> +{ //PDFR_DEBUG { + (FunctionToProc beg ) print count = + } if + dup type /dicttype eq { + dup /Domain get length 2 idiv + { + dup 1 eq { + pop //FunctionToProc1 exec exit + } if + dup 2 eq { + pop //FunctionToProc20 exec exit + } if + mark (Functions with many arguments aren't implemented yet.) //error exec + } loop + } { + //PDFR_DEBUG {(Not a function dict, assume already a procedure.) print } if + } ifelse + //PDFR_DEBUG { + (FunctionToProc end ) print count = + } if +} bind def + +/spotfunctions mark % Copied from pdf_draw.ps + /Round { + abs exch abs 2 copy add 1 le { + dup mul exch dup mul add 1 exch sub + } { + 1 sub dup mul exch 1 sub dup mul add 1 sub + } ifelse + } + /Diamond { + abs exch abs 2 copy add .75 le { + dup mul exch dup mul add 1 exch sub + } { + 2 copy add 1.23 le { + .85 mul add 1 exch sub + } { + 1 sub dup mul exch 1 sub dup mul add 1 sub + } ifelse + } ifelse + } + /Ellipse { + abs exch abs 2 copy 3 mul exch 4 mul add 3 sub dup 0 lt { + pop dup mul exch .75 div dup mul add 4 div 1 exch sub + } { + dup 1 gt { + pop 1 exch sub dup mul exch 1 exch sub + .75 div dup mul add 4 div 1 sub + } { + .5 exch sub exch pop exch pop + } ifelse + } ifelse + } + /EllipseA { dup mul .9 mul exch dup mul add 1 exch sub } + /InvertedEllipseA { dup mul .9 mul exch dup mul add 1 sub } + /EllipseB { dup 5 mul 8 div mul exch dup mul exch add sqrt 1 exch sub } + /EllipseC { dup mul .9 mul exch dup mul add 1 exch sub } + /InvertedEllipseC { dup mul .9 mul exch dup mul add 1 sub } + /Line { exch pop abs neg } + /LineX { pop } + /LineY { exch pop } + /Square { abs exch abs 2 copy lt { exch } if pop neg } + /Cross { abs exch abs 2 copy gt { exch } if pop neg } + /Rhomboid { abs exch abs 0.9 mul add 2 div } + /DoubleDot { 2 {360 mul sin 2 div exch } repeat add } + /InvertedDoubleDot { 2 {360 mul sin 2 div exch } repeat add neg } + /SimpleDot { dup mul exch dup mul add 1 exch sub } + /InvertedSimpleDot { dup mul exch dup mul add 1 sub } + /CosineDot { 180 mul cos exch 180 mul cos add 2 div } + /Double { exch 2 div exch 2 { 360 mul sin 2 div exch } repeat add } + /InvertedDouble { + exch 2 div exch 2 { 360 mul sin 2 div exch } repeat add neg + } +.dicttomark readonly def + +% ===================== Color Spaces and Colors ============== + +/CheckColorSpace % <key> <val> CheckColorSpace <key> <val> +{ + dup type /arraytype ne { + mark (Resource ) 3 index ( must be an array.) //error exec + } if +} bind def + +/SubstitutePDFColorSpaceRec % <array> SubstitutePDFColorSpace <array> +{ 0 % Will be bound below + exec +} bind def + +/SubstitutePDFColorSpace % <array> SubstitutePDFColorSpace <array> +{ + { + dup 0 get /Pattern eq { + dup length 1 gt { + dup dup 1 //CheckColorSpace //ResolveA exec + dup type /nametype ne { + //SubstitutePDFColorSpaceRec exec + } if + 1 exch put + } if + exit + } if + dup 0 get /Indexed eq { + exit + } if + dup 0 get /Separation eq { + dup dup 2 //CheckColorSpace //ResolveA exec + dup type /nametype ne { + //SubstitutePDFColorSpaceRec exec + } if + 2 exch put + exit + } if + dup 0 get /CalGray eq { + 1 get % dict + dup /Gamma //knownget exec { + [ exch /exp load ] cvx + 1 index exch /DecodeLMN exch put + } if + [ exch /CIEBasedA exch ] % [] + exit + } if + dup 0 get /CalRGB eq { + 1 get % dict + dup /Matrix //knownget exec { + 1 index exch /MatrixLMN exch put + } if + dup /Gamma //knownget exec { + aload pop + [ exch /exp load ] cvx + 3 1 roll + [ exch /exp load ] cvx + 3 1 roll + [ exch /exp load ] cvx + 3 1 roll + 3 array astore + 1 index exch /DecodeLMN exch put + } if + [ exch /CIEBasedABC exch ] % [] + exit + } if + dup 0 get /Lab eq { + 1 get % dict + begin + currentdict /Range //knownget exec { aload pop } { -100 100 -100 100 } ifelse + 0 100 6 2 roll 6 array astore + /RangeABC exch def + /DecodeABC [{16 add 116 div} bind {500 div} bind {200 div} bind] def + /MatrixABC [1 1 1 1 0 0 0 0 -1] def + { dup 6 29 div ge {dup dup mul mul} {4 29 div sub 108 841 div mul} ifelse } + /DecodeLMN [ + % Store white point implicitly inside procedures. + [ 3 index aload pop WhitePoint 0 get /mul load ] cvx + [ 4 index aload pop WhitePoint 1 get /mul load ] cvx + [ 5 index aload pop WhitePoint 2 get /mul load ] cvx + ] def pop + //PDFR_DEBUG { + (Constructed from Lab <<) = + currentdict { exch = == } forall + (>>) = + } if + [ /CIEBasedABC currentdict ] % [] + end + exit + pop + } if + % Check if this is an already substituted space + dup 0 get /CIEBasedA eq {exit} if + dup 0 get /CIEBasedABC eq {exit} if + mark exch (Unimplemented color space ) exch //error exec + } loop +} bind def + +//SubstitutePDFColorSpaceRec 0 //SubstitutePDFColorSpace put + +/ResolveArrayElement % <array> <index> ResolveArrayElement <array> +{ 2 copy get + dup type dup /arraytype eq exch + /packedarraytype eq or { % make sure its a procedure/executable array + xcheck { + 2 copy get % Get executable array + dup 0 get type /integertype eq % ensure first element is an integer + 1 index 1 get type dup /arraytype + eq exch + /packedarraytype eq or % ensure second element is executable array + and { + exec + 2 index 4 1 roll put + } { + pop pop + } ifelse + } { + pop + } ifelse + } { + pop pop + } ifelse +} bind def + +/ResolveColorSpaceArrayRec % <color_space> ResolveColorSpaceArrayRec <color_space> +{ 0 % Will be bond below. + exec +} bind def + +/SetColorSpaceSafe % <color_space> SetColorSpaceSafe - +{ + % This works against applying a pattern over a pattern space, + % which may happen due to duplication of stroking and non-stroking colors. + % gs3.70 fails when setting a pattern space and + % the (old) current color space is a pattern space. + % + % If the new color space is an array and it appears equal to the old one, + % do nothing. Otherwise set the new color space. + PDFR_DEBUG { + (SetColorSpaceSafe beg) = + } if + currentcolorspace dup type /arraytype eq { % cs cs' + 1 index type /arraytype eq { + dup length 2 index length eq { + false exch % cs b cs' + dup length 0 exch 1 exch 1 sub { % cs b cs' i + dup % cs b cs' i i + 4 index exch get exch % cs b cs' csi i + 2 index exch get % cs b cs' csi cs'i + ne { % cs b cs' + exch pop true exch exit + } if + } for % cs b cs' + pop % cs b + { + setcolorspace + } { + pop + } ifelse % + } { + pop setcolorspace + } ifelse + } { + pop setcolorspace + } ifelse + } { % cs cs' + pop setcolorspace + } ifelse + PDFR_DEBUG { + (SetColorSpaceSafe end) = + } if +} bind def + +/ResolveColorSpaceArray % <color_space> ResolveColorSpaceArray <color_space> +{ + //PDFR_DEBUG { + (ResolveColorSpaceArray beg ) print dup == + } if + dup 0 get /Indexed eq { + 1 //ResolveArrayElement exec + dup dup 1 get + dup type /arraytype eq { + //SubstitutePDFColorSpace exec + //ResolveColorSpaceArrayRec exec + 1 exch put + } { + pop pop + } ifelse + } if + dup 0 get /Separation eq { + 3 //ResolveArrayElement exec + dup 3 get //FunctionToProc exec + 2 copy 3 exch put + pop + } if + PDFR_DEBUG { + (Construcrted color space :) = + dup == + } if + //PDFR_DEBUG { + (ResolveColorSpaceArray end ) print dup == + } if +} bind def + +//ResolveColorSpaceArrayRec 0 //ResolveColorSpaceArray put + +/ResolveColorSpace % <name> ResolveColorSpace <color_space> +{ + //PDFR_DEBUG { + (ResolveColorSpace beg ) print dup = + } if + dup //SimpleColorSpaceNames exch known not { + dup //PDFColorSpaces exch //knownget exec { + exch pop + //PDFR_DEBUG { + (ResolveColorSpace known ) = + } if + } { + dup % n n + //PDFReader /CurrentObject get /Context get /Resources get + /ColorSpace //DoNothing //ResolveD exec + exch //CheckColorSpace //ResolveD exec % n cs + dup type /arraytype eq { + //SubstitutePDFColorSpace exec + //ResolveColorSpaceArray exec + dup //PDFColorSpaces 4 2 roll put % [] + } if + } ifelse + } if + //PDFR_DEBUG { + (ResolveColorSpace end ) print dup == + } if +} bind def + +/CheckPattern % <key> <val> CheckPattern <key> <val> +{ + dup /PatternType //knownget exec { + dup 1 ne { + mark (Resource ) 4 index ( is a shading, which can't be handled at level 2. ) //error exec + } if + pop + } if + dup /Type knownget { % /Type is optional for type 1 pattern dictionaries + /Pattern ne { + mark (Resource ) 4 index ( must have /Type/Pattern .) //error exec + } if + } if +} bind def + +/PaintProc % +{ /Context get % pattern_object + //RunDelayedStream exec +} bind def + +/ResolvePattern % <name> ResolvePattern <pattern> +{ + dup % n n + % Since makepattern makes a local dictionary, + % we cahche them in userdict, which is in local VM. + % Assuming unique resource name through the document + userdict /PDFR_Patterns get % n n d + exch //knownget exec { % n p + exch pop % p + } { % n + dup % n n + //PDFReader /CurrentObject get /Context get /Resources get + /Pattern //DoNothing //ResolveD exec + exch //CheckPattern //ResolveD exec % n o + dup dup /Context exch put + dup /Resources //DoNothing //ResolveD exec pop + dup /PaintProc //PaintProc put + gsave userdict /PDFR_InitialGS get setgstate + currentglobal exch false setglobal % gs3_70 compatibility + dup /Matrix get + makepattern % n p + exch setglobal % gs3_70 compatibility + grestore + dup userdict /PDFR_Patterns get % n p p d + 4 2 roll % p d n p + put % p + } ifelse +} bind def + +/SetColor % Same arguments and result as for scn +{ //PDFR_DEBUG { + (SetColor beg) = + } if + currentcolorspace dup type /nametype eq { + pop setcolor + } { + 0 get /Pattern eq { + //ResolvePattern exec setpattern + } { + setcolor + } ifelse + } ifelse + //PDFR_DEBUG { + (SetColor end) = + } if +} bind def + +% ===================== Images =============================== + +/ImageKeys 15 dict begin + /BPC /BitsPerComponent def + /CS /ColorSpace def + /D /Decode def + /DP /DecodeParms def + /F /Filter def + /H /Height def + /IM /ImageMask def + % /Intent is undefined - pdfwrite must take care of. + /I /Interpolate def + /W /Width def +currentdict end readonly def + +/ImageValues 15 dict begin + /G /DeviceGray def + /RGB /DeviceRGB def + /CMYK /DeviceCMYK def + /I /Indexed def + /AHx /ASCIIHexDecode def + /A85 /ASCII85Decode def + /LZW /LZWDecode def + /Fl /FlateDecode def + /RL /RunLengthDecode def + /CCF /CCITTFaxDecode def + /DCT /DCTDecode def +currentdict end readonly def + +/GetColorSpaceRange +{ 2 index /ColorSpace get + dup type /arraytype eq { + 1 get + } if + exch //knownget exec { + exch pop + } if +} bind def + +/DecodeArrays 15 dict begin + /DeviceGray { [0 1] } def + /DeviceRGB { [0 1 0 1 0 1] } def + /DeviceCMYK { [0 1 0 1 0 1 0 1] } def + /Indexed { + dup /BitsPerComponent get 1 exch bitshift 1 sub [exch 0 exch] + } def + /Separation { [0 1] } def + /CIEBasedA { [0 1] /RangeA //GetColorSpaceRange exec } def + /CIEBasedABC { [0 1 0 1 0 1] /RangeABC //GetColorSpaceRange exec } def +currentdict end readonly def + +/Substitute % <key> <dict> Substitute <key> +{ 1 index //knownget exec { + exch pop + } if +} bind def + +/DebugImagePrinting % <image_dict> DebugImagePrinting <image_dict> +{ + //PDFR_DEBUG { + (Image :) = + dup { exch //=only exec ( ) print == + } forall + } if +} bind def + +/CompleteImage % <dict> CompleteImage <image_dict> +{ + dup /ColorSpace known { + dup /ColorSpace //CheckColorSpace //ResolveD exec pop + } if + dup /Decode known not { + dup /ColorSpace //knownget exec { + dup type /arraytype eq { + 0 get + } if + //DecodeArrays exch get exec + } { + [0 1] + } ifelse + 1 index exch /Decode exch put + } if + dup /ImageMatrix [2 index /Width get 0 0 5 index /Height get neg + 0 7 index /Height get] put % Not sure why upside down ? + //DebugImagePrinting exec +} bind def + +/CompleteInlineImage % <dict> CompleteInlineImage <image_dict> +{ + //PDFR_DEBUG { + (CompleteInlineImage beg) = + } if + dup /ImageType known not { + dup /ImageType 1 put + } if + dup length dict exch { % d key val + exch //ImageKeys //Substitute exec + dup /Filter eq { + exch //ImageValues //Substitute exec exch + } if + dup /ColorSpace eq { + exch + dup //ImageValues exch //knownget exec { + exch pop + } { + //ResolveColorSpace exec + } ifelse + exch + } if + exch + 2 index 3 1 roll put + } forall + //CompleteImage exec + dup /DataSource 2 copy get % d d /n f + 2 index //AppendFilters exec put + //PDFR_DEBUG { + (CompleteInlineImage end) = + } if +} bind def + +/CompleteOutlineImage % <dict> CompleteOutlineImage <image_dict> +{ + currentglobal exch dup gcheck setglobal + //PDFR_DEBUG { + (CompleteOutlineImage beg) = + } if + % todo: ResetStreamReader if DataSource already exists. + dup dup //MakeStreamReader exec /DataSource exch put + dup /ImageType known not { + //CompleteImage exec + dup /ImageType 1 put + dup /ColorSpace known { + dup /ColorSpace //CheckColorSpace //ResolveD exec + dup type /arraytype eq { + //ResolveColorSpaceArray exec + //SubstitutePDFColorSpace exec + 1 index exch /ColorSpace exch put + } { + pop + } ifelse + } if + } if + //PDFR_DEBUG { + (CompleteOutlineImage end) = + } if + exch setglobal +} bind def + +/DoImage % <image_dict> DoImage - +{ + //PDFR_DEBUG { + (DoImage beg) = + } if + gsave + dup /ColorSpace //knownget exec { setcolorspace } if + dup /ImageMask //knownget exec not { false } if + { imagemask } { image } ifelse + grestore + //PDFR_DEBUG { + (DoImage end) = + } if +} bind def + +% ===================== Viewer State =============== + +/GSave % - GSave - +{ + gsave + //PDFReader /GraphicStateStackPointer get + dup //GraphicStateStack exch get null eq { + dup //GraphicStateStack exch //InitialGraphicState length dict put + } if + dup //GraphicStateStack exch get + //GraphicState exch copy pop + 1 add //PDFReader exch /GraphicStateStackPointer exch put +} bind def + +/GRestore % - GRestore - +{ + grestore + //PDFReader /GraphicStateStackPointer get + 1 sub dup + //PDFReader exch /GraphicStateStackPointer exch put + //GraphicStateStack exch get + //GraphicState copy pop +} bind def + + +% ===================== Interpret Data Streams =============== + +/SetFont % <resource_name> <size> SetFont - +{ dup //GraphicState exch /FontSize exch put + //ResolveAndSetFont exec + //GraphicState /FontMatrixNonHV currentfont /FontMatrix get 1 get 0 ne put +} bind def + +/ShowText % <string> ShowText - +{ //GraphicState /TextRenderingMode get 0 eq { + //GraphicState /WordSpacing get 0 + 32 + //GraphicState /CharacterSpacing get 0 + 6 5 roll + //GraphicState /FontMatrixNonHV get { + % Use xshow to force wy in text space to be 0 (PDF1.7 5.3.3 "Text Space Details") + %stack: wordspacing_wx wordspacing_wy space_char charspacing_wx charspacing_wy string + [ % wwx wwy sp cwx cwy str [ + 7 -2 roll pop % sp cwx cwy str [ ww + 5 -2 roll pop % sp str [ ww cw + 5 -1 roll % str [ ww cw sp + { % str [ ... ww cw sp c wx wy + exch % will be removed, unless FontMatrix.xx == 0 (FontMatrixNonHV already true) + pop % str [ ... ww cw sp c w + 3 index add % str [ ... ww cw sp c w+cw + exch 2 index eq { 3 index add } if % str [ ... ww cw sp w+cw[+ww] + 4 1 roll % str [ ... w+cw[+ww] ww cw sp + } + currentfont /FontMatrix get 0 get 0 ne { + 1 1 index length 1 sub getinterval cvx % drop the "exch" + } if + 5 index % str [ ww cw sp {cshowproc} str + cshow % str [ widths... ww cw sp + pop pop pop ] % str [widths...] + xshow + } { + awidthshow + } ifelse + } { + //GraphicState /CharacterSpacing get 0 eq + //GraphicState /FontMatrixNonHV get not and + //GraphicState /WordSpacing get 0 eq and { + true charpath + } { + % Emulate with "{ charpath } cshow". + % Not sure how it works with CID fonts. + { % c wx wy + exch % will be removed, unless FontMatrixNonHV && FontMatrix.xx == 0 + pop 0 % (PDF1.7 5.3.3 "Text Space Details") + currentpoint 5 4 roll % wx wy x y c + ( ) dup 0 3 index put true charpath % wx wy x y c + 5 1 roll % c wx wy x y + moveto rmoveto % c + //GraphicState /CharacterSpacing get 0 rmoveto % c + 32 eq { % + //GraphicState /WordSpacing get 0 rmoveto + } if + } + //GraphicState /FontMatrixNonHV get dup not exch { + pop currentfont /FontMatrix get 0 get 0 ne + } if { + 1 1 index length 1 sub getinterval cvx + } if + exch cshow + } ifelse + } ifelse +} bind def + +/ShowTextBeg % - ShowTextBeg - +{ //GraphicState /TextRenderingMode get 0 ne { + currentpoint newpath moveto + } if +} bind def + +/ShowTextEnd % - ShowTextEnd - +{ //GraphicState /TextRenderingMode get + { dup 1 eq { + stroke exit + } if + dup 2 eq { + gsave fill grestore stroke exit + } if + dup 3 eq { + currentpoint newpath moveto + } if + dup 4 eq { + gsave fill grestore clip exit + } if + dup 5 eq { + gsave stroke grestore clip exit + } if + dup 6 eq { + gsave fill grestore gsave stroke grestore fill exit + } if + dup 7 eq { + clip exit + } if + exit + } loop + pop +} bind def + +/ShowTextWithGlyphPositioning % <array> ShowTextWithGlyphPositioning - +{ //ShowTextBeg exec + { dup type /stringtype eq { + //ShowText exec + } { + neg 1000 div //GraphicState /FontSize get mul 0 rmoveto + } ifelse + } forall + //ShowTextEnd exec +} bind def + +/CheckFont % key val CheckFont key val +{ dup /Type get /ExtGState ne { + mark (Resource ) 3 index ( must have /Type/ExtGState.) //error exec + } if +} bind def + +/SetTransfer % <operand> SetTransfer - +{ + //PDFR_DEBUG { (SetTransfer beg ) print count = } if + dup type /arraytype eq 1 index xcheck not and { + 0 4 getinterval aload pop + setcolortransfer + } { + settransfer + } ifelse + //PDFR_DEBUG { (SetTransfer end ) print count = } if +} bind def + +/CheckExtGState % <id> <obj> CheckExtGState <id> <obj> +{ dup /Type get /ExtGState ne { + mark (Resource ) 3 index ( must have /Type/ExtGState.) //error exec + } if +} bind def + +/CheckHalftone % <id> <obj> CheckHalftone <id> <obj> +{ dup /HalftoneType known not { + mark (Resource ) 3 index ( must have /HalftoneType.) //error exec + } if +} bind def + +/ResolveFunction % <dict> <name> ResolveFunction <dict> <proc> +{ + //PDFR_DEBUG { (ResolveFunction beg ) print dup = count = } if + 2 copy get //IsObjRef exec { + 2 copy //DoNothing //ResolveD exec + 3 copy put pop + } if + 2 copy get dup type /arraytype eq exch xcheck and not { + 2 copy get + dup type /arraytype eq 1 index xcheck not and { + dup length 1 sub -1 0 { + 2 copy //DoNothing ResolveA + dup /Identity eq { + pop 2 copy {} put + } { + //FunctionToProc exec + 3 copy put pop + } ifelse + pop + } for + } { + dup /Default eq { + % Leave it. ExtGState methods will resolve. + } { + dup /Identity eq { + pop {} + } { dup type /nametype eq { + //spotfunctions exch get + } { + //FunctionToProc exec + } ifelse + } ifelse + } ifelse + } ifelse + 3 copy put + exch pop + } { + 1 index exch get + } ifelse + //PDFR_DEBUG { (ResolveFunction end ) print dup == count = } if +} bind def + +/ResolveFunctionSafe % <dict> <name> ResolveFunctionSafe <dict> +{ 2 copy known { + //ResolveFunction exec + } if + pop +} bind def + +/CreateHalftoneThresholds % <halftone_dict> CreateHalftoneThresholds <halftone_dict> +{ + dup /Thresholds known not { + dup /HalftoneType get 10 eq { + dup dup //MakeStreamReader exec + /Thresholds exch put + } if + dup /HalftoneType get dup 3 eq exch 6 eq or { + dup dup //MakeStreamReader exec + //BlockBuffer readstring pop + dup length + dup 0 eq { + mark (Could not read Thresholds) //error exec + } if + string copy /Thresholds exch put + dup /HalftoneType 3 put % replace Type 6 with Type 3. + } if + } if +} bind def + + +/SetExtGState % <name> SetExtGState - +{ + //PDFReader /CurrentObject get /Context get /Resources get + /ExtGState //DoNothing //ResolveD exec + exch //CheckExtGState //ResolveD exec % s gs + dup /LW //knownget exec { + setlinewidth + } if + dup /LC //knownget exec { + setlinecap + } if + dup /LJ //knownget exec { + setlinejoin + } if + dup /ML //knownget exec { + setmeterlimit + } if + dup /D //knownget exec { + setdash + } if + dup /RI //knownget exec { + % Ghostscript never writes it. + mark (Unimplemented ExtGState.RI) //error exec + } if + dup /OP //knownget exec { + % pdfwrite must take care of stroking/filling + setoverprint + } if + dup /op //knownget exec { + setoverprint + } if + dup /OPM //knownget exec { + % pdfwrite must take care of. + mark (Unimplemented ExtGState.OPM) //error exec + } if + dup /Font //knownget exec { + % Ghostscript never writes it. + mark (Unimplemented ExtGState.Font) //error exec + } if + dup /BG known { + /BG //ResolveFunction exec + setblackgeneration + } if + dup /BG2 known { + /BG2 //ResolveFunction exec + dup /Default eq { + //InitialExtGState /BG2 get + } if + setblackgeneration + } if + dup /UCR known { + /UCR //ResolveFunction exec + setundercolorremoval + } if + dup /UCR2 known { + /UCR2 //ResolveFunction exec + dup /Default eq { + //InitialExtGState /UCR2 get + } if + setundercolorremoval + } if + dup /TR known { + /TR //ResolveFunction exec + //SetTransfer exec + } if + dup /TR2 known { + /TR2 //ResolveFunction exec + dup /Default eq { + pop //InitialExtGState /TR2 get + aload pop setcolortransfer + } { + //SetTransfer exec + } ifelse + } if + dup /HT //knownget exec { + dup /Default eq { + pop //InitialExtGState /HT get + sethalftone + } { + //PDFR_DEBUG { (Ht beg) = } if + pop dup /HT //CheckHalftone //ResolveD exec + /SpotFunction //ResolveFunctionSafe exec + /TransferFunction //ResolveFunctionSafe exec + null exch + dup /HalftoneType get dup 5 eq exch dup 4 eq exch 2 eq or or { + dup { % null h n v + dup //IsObjRef exec { + pop + 1 index exch //CheckHalftone ResolveD + } if + dup type /dicttype eq { + dup /SpotFunction //ResolveFunctionSafe exec + /TransferFunction //ResolveFunctionSafe exec + //CreateHalftoneThresholds exec + dup /HalftoneType get 5 gt { % null h n v + 4 3 roll pop + dup 4 1 roll + } if + } if + pop pop + } forall + } if + //CreateHalftoneThresholds exec + //PDFR_DEBUG { + (HT:)= + dup { + 1 index /Default eq { + (Default <<)= + exch pop + { exch = == } forall + (>>)= + } { + exch = == + } ifelse + } forall + (HT end)= flush + } if + exch dup null ne { + (Warning: Ignoring a halftone with a Level 3 component halftone Type ) print dup /HalftoneType get = + pop pop + } { + pop + dup /HalftoneType get 5 gt { + (Warning: Ignoring a Level 3 halftone Type ) print dup /HalftoneType get = + pop + } { + sethalftone + } ifelse + } ifelse + //PDFR_DEBUG { (HT set)= flush } if + } ifelse + } if + dup /FL //knownget exec { + setflattness + } if + dup /SM //knownget exec { + setsmoothness + } if + dup /SA //knownget exec { + setstrokeadjust + } if + dup /BM //knownget exec { + % pdfwrite must take care of. + mark (Unimplemented ExtGState.BM) //error exec + } if + dup /SMask //knownget exec { + % pdfwrite must take care of. + mark (Unimplemented ExtGState.SMask) //error exec + } if + dup /CA //knownget exec { + % pdfwrite must take care of. + mark (Unimplemented ExtGState.CA) //error exec + } if + dup /ca //knownget exec { + % pdfwrite must take care of. + mark (Unimplemented ExtGState.ca) //error exec + } if + dup /AIS //knownget exec { + % pdfwrite must take care of. + mark (Unimplemented ExtGState.AIS) //error exec + } if + dup /TK //knownget exec { + % pdfwrite must take care of. + mark (Unimplemented ExtGState.TK) //error exec + } if + pop +} bind def + +/CheckXObject % <id> <obj> CheckHalftone <id> <obj> +{ dup /Subtype get dup /Image ne exch dup /Form ne exch /PS ne and and { + mark (Resource ) 3 index ( must have /Subtype /Image or /Form or /PS.) //error exec + } if +} bind def + +/DoXObject % <name> DoXObject - +{ + //PDFReader /CurrentObject get /Context get /Resources get + /XObject //DoNothing //ResolveD exec + exch //CheckXObject //ResolveD exec + dup /Subtype get + dup /Image eq { + pop + //CompleteOutlineImage exec + //DoImage exec + } { + dup /PS eq { + PDFR_DEBUG { + (Executing a PS Xobject) = + } if + pop + //RunDelayedStream exec + } { + dup /Form eq { + pop + PDFR_DEBUG { + (Executing a Form XObject) = + } if + //PDFReader /CurrentObject get exch + dup //PDFReader exch << exch /Context exch >> /CurrentObject exch put + dup /Matrix get concat + dup /BBox get aload pop exch 3 index sub exch 2 index sub rectclip + //RunDelayedStream exec + //PDFReader exch /CurrentObject exch put + } { + mark exch (unimplemented XObject type ) exch //error exec + } ifelse + } ifelse + } ifelse +} bind def + +/Operators 50 dict begin + /q { //GSave exec } bind def + /Q { //GRestore exec } bind def + /cm { //TempMatrix astore concat } bind def + /i { 1 .min setflat } bind def + /J /setlinecap load def + /d /setdash load def + /j /setlinejoin load def + /w /setlinewidth load def + /M /setmiterlimit load def + /gs { SetExtGState } bind def + + /g /setgray load def + /rg /setrgbcolor load def + /k /setcmykcolor load def + /cs { //ResolveColorSpace exec //SetColorSpaceSafe exec + } bind def + /sc /setcolor load def + /scn { //SetColor exec } bind def + /G /setgray load def + /RG /setrgbcolor load def + /K /setcmykcolor load def + /CS //cs def + /ri { SetColorRenderingIntent } bind def + /SC /setcolor load def + /SCN { //SetColor exec } bind def + + /m /moveto load def + /l /lineto load def + /c /curveto load def + /v { currentpoint 6 2 roll curveto } bind def + /y { 2 copy curveto } bind def + /re { + 4 2 roll moveto exch dup 0 rlineto 0 3 -1 roll rlineto neg 0 rlineto + closepath + } def + /h /closepath load def + /n /newpath load def + /S /stroke load def + /s { closepath stroke } bind def + /f /fill load def + /f* /eofill load def + /B { gsave fill grestore stroke } bind def + /b { closepath gsave fill grestore stroke } bind def + /B* { gsave eofill grestore stroke } bind def + /b* { closepath gsave eofill grestore stroke } bind def + /W /clip load def + /W* /eoclip load def + /sh { % Reserved for ps3write. + ResolveShading + dup /Background known { + gsave + dup /ColorSpace get setcolorspace + dup /Background get aload pop setcolor + pathbbox % x0 y0 x1 y1 + 2 index sub exch 3 index sub exch + rectfill + grestore + } if + shfill + } bind def + + /Do { //DoXObject exec } bind def + + /BI { currentglobal false setglobal << } bind def + /ID { >> + dup /DataSource currentfile + % HACK BEG + % This hack provides a compatibility to HP LaserJet 1320, + % which sometimes closes the underlying stream when EOD + % is reached in the ASCII85Decode filter. + % This portion is not required by the Postscript language definition. + 2 index /F //knownget exec { + /A85 eq { + 0 (~>) /SubFileDecode filter + } if + } if + % HACK END + put + //CompleteInlineImage exec + exch setglobal + //DoImage exec + } bind def + /EI {} bind def + + /BT { gsave //GraphicState /InitialTextMatrix get currentmatrix pop } bind def + /ET { grestore } bind def + /Tc { //GraphicState exch /CharacterSpacing exch put } bind def + /TL { //GraphicState exch /TextLeading exch put } bind def + /Tr { //GraphicState exch /TextRenderingMode exch put } bind def + /Ts { % Ghostscript never generates it. + mark (Unimplemented SetTextRise) //error exec + } bind def + /Tw { //GraphicState exch /WordSpacing exch put } bind def + /Tz { % Ghostscript never generates it. + mark (Unimplemented SetHorizontalTextScaling) //error exec + } bind def + /Td { translate 0 0 moveto } bind def + /TD { dup neg //TL exec //Td exec } bind def + /Tm { //GraphicState /InitialTextMatrix get setmatrix + //TempMatrix astore concat + 0 0 moveto } bind def + /T* { 0 //GraphicState /TextLeading get neg //Td exec } bind def + /Tj { //ShowTextBeg exec //ShowText exec //ShowTextEnd exec } bind def + /' { //T* exec //ShowText exec //ShowTextEnd exec } bind def + /" { 3 2 roll //Tw exec exch //Tc exec //' exec} bind def + /TJ //ShowTextWithGlyphPositioning def + /Tf //SetFont def + + /d0 /setcharwidth load def + /d1 /setcachedevice load def + + /BDC { BeginMarkedContentSequenceWithPropertyList } bind def + /BMC { BeginMarkedContentSequence } bind def + /EMC { EndMarkedContentSequence } bind def + /BX { BeginCompatibilitySection } bind def + /EX { EndCompatibilitySection } bind def + /DP { DefineMarkedContentPointWithPropertyList } bind def + /MP { DefineMarkedContentPoint } bind def + /PS { cvx exec } bind def +currentdict end def + +//PDFR_STREAM { + % Rebind operators with a debug tracing. + //Operators length dict begin + //Operators { % n p + exch dup % p n n + [ exch //=only /exec load % p n [ n =only exec + ( ) /print load % p n [ n =only exec () print + 8 7 roll % n [ n =only exec () print p + dup type /arraytype eq { + /exec load % n [ n =only exec () print p exec + } if + ( ) /print load + ] cvx % n {} + def + } forall + currentdict end /Operators exch def +} if + +% Functions for handling Ghostscript library files that define encodings. + +/.registerencoding +{ pop pop +} bind def + +/.defineencoding +{ def +} bind def + +/.findencoding +{ load +} bind def + + +% Leaving the procset on the dictionary stack to provide +% definitions of obj, endobj, stream, endstream, R, xref. +%%EndPrologue diff --git a/Master/tlpkg/tlgs/lib/packfile.ps b/Master/tlpkg/tlgs/lib/packfile.ps index a7690448947..021de4ae504 100644 --- a/Master/tlpkg/tlgs/lib/packfile.ps +++ b/Master/tlpkg/tlgs/lib/packfile.ps @@ -1,19 +1,19 @@ % Copyright (C) 1994, 1995, 1996 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: packfile.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % packfile.ps % Pack groups of files together, with compression, for use in % storage-scarce environments. @@ -42,21 +42,21 @@ /addstats % <file> addstats - { 0 { 1 index //statbuf readstring 3 1 roll - % Stack: file eof numzeros data + % 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 + { 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 @@ -67,7 +67,7 @@ /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 + % Put statistics into array dup 0 1 255 { zfreq 1 index get nzfreq 2 index get add put dup } for @@ -143,9 +143,9 @@ tempname (w) file dup /MoveToFrontEncode filter dup << - /BlockSize 1000000 + /BlockSize 1000000 >> /BWBlockSortEncode filter - % Stack: filenames outfile tempfile mtfe bwe + % 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 @@ -153,23 +153,23 @@ 5 -1 roll add 4 1 roll } forall closefile closefile closefile pop exch - % Stack: posdict outfile - % Compute an optimal Huffman code. + % 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. + % 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. + % 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 + /MaxCodeLength maxcode + /EndOfData true + /EncodeZeroRuns 256 + /Tables statcodes >> /BoundedHuffmanEncode filter tempname (r) file exch copyfile pop closefile exch @@ -183,26 +183,26 @@ Fontmap exch get } loop - % Stack: fontname filename + % Stack: fontname filename dup dup { (.) search not { exit } if exch pop exch 3 -1 roll pop } loop - % Stack: fontname filename noextname extension + % 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 + % 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 + % Stack: outfilename fontname filename extension outfile exch dup (pfa) eq exch (pfb) eq or - % Stack: outfilename fontname filename outfile bool + % Stack: outfilename fontname filename outfile bool { exch pop compressfont } { 3 -1 roll pop @@ -245,7 +245,7 @@ false .setglobal % Fewer larger groups compress better, but make decompression slower. /Lists [ [ % The oblique and narrow fonts are synthetic, - % and take very little space. + % and take very little space. /AvantGarde-BookOblique /AvantGarde-DemiOblique /Courier-Oblique /Courier-BoldOblique /Helvetica-Oblique /Helvetica-BoldOblique @@ -272,7 +272,7 @@ false .setglobal /Lists Lists mark exch { mark exch { { Fontmap 1 index get dup type /nametype ne { pop exit } if - exch pop + exch pop } loop } diff --git a/Master/tlpkg/tlgs/lib/pcharstr.ps b/Master/tlpkg/tlgs/lib/pcharstr.ps index 133c920d9c7..eba70e7cf1c 100644 --- a/Master/tlpkg/tlgs/lib/pcharstr.ps +++ b/Master/tlpkg/tlgs/lib/pcharstr.ps @@ -1,19 +1,19 @@ % Copyright (C) 1990, 1992, 1997, 1999 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: pcharstr.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % pcharstr.ps % Print the CharStrings and Subrs (if present) from a Type 1 font, % in either a PostScript-like or a C-compatible form, @@ -87,7 +87,7 @@ begin currentfont begin Private begin 10 dict begin - % Print the CharStrings and Subrs + % Print the CharStrings and Subrs beginchars CharStrings { exch charbegin printcs } forall @@ -102,7 +102,7 @@ endsubrs } if - % Print the bounding boxes + % Print the bounding boxes gsave nulldevice FontMatrix matrix invertmatrix concat beginboxes @@ -113,8 +113,8 @@ { 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 + pathbbox ({) print 4 -1 roll =only , + 3 -1 roll =only , exch =only , =only (}) print boxend } ifelse diff --git a/Master/tlpkg/tlgs/lib/pdf2dsc.ps b/Master/tlpkg/tlgs/lib/pdf2dsc.ps index 792d7f19f6f..c38f2b95de7 100644 --- a/Master/tlpkg/tlgs/lib/pdf2dsc.ps +++ b/Master/tlpkg/tlgs/lib/pdf2dsc.ps @@ -1,19 +1,19 @@ % Copyright (C) 1994, 1995, 1996, 1997, 1998 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: pdf2dsc.ps 8546 2008-02-25 05:48:45Z alexcher $ +% $Id$ % pdf2dsc.ps % read pdf file and produce DSC "index" file. % @@ -63,9 +63,9 @@ systemdict /.setsafe known { .setsafe } if % scan through for media sizes, keep them in the dictionary FirstPage 1 LastPage { pdfgetpage /MediaBox pget pop % MediaBox is a required attribute - aload pop + aload pop 3 -1 roll sub 3 1 roll exch sub exch - 2 array astore + 2 array astore aload 3 1 roll 10 string cvs exch 10 string cvs (x) 3 -1 roll concatstrings concatstrings cvn MediaTypes 3 1 roll exch put @@ -91,13 +91,13 @@ systemdict /.setsafe known { .setsafe } if if % This is really supposed to be sorted by frequency of usage... (%%DocumentMedia: ) - MediaTypes { + MediaTypes { exch pop 1 index puts (y) puts dup 1 get DSCstring cvs puts - (x) puts dup 0 get DSCstring cvs puts + (x) puts dup 0 get DSCstring cvs puts ( ) puts dup 0 get DSCstring cvs puts - ( ) puts 1 get DSCstring cvs puts + ( ) puts 1 get DSCstring cvs puts ( 70 white ()\n) puts pop (%%+ ) } forall @@ -116,7 +116,7 @@ systemdict /.setsafe known { .setsafe } if DSCfile PDFname write==only ( \(r\) file { DELAYSAFER { .setsafe } if } stopped pop\n) puts ( pdfopen begin\n) puts - ( copy_trailer_attrs\n) puts + ( process_trailer_attrs\n) puts (%%EndSetup\n) puts /.hasPageLabels false def % see "Page Labels" in the PDF Reference @@ -222,9 +222,9 @@ systemdict /.setsafe known { .setsafe } if dup pdfgetpage dup /MediaBox pget pop (%%PageMedia: y) puts - aload pop 3 -1 roll sub DSCstring cvs puts - (x) puts exch sub DSCstring cvs puts - (\n) puts + aload pop 3 -1 roll sub DSCstring cvs puts + (x) puts exch sub DSCstring cvs puts + (\n) puts dup /CropBox pget { (%%PageBoundingBox: ) puts {DSCfile exch write=only ( ) puts} forall diff --git a/Master/tlpkg/tlgs/lib/pdfopt.ps b/Master/tlpkg/tlgs/lib/pdfopt.ps index 26b13a782a5..74cb91994db 100644 --- a/Master/tlpkg/tlgs/lib/pdfopt.ps +++ b/Master/tlpkg/tlgs/lib/pdfopt.ps @@ -1,19 +1,19 @@ % Copyright (C) 2000, 2001 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: pdfopt.ps 9390 2009-01-23 19:04:40Z alexcher $ +% $Id$ % PDF linearizer ("optimizer"). .currentglobal true .setglobal @@ -56,7 +56,7 @@ pdfoptdict begin /dacontstring { % <darray> dacontstring <string> 0 1 index { exch pop length add } forall string dup /NullEncode filter - % Stack: darray str filter + % Stack: darray str filter 3 -1 roll { 1 index exch writestring } daforall closefile } bind def @@ -127,7 +127,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc] /clostream { % <data> <proc> <endproc> clostream <stream> 2 index 3 -1 roll /exec load 3 packedarray cvx /NullEncode filter - % Stack: data endproc stream + % Stack: data endproc stream clostreams 1 index 5 -2 roll 2 array astore put } bind def % Close a closure-based stream. @@ -174,7 +174,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc] /N exch def N bitshift B add } { 2 copy bitshift B add S exch write - % Stack: value -left + % Stack: value -left { 8 add dup 0 ge { exit } if 2 copy bitshift 255 and S exch write } loop @@ -214,7 +214,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc] /copyrange { % <start> <end> copybytes - TFile 2 index setfileposition exch sub 1024 string exch { - % Stack: buf left + % Stack: buf left 2 copy 1 index length .min 0 exch getinterval TFile exch readstring pop OFile exch writestring 1 index length sub dup 0 le { exit } if @@ -239,7 +239,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc] { touch touch } forall } { dup xcheck { - % Executable array, must be an indirect object. + % Executable array, must be an indirect object. dup 0 get resolved? { pop pop } { oforce touch } ifelse } { { touch } forall @@ -275,7 +275,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc] /replaceReferences { % - replaceReferences - Objects { replacerefs pop } lforall - % Delete replaced objects. + % Delete replaced objects. 0 1 Objects llength 1 sub { Objects 1 index lget replaceable? { PDFOPTDEBUG { (Deleting ) print dup = } if @@ -289,7 +289,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc] /createObjects { % [<obj>...] createObjects <firstobj#> Objects llength dup dup 3 index length add growPDFobjects - % Stack: objects objn objn + % Stack: objects objn objn 3 1 roll exch { Objects 2 index 3 -1 roll lput Generations 1 index 1 lput @@ -300,39 +300,39 @@ userdict /clostreams 20 dict put % stream -> [data endproc] % ---------------- Propagate attributes ---------------- % /nopropattrs << - % Never propagate these. + % Never propagate these. /Type dup /Kids dup /Count dup /Parent dup - % Handle Resources specially. + % Handle Resources specially. /Resources dup >> def % Merge Resources. /mergeres { % <fromdict> <todict> mergeres - - % Values in todict take priority over fromdict. + % Values in todict take priority over fromdict. 1 index /Resources .knownget { 1 index /Resources .knownget { - % Stack: fromdict todict fromres tores + % Stack: fromdict todict fromres tores exch oforce exch oforce - % todict's Resources may be shared, so make a copy. + % todict's Resources may be shared, so make a copy. dup length dict .copydict exch { - % Stack: fromdict todict tores' fromkey fromvalue - 2 index 2 index knownoget { - % Stack: fromdict todict tores' fromkey fromvalue tovalue - exch oforce exch - % ProcSet is an array, other types are dictionaries. - dup type /dicttype eq { - % Dictionary, not ProcSet. - exch dup length 2 index length add dict .copydict .copydict - } { - % Array or packed array, ProcSet. - % Use dictionaries to do the merge. - dup length 2 index length add dict begin - exch { dup def } forall { dup def } forall - mark currentdict end { pop } forall .packtomark - } ifelse - } if - 2 index 3 1 roll put + % Stack: fromdict todict tores' fromkey fromvalue + 2 index 2 index knownoget { + % Stack: fromdict todict tores' fromkey fromvalue tovalue + exch oforce exch + % ProcSet is an array, other types are dictionaries. + dup type /dicttype eq { + % Dictionary, not ProcSet. + exch dup length 2 index length add dict .copydict .copydict + } { + % Array or packed array, ProcSet. + % Use dictionaries to do the merge. + dup length 2 index length add dict begin + exch { dup def } forall { dup def } forall + mark currentdict end { pop } forall .packtomark + } ifelse + } if + 2 index 3 1 roll put } forall } if /Resources exch put pop } { @@ -342,9 +342,9 @@ userdict /clostreams 20 dict put % stream -> [data endproc] % Merge attributes other than Resources. /mergeattrs { % <fromdict> <todict> mergeattrs <fromdict> <todict> - % Values in todict take priority over fromdict. + % Values in todict take priority over fromdict. 1 index { - % Stack: fromdict todict fromkey fromvalue + % Stack: fromdict todict fromkey fromvalue //nopropattrs 2 index known { pop pop } { @@ -355,19 +355,19 @@ userdict /clostreams 20 dict put % stream -> [data endproc] % Propagate attributes to a subtree. /proppage { % <attrs> <subtree> proppage - - % We should be able to tell when we reach a leaf - % by finding a Type unequal to /Pages. Unfortunately, - % some files distributed by Adobe lack the Type key - % in some of the Pages nodes! Instead, we check for Kids. + % We should be able to tell when we reach a leaf + % by finding a Type unequal to /Pages. Unfortunately, + % some files distributed by Adobe lack the Type key + % in some of the Pages nodes! Instead, we check for Kids. dup /Kids knownoget { - % Accumulate inherited values. + % Accumulate inherited values. 3 1 roll - % Stack: kids attrs pagesnode + % Stack: kids attrs pagesnode dup length dict .copydict mergeattrs dup 3 1 roll mergeres exch { oforce 1 index exch proppage } forall pop } { - % Merge inherited values into the leaf. + % Merge inherited values into the leaf. mergeattrs mergeres } ifelse } bind def @@ -383,7 +383,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc] { Trailer /Root omget dup /PageMode .knownget { omvisit } if - % Don't allow omvisit to trace references to Page objects. + % Don't allow omvisit to trace references to Page objects. dup /OpenAction .knownget { omvisitnopage } if Trailer /Encrypt .knownget { omvisit } if dup /Threads .knownget { @@ -401,12 +401,12 @@ userdict /clostreams 20 dict put % stream -> [data endproc] exch /FontDescriptor eq { omforce dup /Flags .knownget { 32 and 0 ne } { false } ifelse exch { - exch dup dup /FontFile eq exch /FontFile2 eq or - exch /FontFile3 eq or 2 index and { - fontfiles exch dadd - } { - omvisit - } ifelse + exch dup dup /FontFile eq exch /FontFile2 eq or + exch /FontFile3 eq or 2 index and { + fontfiles exch dadd + } { + omvisit + } ifelse } forall pop } { omvisit @@ -428,28 +428,28 @@ userdict /clostreams 20 dict put % stream -> [data endproc] /fontfiles 10 darray def { omforce - % Stack: pageobj# extra page - % Visit any extra objects if applicable. + % Stack: pageobj# extra page + % Visit any extra objects if applicable. exch omvisitnopage - % Visit Annots, if any. - % We don't try to defer the drawing information. + % Visit Annots, if any. + % We don't try to defer the drawing information. dup /Annots .knownget { omvisitnopage } if - % Visit beads. + % Visit beads. dup /B .knownget { omvisitnopage } if - % Visit resources dictionaries. + % Visit resources dictionaries. dup /Resources .knownget { omforce dup { - % Visit the first-level Resource dictionaries. - omforce pop pop + % Visit the first-level Resource dictionaries. + omforce pop pop } forall { - % Visit the resources themselves. - % Skip Image XObjects, and FontFile streams if the - % FontDescriptor Flags have bit 6 set. - % We don't try to visit the resources in the order in which - % the Contents stream(s) reference(s) them. - exch dup /XObject eq { - pop oforce { - dup oforce /Subtype get /Image eq { + % Visit the resources themselves. + % Skip Image XObjects, and FontFile streams if the + % FontDescriptor Flags have bit 6 set. + % We don't try to visit the resources in the order in which + % the Contents stream(s) reference(s) them. + exch dup /XObject eq { + pop oforce { + dup oforce /Subtype get /Image eq { dup oforce /DecodeParms .knownget { oforce { exch /JBIG2Globals eq { @@ -459,32 +459,32 @@ userdict /clostreams 20 dict put % stream -> [data endproc] } ifelse } forall } if - images exch dadd - } { - omvisit - } ifelse pop - } forall - } { - /Font eq { - oforce { identifyfont pop } forall - } { - oforce omvisit - } ifelse - } ifelse + images exch dadd + } { + omvisit + } ifelse pop + } forall + } { + /Font eq { + oforce { identifyfont pop } forall + } { + oforce omvisit + } ifelse + } ifelse } forall } if - % Visit the Contents stream(s). + % Visit the Contents stream(s). dup /Contents .knownget { omvisit } if - % Visit Image XObjects. We don't try to visit them in - % reference order. + % Visit Image XObjects. We don't try to visit them in + % reference order. filter_params { omvisit } daforall images { omvisit } daforall - % Visit FontFile streams. We don't try to visit them in - % reference order. + % Visit FontFile streams. We don't try to visit them in + % reference order. fontfiles { omvisit } daforall pop } visited end - % Stack: pageobj# obj#s_larray + % Stack: pageobj# obj#s_larray [ 3 1 roll { 2 copy eq { pop } { exch } ifelse } lforall counttomark 1 roll ] @@ -510,22 +510,22 @@ userdict /clostreams 20 dict put % stream -> [data endproc] % non-shared. Note also that some objects referenced on the first page may % also be referenced from other pages. /identifyOtherPageObjects { % - identifyOtherPageObjects [<pageobj#s> ...] - % <sharedobj#s> + % <sharedobj#s> 4 dict begin /marks lstring Objects llength lgrowto def - % Collect objects of other pages and identify sharing. + % Collect objects of other pages and identify sharing. [ 2 1 pdfpagecount { null exch identifyPageObjects } for ] dup { { marks exch 2 copy lget 1 add 254 .min lput } forall } forall - % Mark document-level and first page objects. + % Mark document-level and first page objects. CatalogNs { marks exch 255 lput } lforall FirstPageNs { marks exch 255 lput } forall - % Mark the page objects themselves as non-shared. + % Mark the page objects themselves as non-shared. dup { 0 get marks exch 1 lput } forall - % Collect the non-shared objects of each page. + % Collect the non-shared objects of each page. dup [ exch { [ exch { @@ -560,7 +560,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc] SharedNs { marks exch 1 lput } forall OtherPageNs { { marks exch 1 lput } forall } forall - %****** PUT THESE IN A REASONABLE ORDER ****** + %****** PUT THESE IN A REASONABLE ORDER ****** /npobj larray 0 1 1 Objects llength 1 sub { @@ -569,7 +569,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc] } { pop } ifelse - } for + } for lgrowto def 0 @@ -587,7 +587,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc] } { pop } ifelse - } for + } for pop npobj @@ -602,7 +602,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc] OtherPageNs { { omap pop } forall } forall SharedNs { omap pop } forall NonPageNs { omap pop } lforall - % Assign object numbers for the First Page xref table last. + % Assign object numbers for the First Page xref table last. LPDictN omap % don't pop, this is the return value CatalogNs { omap pop } lforall FirstPageNs { omap pop } forall @@ -613,7 +613,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc] % Create the contents of the LPDict. /createLPDict { % <phsstart> <phsend> <firstpageend> - % <xref0start> <filelength> createLPDict - + % <xref0start> <filelength> createLPDict - LPDict dup /Linearized 1 put dup /L 4 -1 roll put % filelength @@ -627,11 +627,11 @@ userdict /clostreams 20 dict put % stream -> [data endproc] % ---------------- Adjust object positions ---------------- % /adjustObjectPositions { % <boundary> <deltabelow> <deltaabove> - % adjustObjectPositions - - % Objects fall into 4 categories: LPDict, PHS, Catalog, and others. - % We handle the first two as special cases. + % adjustObjectPositions - + % Objects fall into 4 categories: LPDict, PHS, Catalog, and others. + % We handle the first two as special cases. XRef { - % Stack: bdy below above key loc + % Stack: bdy below above key loc dup 5 index ge { 2 } { 3 } ifelse index add XRef 3 1 roll ld_put } ld_forall pop pop pop @@ -771,15 +771,15 @@ userdict /clostreams 20 dict put % stream -> [data endproc] PDFOPTDEBUG { (\) = ) print dup = } if } bind def /omend { % <obj#> omend <pos> - % The end of an object is the start of the next object. - % The caller must be sure that this object is not the last one - % in part 9. + % The end of an object is the start of the next object. + % The caller must be sure that this object is not the last one + % in part 9. PDFOPTDEBUG { (end\() print dup =only } if omap PDFOPTDEBUG { (=>) print dup =only } if 1 add - % Check that the requested object wasn't the last one in part 6: - % the next object in the output file is the first in part 7. + % Check that the requested object wasn't the last one in part 6: + % the next object in the output file is the first in part 7. PHSN omap 1 index eq { pop 1 } if XRef exch ld_get PDFOPTDEBUG { (\) = ) print dup = } if @@ -790,7 +790,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc] % Find the Contents of a page. /contentsobjects { % <pagedict> contentsobjects <firstobj#> <lastobj#> true - % <pagedict> contentsobjects false + % <pagedict> contentsobjects false /Contents .knownget { dup oforce % ref [] dup type /dicttype eq { @@ -799,8 +799,8 @@ userdict /clostreams 20 dict put % stream -> [data endproc] exch pop % [] dup length 0 ne { dup 0 get 0 get % [] 1st - exch dup % 1st [] [] - length 1 sub get 0 get % 1st last + exch dup % 1st [] [] + length 1 sub get 0 get % 1st last true } { pop false @@ -812,7 +812,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc] } bind def /contentsstart { % <pagedict> contentsstart <pos> true - % <pagedict> contentsstart false + % <pagedict> contentsstart false contentsobjects { pop omstart true } { false } ifelse } bind def @@ -820,13 +820,12 @@ userdict /clostreams 20 dict put % stream -> [data endproc] contentsobjects { omend exch omstart sub } { 0 } ifelse } bind def - /writePageOffsetHints { PDFOPTDEBUG { /writePageOffsetHints == } if 20 dict begin /bits OFile bitstream def - % Calculate least length of a page. + % Calculate least length of a page. FirstPageLength OtherPageLengths { .min } forall /minpl exch def @@ -835,20 +834,20 @@ userdict /clostreams 20 dict put % stream -> [data endproc] OtherPageNs { 0 get Objects exch lget contentslength .min } forall /mincl exch def - % The Adobe documentation says that all versions of Acrobat - % require item 8 (mincl) to be zero. Patch this here. + % The Adobe documentation says that all versions of Acrobat + % require item 8 (mincl) to be zero. Patch this here. /mincl 0 def - % Calculate bits needed to represent greatest page length. + % Calculate bits needed to represent greatest page length. FirstPageLength OtherPageLengths { .max } forall minpl sub bitsneeded /maxplbits exch def - % Calculate bits needed to represent the greatest Contents length. + % Calculate bits needed to represent the greatest Contents length. FirstPageNs 0 get Objects exch lget contentslength OtherPageNs { 0 get Objects exch lget contentslength .max } forall mincl sub bitsneeded /maxclbits exch def - % Per Adobe documentation, Acrobat requires that item 5 (maxplbits) - % be equal to item 9 (maxclbits). Set both to the max of the two. + % Per Adobe documentation, Acrobat requires that item 5 (maxplbits) + % be equal to item 9 (maxclbits). Set both to the max of the two. maxplbits maxclbits .max /maxplbits 1 index def /maxclbits exch def % Mapping from object number to shared object reference @@ -856,44 +855,44 @@ userdict /clostreams 20 dict put % stream -> [data endproc] 0 FirstPageNs { 1 index def 1 add } forall SharedNs { 1 index def 1 add } forall pop - currentdict end def + currentdict end def % Table F.3 Page offset hint table, header section % 1: Least number of objects in a page: FirstPageNs length OtherPageNs { length .min } forall /minnop 1 index def 32 bwn - % 2: Location of first page's Page object: + % 2: Location of first page's Page object: FirstPageNs 0 get omap XRef exch ld_get 32 bwn - % 3: Bits needed to represent greatest # of objects in a page: + % 3: Bits needed to represent greatest # of objects in a page: FirstPageNs length OtherPageNs { length .max } forall minnop sub bitsneeded /maxnopbits 1 index def 16 bwn - % 4: Least length of a page: + % 4: Least length of a page: minpl 32 bwn - % 5: Bits needed to represent the greatest page length: + % 5: Bits needed to represent the greatest page length: maxplbits 16 bwn - % 6: Least start of Contents offset: + % 6: Least start of Contents offset: 0 % (Acrobat requires that this be 0.) /minsco 1 index def 32 bwn - % 7: Bits needed to represent the greatest start of Contents - % offset: + % 7: Bits needed to represent the greatest start of Contents + % offset: 0 % (Acrobat ignores this.) /maxscobits 1 index def 16 bwn - % 8: Least contents length: + % 8: Least contents length: mincl 32 bwn - % 9: Bits needed to represent the greatest Contents length: + % 9: Bits needed to represent the greatest Contents length: maxclbits 16 bwn - % 10: Bits needed to represent the greatest number of Shared - % Object references: + % 10: Bits needed to represent the greatest number of Shared + % Object references: FirstPageNs length SharedPageNs { length .max } forall bitsneeded /maxsorbits 1 index def 16 bwn - % 11: Bits needed to identify a Shared Object: + % 11: Bits needed to identify a Shared Object: FirstPageNs length SharedNs length add bitsneeded /sobits 1 index def 16 bwn - % 12: Bits needed to represent numerator of fraction: + % 12: Bits needed to represent numerator of fraction: 2 /numfbits 1 index def 16 bwn - % 13: Denominator of fraction: + % 13: Denominator of fraction: 1 /denf 1 index def 16 bwn @@ -906,15 +905,15 @@ userdict /clostreams 20 dict put % stream -> [data endproc] } forall bits bitflush - % 2: Total length of pages in bytes; + % 2: Total length of pages in bytes; FirstPageLength minpl sub maxplbits bwn OtherPageLengths { minpl sub maxplbits bwn } forall bits bitflush - % 3: Number of shared objects referenced from page: - FirstPageNs length maxsorbits bwn + % 3: Number of shared objects referenced from page: + FirstPageNs length maxsorbits bwn SharedPageNs { length maxsorbits bwn } forall bits bitflush % 4: A shared object identifier: @@ -928,12 +927,12 @@ userdict /clostreams 20 dict put % stream -> [data endproc] % 5: Numerator of fractional position for each shared object: FirstPageNs { pop 0 numfbits bwn } forall SharedPageNs { - { pop 0 numfbits bwn + { pop 0 numfbits bwn } forall } forall bits bitflush - % 6: Contents offsets: + % 6: Contents offsets: % Following Implementation Note 133 section 6 is empty. maxscobits 0 gt { [FirstPageNs OtherPageNs aload pop] { @@ -959,30 +958,30 @@ userdict /clostreams 20 dict put % stream -> [data endproc] /bits OFile bitstream def /obj_count SharedNs length FirstPageNs length add def - % Table F.5 Shared object hint table, header section + % Table F.5 Shared object hint table, header section - % 1: Object number of first object in Shared Objects section + % 1: Object number of first object in Shared Objects section 0 32 bwn - % 2: Location of first object in Shared Objects section: - % If there are no shared objects, - % Acrobat sets this to the location of linearization - % parameters object (the very first object). + % 2: Location of first object in Shared Objects section: + % If there are no shared objects, + % Acrobat sets this to the location of linearization + % parameters object (the very first object). { pdfwriteheader } tomemory length 32 bwn - % 3: Number of Shared Object entries for first page: + % 3: Number of Shared Object entries for first page: FirstPageNs length 32 bwn - % 4: Number of Shared Object entries for Shared Objects - % section + % 4: Number of Shared Object entries for Shared Objects + % section obj_count 32 bwn - % 5: Bits needed to represent the greatest number of objects - % in a shared object group (always 0, because all groups - % have only 1 object): + % 5: Bits needed to represent the greatest number of objects + % in a shared object group (always 0, because all groups + % have only 1 object): 0 16 bwn - % 6: Least length of a Shared Object Group in bytes: + % 6: Least length of a Shared Object Group in bytes: 16#7fffffff FirstPageNs { omlength .min } forall SharedNs { omlength .min } forall /minsol 1 index def 32 bwn - % 7: Bits needed to represent the greatest length of a - % Shared Object Group: + % 7: Bits needed to represent the greatest length of a + % Shared Object Group: 0 FirstPageNs { omlength .max } forall SharedNs { omlength .max } forall minsol sub bitsneeded @@ -994,7 +993,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc] FirstPageNs { omlength minsol sub maxsolbits bwn } forall SharedNs { omlength minsol sub maxsolbits bwn } forall bits bitflush - % 2: MD5 flag: + % 2: MD5 flag: obj_count { 0 1 bwn } repeat bits bitflush % 3: No MD5 shared object signatures. @@ -1017,15 +1016,15 @@ userdict /clostreams 20 dict put % stream -> [data endproc] QUIET { pop } { print (, t = ) print realtime starttime sub = flush } ifelse } def omapinit - - % Create and open a temporary file. - % Because of .setsafe, we have to open it as read-write, rather than - % opening for writing, then closing it and reopening it for reading. + + % Create and open a temporary file. + % Because of .setsafe, we have to open it as read-write, rather than + % opening for writing, then closing it and reopening it for reading. null (w+) .tempfile /TFile exch def /TFileName exch def .setsafe - % Read all objects into memory. + % Read all objects into memory. Trailer touch (Read objects) now @@ -1036,14 +1035,14 @@ userdict /clostreams 20 dict put % stream -> [data endproc] /pdfOptimize cvx /limitcheck signalerror } if - % Replace indirect references to numbers. This is needed - % for the Length of streams, and doesn't hurt anything else. + % Replace indirect references to numbers. This is needed + % for the Length of streams, and doesn't hurt anything else. replaceReferences (Replaced references) now - % Create the two new objects: the linearization parameter - % dictionary, and the Primary Hint Stream. + % Create the two new objects: the linearization parameter + % dictionary, and the Primary Hint Stream. /LPDict 10 dict def /PHS 10 dict cvx def % executable = stream @@ -1052,7 +1051,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc] /PHSN exch def PDFOPTDEBUG { << /LPDictN LPDictN /PHSN PHSN >> === } if - % Count the number of objects in the output. + % Count the number of objects in the output. 0 0 1 Objects llength 1 sub { Generations exch lget 0 ne { 1 add } if @@ -1060,27 +1059,27 @@ userdict /clostreams 20 dict put % stream -> [data endproc] /NObjects exch def QUIET not { NObjects =only ( objects total) = flush } if - % Propagate inherited attributes down the page tree. + % Propagate inherited attributes down the page tree. propagateAttributes (Propagated attributes) now - % Identify the document-level objects (part 4). + % Identify the document-level objects (part 4). identifyDocumentObjects /CatalogNs exch def QUIET not { CatalogNs === flush } if (Identified Catalog) now - % Identify the first page's objects (part 6), - % including the Outlines tree if appropriate. + % Identify the first page's objects (part 6), + % including the Outlines tree if appropriate. pdfopencache /FirstPageNs identifyFirstPageObjects def QUIET not { FirstPageNs === flush } if (Identified first page) now - % Identify shared vs. non-shared objects for remaining pages - % (parts 7 and 8). + % Identify shared vs. non-shared objects for remaining pages + % (parts 7 and 8). identifyOtherPageObjects /SharedNs exch def @@ -1089,49 +1088,49 @@ userdict /clostreams 20 dict put % stream -> [data endproc] QUIET not { OtherPageNs === flush SharedNs === flush } if (Identified other pages) now - % Identify objects not associated with any page (part 9). + % Identify objects not associated with any page (part 9). /NonPageNs identifyNonPageObjects def QUIET not { NonPageNs { === } forall flush } if (Identified non-pages) now - % Assign final object numbers to all the objects. - % (The omap is currently empty.) + % Assign final object numbers to all the objects. + % (The omap is currently empty.) /FirstPageXN assignObjectNumbers def (Assigned objects #s) now - % Write the document-level objects (part 4). + % Write the document-level objects (part 4). { writePart4 } totemp /CatalogTempEnd exch def /CatalogTempStart exch def (Wrote Catalog) now - % Write the first page's objects (part 6). + % Write the first page's objects (part 6). { writePart6 } totemp /FirstPageTempEnd exch def /FirstPageTempStart exch def (Wrote first page) now - % Write the non-shared objects for other pages (part 7). + % Write the non-shared objects for other pages (part 7). { writePart7 /OtherPageLengths exch def } totemp /OtherPageTempEnd exch def /OtherPageTempStart exch def (Wrote other pages) now - % Write the shared objects for other pages (part 8). + % Write the shared objects for other pages (part 8). { writePart8 } totemp /SharedTempEnd exch def /SharedTempStart exch def (Wrote shared objects) now - % Write the objects not associated with pages (part 9). + % Write the objects not associated with pages (part 9). { writePart9 } totemp /NonPageTempEnd exch def /NonPageTempStart exch def - % Compute conservative lengths of parts 2,3,5,11 of the output. - % It's OK for these to be too large, but not too small. + % Compute conservative lengths of parts 2,3,5,11 of the output. + % It's OK for these to be too large, but not too small. % Make dummy XRef entres for LPDict and PHS. XRef LPDictN omap 0 ld_put @@ -1149,8 +1148,8 @@ userdict /clostreams 20 dict put % stream -> [data endproc] /ObjectsLength % this is exact CatalogLength FirstPageLength add OtherObjectsLength add def /XrefLength { % part 11 - % The LPDict must end within the first 1024 bytes, - % so the start of the FirstPage xref table can't exceed 1024. + % The LPDict must end within the first 1024 bytes, + % so the start of the FirstPage xref table can't exceed 1024. writePart11xref 1024 writePart11rest } tolength def /NominalFileLength % Make a generous allowance for parts 2,3,5. @@ -1162,7 +1161,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc] NominalFileLength dup 2 mul 2 copy add 1 index dup createLPDict writePart2 } tolength def - % Compute a few additional values from the above. + % Compute a few additional values from the above. /XrefBeginLength { (xref\n0 ) ows @@ -1175,8 +1174,8 @@ userdict /clostreams 20 dict put % stream -> [data endproc] CatalogLength add % phsstart /PHSStart exch def - % Adjust the object positions ignoring PHS. - % (Writing the PHS needs these.) + % Adjust the object positions ignoring PHS. + % (Writing the PHS needs these.) 0 0 CatalogStart CatalogTempStart sub adjustObjectPositions % Make a temporary XRef entry for the PHS, for the benefit of omend. @@ -1203,7 +1202,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc] pop /PHSLength { writePart5 } tolength def - % Construct the linearization parameter dictionary (part 2). + % Construct the linearization parameter dictionary (part 2). PHSStart dup PHSLength add % phsend @@ -1213,19 +1212,19 @@ userdict /clostreams 20 dict put % stream -> [data endproc] /XrefStart 1 index def XrefBeginLength add % xref0start dup XrefBeginLength sub XrefLength add % fileend - % Because of a bug, Acrobat Reader doesn't recognize any file - % shorter than 1K as linearized. Patch this here. + % Because of a bug, Acrobat Reader doesn't recognize any file + % shorter than 1K as linearized. Patch this here. % Acrobat 9 insists on 4KB 4096 .max /FileLength 1 index def createLPDict - % Adjust the object positions again, taking the PHS into account. + % Adjust the object positions again, taking the PHS into account. PHSStart 0 PHSLength adjustObjectPositions (Readjusted positions) now - % Finally, write the output file. + % Finally, write the output file. writePart1 writePart2 @@ -1243,7 +1242,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc] FileLength 1 index length sub padto ows (Wrote output file) now - % Wrap up. + % Wrap up. TFile closefile TFileName deletefile end % temporary dict @@ -1256,7 +1255,7 @@ end % pdfoptdict % Check for command line arguments. [ shellarguments { ] dup length 2 eq { - % Load the pdfwrite utilities if necessary. + % Load the pdfwrite utilities if necessary. /omapinit where { pop } { (pdfwrite.ps) runlibfile } ifelse save exch aload pop exch (r) file exch (w) file diff --git a/Master/tlpkg/tlgs/lib/pdfwrite.ps b/Master/tlpkg/tlgs/lib/pdfwrite.ps index 9d4c51d78eb..33751f2da05 100644 --- a/Master/tlpkg/tlgs/lib/pdfwrite.ps +++ b/Master/tlpkg/tlgs/lib/pdfwrite.ps @@ -1,19 +1,19 @@ % Copyright (C) 1999, 2000, 2001 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: pdfwrite.ps 9246 2008-11-27 01:58:54Z alexcher $ +% $Id$ % Writer for transmuting PDF files. % NOTES: @@ -58,7 +58,7 @@ put put } ifelse % - } bind def - + /ld_known { % <ldict> <key> ld_known <bool> dup 3 1 roll -15 bitshift % key <<>> key<<15 2 copy known { @@ -67,7 +67,7 @@ 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 { @@ -175,8 +175,8 @@ readonly def 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 [ (!). + % 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 @@ -208,10 +208,10 @@ readonly def /pdfcopystring 200 string def /pdfwritestream { % <streamdict> pdfwritestream - - % Remove File, FilePosition, and StreamKey; - % optimize by replacing an indirect Length. + % Remove File, FilePosition, and StreamKey; + % optimize by replacing an indirect Length. dup dup length dict copy - % Stack: origdict dict + % Stack: origdict dict dup /File undef dup /FilePosition undef dup /StreamKey undef dup /Length known { dup /Length get dup oforce ne { @@ -240,7 +240,7 @@ readonly def } loop pop pop pop } bind def /pdfcopystream { % <newstreamdict> <file> pdfcopystream - - % (file has been positioned) + % (file has been positioned) 1 index pdfwritevalue (stream\n) ows exch /Length get OFile exch pdfcopybytes (endstream) ows @@ -249,7 +249,7 @@ readonly def % ---------------- General values/objects ---------------- % /pdfwritetypes mark - % Scalars + % Scalars /nulltype { pop (null) ows } bind /integertype { =string cvs ows } bind /booleantype 1 index @@ -286,7 +286,7 @@ readonly def } bind /stringtype { OFile exch write===only } bind /nametype { pdfwritename } bind - % Composite/reference objects + % Composite/reference objects /arraytype { pdfwritearray } bind /packedarraytype 1 index /dicttype { pdfwritedict } bind @@ -338,7 +338,7 @@ readonly def (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 + % - 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 @@ -364,11 +364,11 @@ readonly def /ToWrite 100 dict def omapinit - % Write the PDF file header. + % Write the PDF file header. pdfwriteheader - % Write the objects. + % Write the objects. trailer { exch pop dup xcheck { % The only executable objects are references. @@ -377,13 +377,13 @@ readonly def pop } ifelse } forall - % Walk the object graph. + % 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. + % Write the xref table and trailer. /xref OFile fileposition def 0 XRef ld_length 1 add pdfwritexref diff --git a/Master/tlpkg/tlgs/lib/pf2afm.ps b/Master/tlpkg/tlgs/lib/pf2afm.ps index a79cb5b97cd..1977aff4332 100644 --- a/Master/tlpkg/tlgs/lib/pf2afm.ps +++ b/Master/tlpkg/tlgs/lib/pf2afm.ps @@ -24,7 +24,7 @@ % parameters, usually absent from Type 1 fonts. % Tribute: -% $Id: pf2afm.ps 9792 2009-06-13 14:33:18Z alexcher $ +% $Id$ % The program is based on James Clark's <jjc@jclark.uucp> printafm.ps % (with alterations by d.love@dl.ac.uk and L. Peter Deutsch) from % Ghostscript 5.10 distribution. @@ -448,7 +448,6 @@ } ifelse } bind def - % pf[ba]filename makeafm - /makeafm { count 0 eq {(Missing font file name\n) printquit} if @@ -518,7 +517,6 @@ .locksafe } if - pfmn isPFB {pfbn}{pfan} ifelse printafm @@ -536,4 +534,3 @@ } {pop} ifelse - diff --git a/Master/tlpkg/tlgs/lib/pfbtopfa.ps b/Master/tlpkg/tlgs/lib/pfbtopfa.ps index 07e5c72d119..5ebe9e8f88d 100644 --- a/Master/tlpkg/tlgs/lib/pfbtopfa.ps +++ b/Master/tlpkg/tlgs/lib/pfbtopfa.ps @@ -1,19 +1,19 @@ % Copyright (C) 1999 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: pfbtopfa.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % pfbtopfa.ps % Convert a .pfb font to .pfa format. diff --git a/Master/tlpkg/tlgs/lib/ppath.ps b/Master/tlpkg/tlgs/lib/ppath.ps index 400631f7039..b1dd3aac316 100644 --- a/Master/tlpkg/tlgs/lib/ppath.ps +++ b/Master/tlpkg/tlgs/lib/ppath.ps @@ -1,19 +1,19 @@ % Copyright (C) 1989, 1995, 1997 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: ppath.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Redefine pathforall for tracing. % Can't be used recursively. diff --git a/Master/tlpkg/tlgs/lib/pphs.ps b/Master/tlpkg/tlgs/lib/pphs.ps index 9a45383ecf1..6d1854c8dfa 100644 --- a/Master/tlpkg/tlgs/lib/pphs.ps +++ b/Master/tlpkg/tlgs/lib/pphs.ps @@ -1,19 +1,19 @@ % Copyright (C) 2001 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: pphs.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Print Linearized PDF hint streams % Utilities @@ -39,9 +39,9 @@ dup type /nametype eq 1 index xcheck and { dup dup (<<) cvn eq exch ([) eq or { exec exch { - dup pdftoken dup dup (>>) cvn eq exch (]) eq or { - exch pop exec exit - } if exch + dup pdftoken dup dup (>>) cvn eq exch (]) eq or { + exch pop exec exit + } if exch } loop } { exch pop @@ -87,7 +87,7 @@ /plpdict { % <dict> plpdict - (<<) = plpkeys { 2 index 2 index .knownget { - % Stack: dict key label value + % Stack: dict key label value ( ) print 3 -1 roll ===only ( ) print ===only ( % ) print = } { @@ -170,7 +170,7 @@ /pphs { % <file> pphs - /pdf exch def - % Read the linearization parameter dictionary. + % Read the linearization parameter dictionary. { pdf pdftoken /obj eq { exit } if } loop pdf pdftoken /lpdict exch def /lpdict type /dicttype eq { lpdict /Linearized known } { false } ifelse { @@ -179,13 +179,13 @@ lpdict plpdict flush - % Read the primary hint stream. + % Read the primary hint stream. null { pdf pdftoken dup /stream eq { pop exit } if exch pop } loop /phsdict exch def - % Remove Length if indirect reference. + % Remove Length if indirect reference. phsdict 0 known { phsdict 0 undef phsdict /Length undef } if @@ -194,14 +194,14 @@ dup 64000 string readstring pop exch closefile sread /phsdata exch def - % Decode the hint stream data if necessary. + % Decode the hint stream data if necessary. phsdict /Filter .knownget { phsdata exch filter dup 5000 string readstring pop exch closefile sread /phsdata exch def } if - % Adobe says we can assume /P = 0. + % Adobe says we can assume /P = 0. (Page Offset Hint Table:) = lpdict /N get phsdata phsdict /S get string readstring pop sread diff --git a/Master/tlpkg/tlgs/lib/prfont.ps b/Master/tlpkg/tlgs/lib/prfont.ps index 94f2873b4ce..7d8f86f1b9d 100644 --- a/Master/tlpkg/tlgs/lib/prfont.ps +++ b/Master/tlpkg/tlgs/lib/prfont.ps @@ -22,7 +22,7 @@ % Copyright transferred 2000/09/15 to Artifex Software, Inc. Send any questions to % bug-gs@ghostscript.com. -% $Id: prfont.ps 8022 2007-06-05 22:23:38Z giles $ +% $Id$ % Example usages at bottom of file @@ -37,8 +37,8 @@ % Sort an array. Code used by permission of the author, Aladdin Enterprises. /sort { % <array> <lt-proc> sort <array> - % Heapsort (algorithm 5.2.3H, Knuth vol. 2, p. 146), - % modified for 0-origin indexing. */ + % Heapsort (algorithm 5.2.3H, Knuth vol. 2, p. 146), + % modified for 0-origin indexing. */ 10 dict begin /LT exch def /recs exch def @@ -47,23 +47,23 @@ /l N 2 idiv def /r N 1 sub def { l 0 gt { - /l l 1 sub def - /R recs l get def + /l l 1 sub def + /R recs l get def } { - /R recs r get def - recs r recs 0 get put - /r r 1 sub def - r 0 eq { recs 0 R put exit } if + /R recs r get def + recs r recs 0 get put + /r r 1 sub def + r 0 eq { recs 0 R put exit } if } ifelse /j l def { - /i j def - /j j dup add 1 add def - j r lt { - recs j get recs j 1 add get LT { /j j 1 add def } if - } if - j r gt { recs i R put exit } if - R recs j get LT not { recs i R put exit } if - recs i recs j get put + /i j def + /j j dup add 1 add def + j r lt { + recs j get recs j 1 add get LT { /j j 1 add def } if + } if + j r gt { recs i R put exit } if + R recs j get LT not { recs i R put exit } if + recs i recs j get put } loop } loop } if recs end @@ -151,7 +151,7 @@ /Unencoded exch def /Count Unencoded length def - % Print the unencoded characters in blocks of 128. + % Print the unencoded characters in blocks of 128. 0 128 Unencoded length 1 sub { /BlockStart 1 index def @@ -162,7 +162,7 @@ save F /Encoding known { F length dict F - { 1 index /FID eq { pop pop } { 2 index 3 1 roll put } ifelse } + { 1 index /FID eq { pop pop } { 2 index 3 1 roll put } ifelse } forall dup /Encoding TempEncoding put /* exch definefont /F exch def @@ -192,7 +192,7 @@ /DoCode {DoChar} def /DoLine {DoCharLine} def - % Display the first 128 encoded characters. + % Display the first 128 encoded characters. DoTitle (, characters 0-127) show 0 127 DoBlock @@ -203,7 +203,7 @@ 36 0.8 Inch moveto 96 127 DoLine showpage - % Display the second 128 encoded characters. + % Display the second 128 encoded characters. DoTitle (, characters 128-255) show 128 255 DoBlock @@ -216,15 +216,15 @@ F /CharStrings known { - % Find and display the unencoded characters. - - /Encoded F /Encoding get length dict def - F /Encoding get { true Encoded 3 1 roll put } forall - [ F /CharStrings get - { pop dup Encoded exch known { pop } if } - forall ] { - exch Namestring1 cvs exch Namestring2 cvs lt - } sort DoUnencoded + % Find and display the unencoded characters. + + /Encoded F /Encoding get length dict def + F /Encoding get { true Encoded 3 1 roll put } forall + [ F /CharStrings get + { pop dup Encoded exch known { pop } if } + forall ] { + exch Namestring1 cvs exch Namestring2 cvs lt + } sort DoUnencoded } if diff --git a/Master/tlpkg/tlgs/lib/printafm.ps b/Master/tlpkg/tlgs/lib/printafm.ps index 16524c54be7..9fb6c0dd7a3 100644 --- a/Master/tlpkg/tlgs/lib/printafm.ps +++ b/Master/tlpkg/tlgs/lib/printafm.ps @@ -11,7 +11,7 @@ % Altered by d.love@dl.ac.uk to produce input for Rokicki's afm2tfm, % which groks the format of the Adobe AFMs. -% $Id: printafm.ps 8779 2008-05-27 17:07:40Z alexcher $ +% $Id$ % Modified by L. Peter Deutsch 9/14/93: % uses Ghostscript's =only procedure to replace 'buf cvs print'. % Modified by L. Peter Deutsch 9/6/95: @@ -25,142 +25,142 @@ % c toupper - c /toupper { - dup dup 8#141 ge exch 8#172 le and { - 8#40 sub - } if + dup dup 8#141 ge exch 8#172 le and { + 8#40 sub + } if } bind def % print unencoded character metric data lines for glyphs in `v' array % and reset `v' - /printv { - % define a new font with v as its encoding vector - currentfont maxlength dict /f exch def - currentfont { - exch dup dup /FID ne exch /Encoding ne and { - exch f 3 1 roll put - } { - pop pop - } ifelse - } forall - f /Encoding v put - f /FontName /temp put - % make this new font the current font - /temp f definefont setfont - % print a entry for each character not in old vector - /e currentfont /Encoding get def - 0 1 255 { - dup e exch get - dup dup /.notdef ne exch s exch known not and { - exch -1 printmetric - } { - pop pop - } ifelse - } for - 0 1 255 { - v exch /.notdef put - } for + % define a new font with v as its encoding vector + currentfont maxlength dict /f exch def + currentfont { + exch dup dup /FID ne exch /Encoding ne and { + exch f 3 1 roll put + } { + pop pop + } ifelse + } forall + f /Encoding v put + f /FontName /temp put + % make this new font the current font + /temp f definefont setfont + % print a entry for each character not in old vector + /e currentfont /Encoding get def + 0 1 255 { + dup e exch get + dup dup /.notdef ne exch s exch known not and { + exch -1 printmetric + } { + pop pop + } ifelse + } for + 0 1 255 { + v exch /.notdef put + } for } bind def % printcharmetrics - /printcharmetrics { - (StartCharMetrics ) print - currentfont /CharStrings get dup length exch /.notdef known { 1 sub } if = - currentfont 1000 scalefont setfont 0 0 moveto - /e currentfont /Encoding get def - 0 1 255 { - dup e exch get - dup /.notdef ne { - exch dup printmetric - } { - pop pop - } ifelse - } for - % s contains an entry for each name in the original encoding vector - /s 256 dict def - e { - s exch true put - } forall - % v is the new encoding vector - /v 256 array def - 0 1 255 { - v exch /.notdef put - } for - % fill up v with names in CharStrings - /i 0 def - currentfont /CharStrings get { - pop - i 255 le { - v i 3 -1 roll put - /i i 1 add def - } { - printv - v 0 3 -1 roll put - /i 1 def - } ifelse - } forall - printv - (EndCharMetrics) = + (StartCharMetrics ) print + currentfont /CharStrings get dup length exch /.notdef known { 1 sub } if = + currentfont 1000 scalefont setfont 0 0 moveto + /e currentfont /Encoding get def + 0 1 255 { + dup e exch get + dup /.notdef ne { + exch dup printmetric + } { + pop pop + } ifelse + } for + % s contains an entry for each name in the original encoding vector + /s 256 dict def + e { + s exch true put + } forall + % v is the new encoding vector + /v 256 array def + 0 1 255 { + v exch /.notdef put + } for + % fill up v with names in CharStrings + /i 0 def + currentfont /CharStrings get { + pop + i 255 le { + v i 3 -1 roll put + /i i 1 add def + } { + printv + v 0 3 -1 roll put + /i 1 def + } ifelse + } forall + printv + (EndCharMetrics) = } bind def % name actual_code normal_code printmetric - /printmetric { - /saved save def - (C ) print =only - ( ; WX ) print - onechar 0 3 -1 roll put - onechar stringwidth pop round cvi =only - ( ; N ) print =only - ( ; B ) print - onechar false charpath flattenpath mark pathbbox counttomark { - counttomark -1 roll - round cvi =only - ( ) print - } repeat pop - (;) = - saved restore + /saved save def + (C ) print =only + ( ; WX ) print + onechar 0 3 -1 roll put + onechar stringwidth pop round cvi =only + ( ; N ) print =only + ( ; B ) print + onechar false charpath flattenpath mark pathbbox counttomark { + counttomark -1 roll + round cvi =only + ( ) print + } repeat pop + (;) = + saved restore } bind def % fontname printafm - /printafm { - findfont gsave setfont - (StartFontMetrics 2.0) = - - % Print the UniqueID - - currentfont /UniqueID known { - (Comment UniqueID ) print - currentfont /UniqueID get =only - (\n) print - } if - - (FontName ) print currentfont /FontName get = - - % Print the FontInfo - - currentfont /FontInfo get { - exch - dup /FSType ne { - =string cvs dup dup 0 get 0 exch toupper put print - ( ) print = - } { - pop pop - } ifelse - } forall - - % Print the FontBBox - - (FontBBox) print - currentfont /FontBBox get { - ( ) print round cvi =only - } forall - (\n) print - - printcharmetrics - (EndFontMetrics) = - grestore + findfont gsave setfont + (StartFontMetrics 2.0) = + + % Print the UniqueID + + currentfont /UniqueID known { + (Comment UniqueID ) print + currentfont /UniqueID get =only + (\n) print + } if + + (FontName ) print currentfont /FontName get = + + % Print the FontInfo + + currentfont /FontInfo get { + exch + dup /FSType ne { + =string cvs dup dup 0 get 0 exch toupper put print + ( ) print = + } { + pop pop + } ifelse + } forall + + % Print the FontBBox + + (FontBBox) print + currentfont /FontBBox get { + ( ) print round cvi =only + } forall + (\n) print + + printcharmetrics + (EndFontMetrics) = + grestore } bind def % Check for command line arguments. diff --git a/Master/tlpkg/tlgs/lib/ps2ai.ps b/Master/tlpkg/tlgs/lib/ps2ai.ps index c63b91d3898..4720145c42b 100644 --- a/Master/tlpkg/tlgs/lib/ps2ai.ps +++ b/Master/tlpkg/tlgs/lib/ps2ai.ps @@ -1,30 +1,30 @@ %! % Copyright (C) 1994 , 1999 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: ps2ai.ps 9743 2009-05-16 15:29:35Z alexcher $ +% $Id$ %xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx % % ps2ai.ps - a postscript to editable adobe illustrator file filter % /vers {2.14} def % January 31, 1999 -% conditional def ( if the key is already defined before, don't +% conditional def ( if the key is already defined before, don't % redefine it. This can be used by other programs to overwrite % some settings from externally -% +% /cdef { 1 index where { pop pop pop } { def } ifelse } bind def % %xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx @@ -101,7 +101,7 @@ % 1.72 fixed problem with restore/clip info - (not enough Qs problem) % 1.71 filter font names to remove previous encoding (|,_,etc) % 1.7 change text format to AI3, works better with PS & CD -% 1.67 deal with weird makefonts +% 1.67 deal with weird makefonts % 1.66 handle to many bad stroke/fills (s s s w/o paths) % 1.65 more useable with non-gs interpreters (defaultmatrix fix) % 1.64 fixed "smart grestore" repeat bug @@ -133,7 +133,7 @@ matrix identmatrix setmatrix % make ctm [1 0 0 1 0 0] /bdef {bind def} bind def /oldgsave {} def /oldgrestore {} def -/initgraphics {} def /initmatrix {} def +/initgraphics {} def /initmatrix {} def % undefine PPD PageSizes to be more printer independant /letter {} def /legal {} def /a4 {} def /b5 {} def /lettersmall {} def /setpagedevice { pop } bdef % for level 2 PPD PageSizes @@ -183,8 +183,8 @@ matrix identmatrix setmatrix % make ctm [1 0 0 1 0 0] cyan mag yel blk } bdef } ifelse -% If using Mac Ghostscript -jMacGS { +% If using Mac Ghostscript +jMacGS { % /jeol {(\r) jp} def /jout true def (%%Note: Loading ps2ai.ps\n) print @@ -224,7 +224,7 @@ jout {/jp { joutput exch writestring } bdef }{/jp {print} bdef} ifelse /ppforall { cntpaths % find out how many paths are on the stack jnump 1 gt { (*u\n) jp } if - {jpm}{jpl}{jpc}{jpp} pathforall + {jpm}{jpl}{jpc}{jpp} pathforall ckpnt jnump 1 gt { (*U\n) jp } if /jnump 0 def /clstate false def /dpth false def /fclp false def @@ -234,23 +234,23 @@ jout {/jp { joutput exch writestring } bdef }{/jp {print} bdef} ifelse % Painting Operators % /oldnewpath [/newpath load] cbdef -/newpath { (\n) jp /spth 0 def ppforall} bdef -/stroke { (\n) jp /spth 1 def ppforall } bdef -/fill {(\n) jp /spth 2 def ppforall } bdef +/newpath { (\n) jp /spth 0 def ppforall} bdef +/stroke { (\n) jp /spth 1 def ppforall } bdef +/fill {(\n) jp /spth 2 def ppforall } bdef /eofill {(1 D\n) jp fill (0 D\n) jp} bdef -/clip {clarry gcnt get {(Q\nq\n) jp}{(q\n) jp} ifelse +/clip {clarry gcnt get {(Q\nq\n) jp}{(q\n) jp} ifelse /fclp true def clarry gcnt true put} bdef /eoclip {(1 D\n) jp clip (0 D\n) jp} bdef % % Text Operators % /oldshow [/show load] cbdef -/curpt {stringwidth pop jx add jy} bdef +/curpt {stringwidth pop jx add jy} bdef /jNN {dup 0 eq {pop oldgsave currentfont /FontMatrix get setmatrix kscl oldgrestore} if } bdef /curftmatrix { - currentfont /FontMatrix get dup 0 get jNN abs /norm exch def + currentfont /FontMatrix get dup 0 get jNN abs /norm exch def dup 0 get norm div exch dup 1 get norm div exch dup 2 get norm div exch dup 3 get norm div exch dup 4 get exch 5 get 6 array astore matrix currentmatrix matrix concatmatrix @@ -291,17 +291,17 @@ jstr cvs jtxt3 { /j3txt { j3ftxt {(0 Ts 100 Tz 0 Tt 0 TA 0 0 5 TC 100 100 200 TW 0 0 0 Ti\n) jp (0 Ta 0 Tq 0 0 TI 0 Tc 0 Tw\n) jp} if } bdef -/show {oldgsave (0 To\n) jp - currentpoint 2 copy /jy exch def /jx exch def translate +/show {oldgsave (0 To\n) jp + currentpoint 2 copy /jy exch def /jx exch def translate curftmatrix /jitm exch def 0 1 5 {jitm exch get jpnum} for ( 0 Tp\n) jp (TP\n) jp (0 Tr\n) jp (\/_) jp curftname curftsize jpnum ( Tf\n) jp (0) jp j_ax curftsize div 100 mul jpnum ( 100 TC\n) jp % percent(?) dup curpt moveto mark exch handft ( Tx\n) jp (TO\n) jp /j3ftxt false def cleartomark currentpoint oldgrestore moveto -} bdef +} bdef /ashow {exch pop exch /j_ax exch def show /j_ax {0} def } bdef -} +} { /show {oldgsave (u\n) jp currentpoint 2 copy /jy exch def /jx exch def translate (\/) jp curftname jstr cvs jp @@ -318,14 +318,14 @@ jtxt3 { /awidthshow {ashow pop pop pop} bdef /kshow {show pop} bdef %/show {true charpath fill} bdef % get outline of charactor -joutln {/show { true charpath currentpoint +joutln {/show { true charpath currentpoint /jy exch def /jx exch def fill jx jy moveto} bdef} if %/show {oldshow} bdef % do nothing different % % Color Operators % /oldsetcmykcolor [/setcmykcolor load] cbdef -/setcmykcolor {oldsetcmykcolor +/setcmykcolor {oldsetcmykcolor currentcmykcolor 4 -1 roll jpnum 3 -1 roll jpnum 2 -1 roll jpnum jpnum ( k\n) jp currentcmykcolor 4 -1 roll jpnum 3 -1 roll jpnum 2 -1 roll jpnum jpnum ( K\n) jp } bdef @@ -376,7 +376,7 @@ currentcmykcolor 4 -1 roll jpnum 3 -1 roll jpnum 2 -1 roll jpnum jpnum ( K\n) jp /currentstate {currentcmykcolor setcmykcolor currentflat jpnum ( i) jp currentlinecap jpnum ( J) jp currentlinejoin jpnum ( j) jp currentlinewidth jpnum ( w) jp - currentmiterlimit jpnum ( M ) jp currentdash exch jpmat jpnum ( d\n) jp + currentmiterlimit jpnum ( M ) jp currentdash exch jpmat jpnum ( d\n) jp } bdef /jdifG { currentcmykcolor /jok xdef /joy xdef /jom xdef /joc xdef @@ -390,7 +390,7 @@ currentcmykcolor 4 -1 roll jpnum 3 -1 roll jpnum 2 -1 roll jpnum jpnum ( K\n) jp currentdash /jnod xdef /jnad xdef % compare old gstate to new gstate joc jnc ne jom jnm ne joy jny ne jok jnk ne - jof jnf ne jolc jnlc ne jolj jnlj ne jolw jnlw ne joml jnml ne + jof jnf ne jolc jnlc ne jolj jnlj ne jolw jnlw ne joml jnml ne false joad {true exit} forall {pop pop true}{false} ifelse false jnad {true exit} forall {pop pop true}{false} ifelse ne jood jnod ne 10 {or} repeat {currentstate} if @@ -399,7 +399,7 @@ currentcmykcolor 4 -1 roll jpnum 3 -1 roll jpnum 2 -1 roll jpnum jpnum ( K\n) jp /gsave {oldgsave /gcnt gcnt 1 add def } bdef % clarry gcnt false put} bdef % (%%Note:gsave ) jp gcnt jpnum (\n) jp} bdef /oldgrestore [/grestore load] cbdef -/grestore {dpth {newpath} if clarry gcnt get {(Q\n) jp clarry gcnt false put} if +/grestore {dpth {newpath} if clarry gcnt get {(Q\n) jp clarry gcnt false put} if jdifG /gcnt gcnt 1 sub def } bdef % oldgrestore currentstate } bdef % (%%Note:grestore ) jp gcnt 1 add jpnum (\n) jp} bdef @@ -421,10 +421,10 @@ currentcmykcolor 4 -1 roll jpnum 3 -1 roll jpnum 2 -1 roll jpnum jpnum ( K\n) jp (Adobe_customcolor /terminate get exec\n) jp (Adobe_cshow /terminate get exec\n) jp (Adobe_cmykcolor /terminate get exec\n) jp - (Adobe_packedarray /terminate get exec\n) jp + (Adobe_packedarray /terminate get exec\n) jp } ifelse ( showpage\n%EOF\n%%EndDocument\n) jp - jout {joutput closefile} if jMacGS not {quit} if /j3ftxt true def } bdef + jout {joutput closefile} if jMacGS not {quit} if /j3ftxt true def } bdef % % Error handling % diff --git a/Master/tlpkg/tlgs/lib/ps2ascii.ps b/Master/tlpkg/tlgs/lib/ps2ascii.ps index a88c7d535e6..7547fd77f71 100644 --- a/Master/tlpkg/tlgs/lib/ps2ascii.ps +++ b/Master/tlpkg/tlgs/lib/ps2ascii.ps @@ -1,19 +1,19 @@ % Copyright (C) 1991, 1995, 1996, 1998, 1999 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: ps2ascii.ps 10152 2009-10-08 01:53:10Z alexcher $ +% $Id$ % 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. @@ -27,7 +27,7 @@ % % P % Indicate the end of the page. -% +% % S <x> <y> (<string>) <width> % Display a string. % @@ -67,11 +67,11 @@ %% 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. -%% +%% 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 @@ -89,25 +89,25 @@ %% 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 @@ -121,7 +121,7 @@ %%* (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 @@ -129,7 +129,7 @@ %%* 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 @@ -137,9 +137,9 @@ %%* 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 @@ -152,16 +152,16 @@ %%* 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 @@ -200,11 +200,11 @@ ifelse } 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 ... + % 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. + % 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 } @@ -216,7 +216,7 @@ ifelse pathforall cleartomark { .showcolor counttomark 4 idiv { counttomark -4 roll .orderrect - (R ) //print .show==4 + (R ) //print .show==4 } repeat pop } @@ -226,16 +226,16 @@ 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 + % 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 + % 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. @@ -246,7 +246,7 @@ ifelse 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. + % We have a rectangle. pop pop pop pop 4 2 roll pop pop 8 4 roll } odef /eofill { COMPLEX { .fillcomplex } if newpath } codef @@ -265,10 +265,10 @@ ifelse 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. + % 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. + % 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 @@ -276,8 +276,8 @@ ifelse } 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 + % 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 @@ -294,8 +294,8 @@ 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 + % 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 } @@ -354,17 +354,17 @@ ifelse 1000 mul round cvi 3 1 roll 1000 mul round cvi exch 1000 mul round cvi - % Stack: b g r + % 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 + 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 + (\n) //print } ifelse } @@ -383,10 +383,10 @@ ifelse % 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... + % 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. + % ... but undo any rotation into landscape orientation. dup 0 get 0 eq { 1 get dup abs div 90 mul rotate .show.ident.matrix currentmatrix @@ -400,8 +400,8 @@ ifelse } odef /.dcoord { % <dx> <dy> .coord <dx'> <dy'> - % Transforming distances is trickier, because - % the coordinate system might be rotated. + % 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 @@ -458,7 +458,7 @@ ifelse } odef /.showwidth % Same as stringwidth, but disable COMPLEX so that - % we don't try to detect rectangles during BuildChar. + % we don't try to detect rectangles during BuildChar. { COMPLEX { /COMPLEX false def stringwidth /COMPLEX true def } { stringwidth } @@ -467,7 +467,7 @@ ifelse /.showfont % <string> .showfont <string> { gsave - % Try getting the height and width of the font from the FontBBox. + % 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 @@ -478,24 +478,24 @@ ifelse { 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 + % 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 + % Stack: height width fontname SIMPLE { pop pop //.show.height exch .iput } { 2 index //.font.height .iget eq @@ -504,9 +504,9 @@ ifelse { pop pop pop } { (F ) //print - 3 -1 roll dup //.font.height exch .iput .show==only ( ) //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 + dup length //.font.name.length exch .iput //.font.name cvs .show==only (\n) //print } ifelse @@ -550,7 +550,7 @@ mark /Eogonek /Eth /Gbreve - /Germandbls + /Germandbls /IJ /Iacute /Icircumflex @@ -776,7 +776,7 @@ mark %%* 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 @@ -784,7 +784,7 @@ mark %%* 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 @@ -955,7 +955,7 @@ mark 8#334 /Udieresis 8#335 /Yacute 8#336 /Thorn - 8#337 /Germandbls + 8#337 /Germandbls 8#340 /agrave 8#341 /aacute @@ -1144,9 +1144,9 @@ mark { /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 @@ -1154,18 +1154,18 @@ mark %% 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 + /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 @@ -1206,7 +1206,7 @@ mark } 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 %% @@ -1227,12 +1227,12 @@ mark dup % calculate new urx dup 2 get ch-dx ch-width add - .max + .max 2 exch put dup 3 get % calculate new ury ch-yoff - .max + .max 3 exch put } def @@ -1308,7 +1308,7 @@ userdict /start-hook { } { pop } - ifelse + ifelse .show.stdout exch writestring } ifelse @@ -1324,11 +1324,11 @@ userdict /start-hook { { % 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 @@ -1398,7 +1398,7 @@ userdict /start-hook { % 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 @@ -1429,12 +1429,12 @@ userdict /start-hook { //.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 } @@ -1488,8 +1488,8 @@ userdict /start-hook { } codef /kshow { .showfont .showcolor - %**************** Should construct a closure, in case the procedure - %**************** affects the o-stack. + %**************** Should construct a closure, in case the procedure + %**************** affects the o-stack. { .show1 dup exec } forall pop } codef diff --git a/Master/tlpkg/tlgs/lib/ps2epsi.ps b/Master/tlpkg/tlgs/lib/ps2epsi.ps index 7480682686a..f985c4f7de8 100644 --- a/Master/tlpkg/tlgs/lib/ps2epsi.ps +++ b/Master/tlpkg/tlgs/lib/ps2epsi.ps @@ -1,20 +1,19 @@ - % Copyright (C) 1990, 2000 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: ps2epsi.ps 9619 2009-04-07 10:20:02Z ken $ +% $Id$ % Convert an arbitrary PostScript file to an EPSI file. % % Please do not contact these users if you have questions. They no longer @@ -52,24 +51,24 @@ /ps2edict where { pop } { /ps2edict 25 dict def } ifelse ps2edict begin - % The main procedure + % The main procedure /ps2epsi - { - % bbox written to outfile by bbox device from ps2epsi command file - outfile (r) file /epsifile exch def - /BBoxString epsifile 256 string readline pop def - /HiresBBoxString epsifile 256 string readline pop def - epsifile closefile - % Open the file + { + % bbox written to outfile by bbox device from ps2epsi command file + outfile (r) file /epsifile exch def + /BBoxString epsifile 256 string readline pop def + /HiresBBoxString epsifile 256 string readline pop def + epsifile closefile + % Open the file outfile (w) file /epsifile exch def - % Get the device parameters - currentdevice getdeviceprops .dicttomark + % Get the device parameters + currentdevice getdeviceprops .dicttomark /HWSize get aload pop /devheight exch def /devwidth exch def matrix defaultmatrix /devmatrix exch def - % Make a corresponding 8-bit deep memory device + % Make a corresponding 8-bit deep memory device devmatrix devwidth devheight 256 string 0 1 255 { 1 index exch dup 255 exch sub put } for makeimagedevice @@ -82,7 +81,7 @@ ps2edict begin /rowwidth devwidth def /row rowwidth string def /zerorow rowwidth string def % all zero - % Replace the definition of showpage + % Replace the definition of showpage userdict /showpage { ps2edict begin epsipage end } bind put userdict /setfont { ps2edict begin epsisetfont end } bind put userdict /setpagedevice /pop load put @@ -116,85 +115,84 @@ ps2edict begin } bind def /margintest { % <y-start> <step> <y-limit> margintest <y-non-blank> - % <y-start> <step> <y-limit> margintest - + % <y-start> <step> <y-limit> margintest - { dup arraydevice exch row getscanline zerorow ne { exit } if pop } for } bind def - /epsiNameStr 200 string def /epsiNpages 0 def /epsiNpageStr 20 string def /epsipage - { + { /epsiNpages epsiNpages 1 add def /loopcount devheight 1 sub def % Find top margin -- minimum Y of non-blank scan line. -1 0 1 loopcount margintest - dup -1 eq { (blank page!!\n) print quit }{ exch pop } ifelse + dup -1 eq { (blank page!!\n) print quit }{ exch pop } ifelse /tm exch def % Find bottom margin -- maximum Y of non-blank scan line. loopcount -1 0 margintest /bm exch def - + % Initialise limit variables /loopcount rowwidth 1 sub def - /lm loopcount def - /rm 0 def + /lm loopcount def + /rm 0 def % Find left and right boundaries of image tm 1 bm { % Get more data - arraydevice exch row getscanline pop - % Scan from left to find first non-zero element - % We save first the element, then the index - -1 0 1 loopcount - { dup row exch get 0 ne { exch pop exit }{ pop } ifelse - } for - % If we found -1, row is blank .. - dup -1 ne - { % Find the leftmost index + arraydevice exch row getscanline pop + % Scan from left to find first non-zero element + % We save first the element, then the index + -1 0 1 loopcount + { dup row exch get 0 ne { exch pop exit }{ pop } ifelse + } for + % If we found -1, row is blank .. + dup -1 ne + { % Find the leftmost index dup lm lt % If the new index is less, we save index and element { /lm exch def } { pop } ifelse - % Now find the rightmost index - loopcount -1 0 + % Now find the rightmost index + loopcount -1 0 { dup row exch get 0 ne { exit }{ pop } ifelse } for - dup rm gt + dup rm gt % If the new index is greater, we save index and element { /rm exch def } { pop } ifelse - } if + } if } for % Write out the magic string and bounding box information epsifile (%!PS-Adobe-2.0 EPSF-1.2\n) writestring - /epsititle where { pop epsifile epsititle writestring } if - /epsicreator where { pop epsifile epsicreator writestring } if - /epsicrdt where { pop epsifile epsicrdt writestring } if - /epsifor where { pop epsifile epsifor writestring } if + /epsititle where { pop epsifile epsititle writestring } if + /epsicreator where { pop epsifile epsicreator writestring } if + /epsicrdt where { pop epsifile epsicrdt writestring } if + /epsifor where { pop epsifile epsifor writestring } if epsifile flushfile - % Write out the page count: - epsifile (%%Pages: ) writestring - epsifile epsiNpages epsiNpageStr cvs writestring - epsifile (\n) writestring + % Write out the page count: + epsifile (%%Pages: ) writestring + epsifile epsiNpages epsiNpageStr cvs writestring + epsifile (\n) writestring epsifile flushfile - % Write out the list of used fonts: - epsifile (%%DocumentFonts:) writestring - epsifontdict { - epsifile ( ) writestring - pop epsiNameStr cvs epsifile exch writestring - } forall - epsifile (\n) writestring + % Write out the list of used fonts: + epsifile (%%DocumentFonts:) writestring + epsifontdict { + epsifile ( ) writestring + pop epsiNameStr cvs epsifile exch writestring + } forall + epsifile (\n) writestring epsifile flushfile - epsifile BBoxString writestring epsifile (\r) writestring - epsifile HiresBBoxString writestring epsifile (\r) writestring + epsifile BBoxString writestring epsifile (\r) writestring + epsifile HiresBBoxString writestring epsifile (\r) writestring % Define character and bit widths for the output line buffer: /cwidth rm lm sub 1 add def @@ -213,14 +211,14 @@ ps2edict begin tm 1 bm { % Get a scan line interval from the array device - arraydevice exch row copyscanlines lm cwidth getinterval - % Write out the hex data as 40 bytes per line (82 chars) - 0 40 cwidth - { epsifile (% ) writestring - epsifile exch 2 index exch - dup cwidth exch sub 40 .min getinterval writehexstring - epsifile (\n) writestring - } for + arraydevice exch row copyscanlines lm cwidth getinterval + % Write out the hex data as 40 bytes per line (82 chars) + 0 40 cwidth + { epsifile (% ) writestring + epsifile exch 2 index exch + dup cwidth exch sub 40 .min getinterval writehexstring + epsifile (\n) writestring + } for pop } for @@ -233,9 +231,8 @@ ps2edict begin DonePage 0 1 put } bind def - (outfile) getenv - { /outfile exch def + { /outfile exch def ps2epsi /DonePage 1 string def diff --git a/Master/tlpkg/tlgs/lib/rollconv.ps b/Master/tlpkg/tlgs/lib/rollconv.ps index be156a2d93d..f399be76b36 100644 --- a/Master/tlpkg/tlgs/lib/rollconv.ps +++ b/Master/tlpkg/tlgs/lib/rollconv.ps @@ -1,7 +1,7 @@ %! % Copyright (C) 1995, 1996 Aladdin Enterprises. All rights reserved. -% $Id: rollconv.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Utility program for converting Japanese fonts produced by Macromedia's % Rollup program to Type 0 fonts suitable for use with Ghostscript. % @@ -57,13 +57,12 @@ % or % /HGGothicBPRO-83pv-RKSJ-H 36 selectfont - /macrfile % <filename> macrfile <file> { (r) file fromMac { % Get rid of the initial Mac garbage (128 characters). - % The garbage at the end is unpredictable, - % so we'll just have to hope that it's all nulls. + % The garbage at the end is unpredictable, + % so we'll just have to hope that it's all nulls. dup =string 0 128 getinterval readstring pop pop } if @@ -79,7 +78,7 @@ /inprefix InDir (/) concatstrings FName concatstrings (-) concatstrings def /inh inprefix (H) concatstrings def - % Open the output file. + % Open the output file. /OutDot OutDir (/) concatstrings OutBase concatstrings (.) concatstrings def /outname OutDot (ps) concatstrings def @@ -89,7 +88,7 @@ QUIET not { (Writing ) print outname = flush } if /out outname (w) file def /buffer 65000 string def - % Copy the initial comments from the input file. + % Copy the initial comments from the input file. inh macrfile { dup =string readline pop @@ -98,7 +97,7 @@ inh macrfile } loop - % Write out our preamble. + % Write out our preamble. out ( currentpacking true setpacking @@ -142,13 +141,13 @@ userdict /AltsysCFD3 25 dict dup begin { privates exch get 3 1 roll pop pop } { 7 dict begin - /MinFeature{16 16}executeonly def - /BlueValues BlueValues def - /StdVW 3 -1 roll 1 array astore def - /StdHW 3 -1 roll 1 array astore def - /password 5839 def - /LanguageGroup 1 def - /Subrs Subrs def + /MinFeature{16 16}executeonly def + /BlueValues BlueValues def + /StdVW 3 -1 roll 1 array astore def + /StdHW 3 -1 roll 1 array astore def + /password 5839 def + /LanguageGroup 1 def + /Subrs Subrs def currentdict readonly end privates 2 index 2 index put exch pop } @@ -178,7 +177,7 @@ end put %END ) writestring - % Locate and copy the definition of NotDefFont. + % Locate and copy the definition of NotDefFont. out ( FontDirectory /NotDefFont known { (%END) .skipeof } if @@ -195,9 +194,9 @@ loop out (definefont pop %END ) writestring - % Copy the definitions of the subfonts, moving the - % CharStrings of the Roman supplement to an external file. - % Stack for pattern procedures: infile line + % Copy the definitions of the subfonts, moving the + % CharStrings of the Roman supplement to an external file. + % Stack for pattern procedures: infile line /CSRName OutDot (CSR) concatstrings def /csr CSRName (w) file def @@ -206,8 +205,8 @@ QUIET not { (Writing ) print CSRName = flush } if /encoding 256 array def /patterns [ - % Patterns specific to the Roman supplement, in which - % the outlines are in an eexec section. + % Patterns specific to the Roman supplement, in which + % the outlines are in an eexec section. { (/Encoding 256 array) { pop out (/Encoding ) writestring { dup buffer readline pop @@ -216,8 +215,8 @@ QUIET not { (Writing ) print CSRName = flush } if loop { % Stack: infile dupline postdup (dup) predup pop pop exch pop - % The top element of the stack is a string beginning with - % an index and value to put into the Encoding. + % The top element of the stack is a string beginning with + % an index and value to put into the Encoding. token pop exch token pop exch pop encoding 3 1 roll put dup buffer readline pop dup (dup) search not { pop exit } if @@ -238,8 +237,8 @@ QUIET not { (Writing ) print CSRName = flush } if dup //.eexec_param_dict /eexecDecode filter } } { (dup/CharStrings ) { - % Copy the individual CharStrings to the CSR file, - % recording the lengths and offsets. + % Copy the individual CharStrings to the CSR file, + % recording the lengths and offsets. pop out (dup/CharStrings AltsysCFD3 /CharStrings get put\n) writestring /offsets 256 dict def { dup token pop % char name @@ -252,7 +251,7 @@ QUIET not { (Writing ) print CSRName = flush } if dup buffer readline pop pop % skip ND } loop - % We skipped the 'end'; skip the 'readonly put' as well. + % We skipped the 'end'; skip the 'readonly put' as well. 2 { dup token pop pop } repeat out (dup/PGOffsets ) writestring out csr fileposition write=only @@ -279,7 +278,7 @@ QUIET not { (Writing ) print CSRName = flush } if pop out (end % systemdict\n) writestring closefile } } - % Patterns for other supplements. + % Patterns for other supplements. { (pgfonts/) { { cdfromstr search not { exit } if out exch writestring pop out cdstr writestring @@ -305,7 +304,7 @@ QUIET not { (Writing ) print CSRName = flush } if (end def) search { pop pop pop exit } if (/Std) search { pop pop dup length 3 sub 3 exch getinterval - (]) search pop out ( ) writestring out exch writestring pop + (]) search pop out ( ) writestring out exch writestring pop } if pop } @@ -329,7 +328,7 @@ QUIET not { (Writing ) print CSRName = flush } if forall csr closefile - % Copy the definition of the root font. + % Copy the definition of the root font. dup buffer readstring pop out exch writestring closefile out ( @@ -337,7 +336,7 @@ setpacking ) writestring out closefile - % Remove the Mac garbage from the outline files. + % Remove the Mac garbage from the outline files. [ (COD) (CSA) ] { CDir (/) concatstrings (JIS83-1_) concatstrings @@ -345,9 +344,9 @@ out closefile exch OutDot exch concatstrings QUIET not { (Writing ) print dup = flush } if (w) file - % Stack: infile outfile + % Stack: infile outfile { 1 index buffer readstring exch - % Stack: infile outfile noteof substring + % Stack: infile outfile noteof substring 2 index exch writestring not { exit } if } loop closefile closefile diff --git a/Master/tlpkg/tlgs/lib/showchar.ps b/Master/tlpkg/tlgs/lib/showchar.ps index 8ebb81f2a1a..3172449f5b2 100644 --- a/Master/tlpkg/tlgs/lib/showchar.ps +++ b/Master/tlpkg/tlgs/lib/showchar.ps @@ -1,19 +1,19 @@ % Copyright (C) 1993, 1994, 1996 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: showchar.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % showchar.ps % Show the outline and rasterized forms of a character. @@ -37,7 +37,7 @@ } def /bitselectfont % <fontname> <scale> bitselectfont - { exch findfont exch scalefont setfont - % Compute the bounding box in device coordinates. + % 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 @@ -70,7 +70,7 @@ 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. + % Show the hints for Type 1 fonts also. currentfont /FontType get 1 eq { gsave 1 0 0 setrgbcolor 0 lly M idtransform translate diff --git a/Master/tlpkg/tlgs/lib/stcinfo.ps b/Master/tlpkg/tlgs/lib/stcinfo.ps index d452698db89..13a05101644 100644 --- a/Master/tlpkg/tlgs/lib/stcinfo.ps +++ b/Master/tlpkg/tlgs/lib/stcinfo.ps @@ -1,29 +1,29 @@ % Copyright (C) 1995 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: stcinfo.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % stcinfo.ps % Epson Stylus-Color Printer-Driver -% The purpose of this file is to print & show Parameters of the -% stcolor-driver. If not run on ghostscript/stcolor, it prints +% The purpose of this file is to print & show Parameters of the +% stcolor-driver. If not run on ghostscript/stcolor, it prints % something like a color-chart. % use either existing STCinfo-dictionary, retrieve new one or create dummy -statusdict begin product end +statusdict begin product end dup (Ghostscript) eq 1 index (Aladdin Ghostscript) eq or exch (AFPL Ghostscript) eq or{ @@ -65,12 +65,10 @@ exch (AFPL Ghostscript) eq or{ /colortri_bg {pop pop 0.85 dup dup} bind def - % +---------------------------------------------------------------------+ % | Besides from fixing bugs, nothing should be changed below this line | % +---------------------------------------------------------------------+ - % Arbitrary operation on a pair of vectors, *CHANGES* 1st. % invoke: Vaccu Vop op vop /vop { @@ -85,7 +83,6 @@ exch (AFPL Ghostscript) eq or{ % Compute sum of vectors elements /vsum {0.0 exch{add}forall} bind def - % Sum up products of elements /veqn { [ 3 -1 roll {} forall ] exch vmul vsum } bind def @@ -105,7 +102,7 @@ exch (AFPL Ghostscript) eq or{ % Procedure to *CHANGE* transform rgb->xy /rgb2xy { - rgb2xyz + rgb2xyz dup 0 get 1 index 1 get 2 index vsum % XYZ X Y sum dup 0 ne { exch 1 index div 3 1 roll div % XYZ y x @@ -125,7 +122,6 @@ exch (AFPL Ghostscript) eq or{ /colortri_scale exch def /colortri_box exch def - % Prepare some useful constants for xy -> RGB conversion /colsum [ % Array with column-sums @@ -136,7 +132,7 @@ exch (AFPL Ghostscript) eq or{ /Yrow colortri_mat 3 3 getinterval def % Avoid allocating new arrays - /xcoeff 3 array def + /xcoeff 3 array def /ycoeff 3 array def % Procedure to derive RGB-Values form X,Y @@ -151,13 +147,13 @@ exch (AFPL Ghostscript) eq or{ 1e-6 lt { % No Pivot ? pop colortri_bg xcoeff astore pop }{ % Have a Pivot - dup ycoeff exch get neg + dup ycoeff exch get neg 0 1 2 { dup ycoeff exch get 2 index div ycoeff 3 1 roll put} for pop ycoeff 1 index 0 put - xcoeff 1 index get - 0 1 2 { - ycoeff 1 index get 2 index mul xcoeff 2 index get add + xcoeff 1 index get + 0 1 2 { + ycoeff 1 index get 2 index mul xcoeff 2 index get add xcoeff 3 1 roll put } for pop xcoeff 1 index 0 put @@ -165,23 +161,23 @@ exch (AFPL Ghostscript) eq or{ pop pop colortri_bg xcoeff astore pop }{ dup 2 index or 3 exch sub - xcoeff 1 index get xcoeff 3 index get div neg + xcoeff 1 index get xcoeff 3 index get div neg xcoeff exch 3 index exch put xcoeff 1 index 1 put ycoeff exch get ycoeff 2 index get xcoeff 4 -1 roll get mul add xcoeff 3 1 roll put - 0 1 2 { + 0 1 2 { xcoeff exch get dup -0.0015 lt exch 1.0015 gt or { colortri_bg xcoeff astore dup exit } if } for - pop pop xcoeff + pop pop xcoeff } ifelse } ifelse } bind def % Compute the displayed range - [ 1 1 1 ] rgb2xy + [ 1 1 1 ] rgb2xy dup 0 get /colortri_x0 exch def /colortri_dx colortri_x0 def 1 get /colortri_y0 exch def /colortri_dy colortri_y0 def [[0 0 1][0 1 0][0 1 1][1 0 0][1 0 1][1 1 0]] { @@ -208,10 +204,10 @@ exch (AFPL Ghostscript) eq or{ colortri_box 2 get colortri_box 0 get sub dup colortri_dy mul colortri_dx div } ifelse - dtransform abs colortri_scale div cvi /colortri_ny exch def + dtransform abs colortri_scale div cvi /colortri_ny exch def abs colortri_scale div cvi /colortri_nx exch def - colortri_nx colortri_scale mul colortri_ny colortri_scale mul - idtransform abs exch abs exch + colortri_nx colortri_scale mul colortri_ny colortri_scale mul + idtransform abs exch abs exch colortri_box 0 get colortri_box 2 get 1 index sub 3 index sub 2 div add colortri_box 1 get colortri_box 3 get 1 index sub 3 index sub 2 div add transform .5 add cvi exch .5 add cvi exch itransform @@ -225,7 +221,7 @@ exch (AFPL Ghostscript) eq or{ /colortri_ie colortri_tmp length 3 sub def colortri_nx colortri_ny 8 [ colortri_nx 0 0 colortri_ny 0 0 ] - { + { colortri_xy 0 colortri_x0 put 0 3 colortri_ie { colortri_tmp exch % buf ir @@ -256,7 +252,7 @@ exch (AFPL Ghostscript) eq or{ % action upon ProcessColorModel /STCimode { - /ProcessColorModel STCiget dup + /ProcessColorModel STCiget dup /DeviceCMYK eq{pop 2}{/DeviceRGB eq{1}{0}ifelse}ifelse get exec } bind def @@ -266,7 +262,7 @@ exch (AFPL Ghostscript) eq or{ } bind def % print right or left-justified text -/STCiprint { +/STCiprint { dup 0 gt { dup 2 index length sub STCipspace } if 1 index print dup 0 lt { neg dup 2 index length sub STCipspace } if @@ -279,7 +275,7 @@ exch (AFPL Ghostscript) eq or{ % Prepare the result 8 string dup 0 ( ) putinterval - exch + exch % Make it unsigned dup 0 lt {neg(-)}{( )}ifelse 0 get exch @@ -310,7 +306,7 @@ exch (AFPL Ghostscript) eq or{ dup 0 eq { pop pop dup cvi sub % String fraction dup 0.0 ne { % Fraction present - 0.0005 add 1 index 4 (.) putinterval + 0.0005 add 1 index 4 (.) putinterval 5 1 7 { % string frac ind exch 10 mul dup cvi exch 1 index sub % string ind ic nfrac exch (0123456789) exch get 3 -1 roll % string nfrac chr ind @@ -329,7 +325,7 @@ exch (AFPL Ghostscript) eq or{ } for pop } ifelse - + } bind def % compute colorvalue-steps from transfer & coding @@ -366,7 +362,7 @@ exch (AFPL Ghostscript) eq or{ 2 copy exch dup 0 eq { 10 index exch 0.0 put pop }{ - dup 10 index exch 1 sub get 3 -1 roll add 2 div + dup 10 index exch 1 sub get 3 -1 roll add 2 div 10 index 3 1 roll put }ifelse 7 index 3 1 roll put @@ -399,7 +395,7 @@ exch (AFPL Ghostscript) eq or{ dup 2 index add 2 div 3 index exec % Color to average 4 index 2 get 5 index 0 get sub exch 1 index mul 5 index 0 get add 3 1 roll mul 4 index 0 get add 4 index 3 get 5 index 1 get - newpath + newpath 2 index 1 index moveto 3 index 1 index lineto 3 index 2 index lineto @@ -407,7 +403,7 @@ exch (AFPL Ghostscript) eq or{ closepath fill pop pop pop pop } for - pop pop + pop pop 0 setgray newpath dup 0 get 1 index 1 get moveto @@ -440,15 +436,15 @@ exch (AFPL Ghostscript) eq or{ /STCi_l2 0 def /STCi_text [ % Driver-Name & Version - (Parameters of) + (Parameters of) /Name STCiget length /Version STCiget length add 1 add string dup 0 /Name STCiget putinterval dup /Name STCiget length (-)putinterval dup /Name STCiget length 1 add /Version STCiget putinterval % Dithering-Algorithm - (Dithering) - /Dithering STCiget + (Dithering) + /Dithering STCiget [{( \(Monochrome\))}{( \(RGB\))}{( \(CMYK\))}] STCimode - dup length 2 index length add string exch 1 index exch + dup length 2 index length add string exch 1 index exch 3 index length exch putinterval dup 3 1 roll exch 0 exch putinterval % Flags for the algorithm (Flag4-0) 5 string @@ -458,7 +454,7 @@ exch (AFPL Ghostscript) eq or{ dup 3 /Flag1 STCiget {(T)}{(f)} ifelse putinterval dup 4 /Flag0 STCiget {(T)}{(f)} ifelse putinterval -% Bits Per Pixel & Bits Per Component +% Bits Per Pixel & Bits Per Component (BitsPerPixel) 10 string % (nn -> nxnn) /BitsPerPixel STCiget 1 index cvs length % string used dup 2 index exch ( -> ) putinterval 4 add dup 2 add exch 2 index exch @@ -470,19 +466,19 @@ exch (AFPL Ghostscript) eq or{ % ColorAdjustMatrix (ColorAdjustMatrix) /ColorAdjustMatrix STCiget dup null eq { - pop (default) + pop (default) }{ { STCicvs } forall [{ % Monochrome - 26 string + 26 string dup 0 6 -1 roll putinterval dup 8 ( ) putinterval dup 9 5 -1 roll putinterval dup 17 ( ) putinterval - dup 18 4 -1 roll putinterval + dup 18 4 -1 roll putinterval }{ % RGB - 26 string + 26 string dup 0 12 -1 roll putinterval dup 8 ( ) putinterval dup 9 11 -1 roll putinterval dup 17 ( ) putinterval - dup 18 10 -1 roll putinterval + dup 18 10 -1 roll putinterval () 26 string dup 0 11 -1 roll putinterval dup 8 ( ) putinterval @@ -494,7 +490,7 @@ exch (AFPL Ghostscript) eq or{ dup 9 9 -1 roll putinterval dup 17 ( ) putinterval dup 18 8 -1 roll putinterval }{ - 35 string + 35 string dup 0 19 -1 roll putinterval dup 8 ( ) putinterval dup 9 18 -1 roll putinterval dup 17 ( ) putinterval dup 18 17 -1 roll putinterval dup 26 ( ) putinterval @@ -528,7 +524,7 @@ exch (AFPL Ghostscript) eq or{ % Resolution (Resolution) 15 string % (nnnnnxnnnnn DpI) - /HWResolution STCiget 0 get cvi 1 index cvs length + /HWResolution STCiget 0 get cvi 1 index cvs length dup 2 index exch (x) putinterval 1 add dup 2 index exch 5 getinterval /HWResolution STCiget 1 get cvi exch cvs length add dup 2 index exch ( DpI) putinterval 4 add 0 exch getinterval @@ -536,10 +532,10 @@ exch (AFPL Ghostscript) eq or{ % HWsize holds entire Page in Pixels, % .HWMargins is [left,bottom,right,top] in Points (Printed Area) 18 string % (nnnnnxnnnnn Pixel) - /HWSize STCiget 0 get /.HWMargins STCiget dup 0 get exch 2 get add + /HWSize STCiget 0 get /.HWMargins STCiget dup 0 get exch 2 get add /HWResolution STCiget 0 get mul 72.0 div sub cvi 1 index cvs length dup 2 index exch (x) putinterval 1 add dup 2 index exch 5 getinterval - /HWSize STCiget 1 get /.HWMargins STCiget dup 1 get exch 3 get add + /HWSize STCiget 1 get /.HWMargins STCiget dup 1 get exch 3 get add /HWResolution STCiget 1 get mul 72.0 div sub cvi exch cvs length add dup 2 index exch ( Pixel) putinterval 6 add 0 exch getinterval @@ -572,7 +568,7 @@ exch (AFPL Ghostscript) eq or{ /STCi_xv [ 3 -1 roll ] def /STCi_col [[0 0 0]] def /STCi_set [{1.0 exch sub setgray}] def - }{ % RGB + }{ % RGB /Rtransfer STCiget /Rcoding STCiget STCisteps /Gtransfer STCiget /Gcoding STCiget STCisteps /Btransfer STCiget /Bcoding STCiget STCisteps @@ -602,9 +598,9 @@ exch (AFPL Ghostscript) eq or{ } ]STCimode -} stopped +} stopped -{ {/STCi_stopped eq {exit}if}loop true} +{ {/STCi_stopped eq {exit}if}loop true} { {/STCi_stopped eq {exit}if}loop false} ifelse % End: stcinfo_preparation @@ -625,9 +621,9 @@ exch (AFPL Ghostscript) eq or{ STCi_text exch get length dup STCi_l2 gt{/STCi_l2 exch def}{pop}ifelse } for /STCi_l2 STCi_l2 neg def - 0 2 STCi_text length 2 sub { + 0 2 STCi_text length 2 sub { dup 1 add STCi_text exch get exch STCi_text exch get - 1 index length 0 gt { + 1 index length 0 gt { dup STCi_l1 STCiprint length 0 gt {(: )}{( )}ifelse print print }{ pop pop @@ -718,8 +714,8 @@ exch (AFPL Ghostscript) eq or{ % The Graphs gsave - STCi_win 0 get 14 add STCi_win 1 get 14 add - STCi_win 2 get 2 index sub STCi_win 3 get 2 index sub + STCi_win 0 get 14 add STCi_win 1 get 14 add + STCi_win 2 get 2 index sub STCi_win 3 get 2 index sub 4 2 roll translate STCi_col 0 1 2 index length 1 sub { 1 index 1 index get aload pop setrgbcolor @@ -749,7 +745,7 @@ exch (AFPL Ghostscript) eq or{ % compute the upper bar-window % /STCi_win [ - STCi_clip 0 get 4 -1 roll 36 sub STCi_clip 2 get 1 index 36 add + STCi_clip 0 get 4 -1 roll 36 sub STCi_clip 2 get 1 index 36 add ] def % diff --git a/Master/tlpkg/tlgs/lib/stcolor.ps b/Master/tlpkg/tlgs/lib/stcolor.ps index 4aec40e7e2b..4ba9678bfb7 100644 --- a/Master/tlpkg/tlgs/lib/stcolor.ps +++ b/Master/tlpkg/tlgs/lib/stcolor.ps @@ -1,19 +1,19 @@ % Copyright (C) 1995 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: stcolor.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % stcolor.ps % Epson Stylus-Color Printer-Driver @@ -69,11 +69,10 @@ exch (AFPL Ghostscript) eq or{ % pick the colormodel STCold /ProcessColorModel get /STCcolor exch def - - mark % prepare stack for "putdeviceprops" + mark % prepare stack for "putdeviceprops" % warn for BitsPerPixel=30 with fsrgb - STCcolor /DeviceRGB eq STCold /BitsPerPixel get 32 eq and + STCcolor /DeviceRGB eq STCold /BitsPerPixel get 32 eq and { (%%[ stcolor.ps: inefficient RGB-setup, recommend BitsPerPixel=24 ]%%\n) print @@ -84,15 +83,15 @@ exch (AFPL Ghostscript) eq or{ % if the selected algorithm uses another ProcessColorModel, it is necessary % to change the Value of STCcolor according to the new algorithm. - STCold /Dithering get (gscmyk) eq - { + STCold /Dithering get (gscmyk) eq + { /Dithering (hscmyk) % preferred dithering-method } if % might be necessary to change STCcolor too % % select the array according to the resolution % - STCdpi 359.0 lt + STCdpi 359.0 lt { STCdeftransfer } { STCdpi 361.0 lt { STCKtransfer360 } @@ -101,12 +100,12 @@ exch (AFPL Ghostscript) eq or{ { STCKtransfer360 length STCKtransfer720 length eq { - 0 1 STCKtransfer360 length 1 sub + 0 1 STCKtransfer360 length 1 sub { - dup dup - STCKtransfer360 exch get - exch STCKtransfer720 exch get - add 2.0 div + dup dup + STCKtransfer360 exch get + exch STCKtransfer720 exch get + add 2.0 div STCKtransfer360 3 1 roll put } for }if @@ -117,19 +116,19 @@ exch (AFPL Ghostscript) eq or{ /STCtransfer exch def % -% Add the arrays. With Version 1.17 and above, it seems to be +% Add the arrays. With Version 1.17 and above, it seems to be % a good idea, to use the transfer-arrays as coding-arrays too. % % % RGB-Model requires inversion of the transfer-arrays % - STCcolor /DeviceRGB eq + STCcolor /DeviceRGB eq { /RGBtransfer STCtransfer length array def 0 1 STCtransfer length 1 sub { - dup RGBtransfer length 1 sub exch sub exch + dup RGBtransfer length 1 sub exch sub exch STCtransfer exch get 1.0 exch sub RGBtransfer 3 1 roll put } for @@ -156,7 +155,7 @@ exch (AFPL Ghostscript) eq or{ } ifelse - counttomark 0 ne + counttomark 0 ne {currentdevice putdeviceprops pop}{cleartomark}ifelse % decativate predefined correction diff --git a/Master/tlpkg/tlgs/lib/stocht.ps b/Master/tlpkg/tlgs/lib/stocht.ps index 90cfb40ccb0..6c440f10df6 100644 --- a/Master/tlpkg/tlgs/lib/stocht.ps +++ b/Master/tlpkg/tlgs/lib/stocht.ps @@ -1,19 +1,19 @@ % Copyright (C) 1999, 2000 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: stocht.ps 8022 2007-06-05 22:23:38Z giles $ +% $Id$ % helper file to simplify use of Stochastic Halftone - uses ht_ccsto.ps % This file sets the /StochasticDefault /Halftone as the current diff --git a/Master/tlpkg/tlgs/lib/traceimg.ps b/Master/tlpkg/tlgs/lib/traceimg.ps index c61c65bb563..e6c6e9d5ab2 100644 --- a/Master/tlpkg/tlgs/lib/traceimg.ps +++ b/Master/tlpkg/tlgs/lib/traceimg.ps @@ -1,19 +1,19 @@ % Copyright (C) 1994 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: traceimg.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % traceimg.ps % Trace the data supplied to the 'image' operator. diff --git a/Master/tlpkg/tlgs/lib/traceop.ps b/Master/tlpkg/tlgs/lib/traceop.ps index 3eaa114bf41..c4031ac4e6a 100644 --- a/Master/tlpkg/tlgs/lib/traceop.ps +++ b/Master/tlpkg/tlgs/lib/traceop.ps @@ -1,19 +1,19 @@ % Copyright (C) 1992, 1993, 1994, 1999 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: traceop.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Trace individual operators or procedures. % <opref> is <opname> or <opname> <dict> % (dict defaults to dict where op is currently defined, if writable; @@ -63,7 +63,7 @@ currentpacking true setpacking .tdict .tname get /.tdef 1 index cvlit def dup xcheck { dup type dup /arraytype eq exch /packedarraytype eq or { - /exec cvx + /exec cvx } if } if /.tpost load /traceprint cvx () /= cvx /traceend cvx diff --git a/Master/tlpkg/tlgs/lib/type1enc.ps b/Master/tlpkg/tlgs/lib/type1enc.ps index 44b54cb335c..e0d678c7b07 100644 --- a/Master/tlpkg/tlgs/lib/type1enc.ps +++ b/Master/tlpkg/tlgs/lib/type1enc.ps @@ -1,19 +1,19 @@ % Copyright (C) 1992, 1993 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: type1enc.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % type1enc.ps % PostScript language versions of the Type 1 encryption/decryption algorithms. @@ -22,7 +22,7 @@ % "Adobe Type 1 Font Format," ISBN 0-201-57044-0, published by Addison-Wesley. /.type1crypt % <R> <from> <to> <proc> .type1crypt <R'> <to> - % (auxiliary procedure) + % (auxiliary procedure) { 4 1 roll 0 2 index length getinterval 0 1 2 index length 1 sub diff --git a/Master/tlpkg/tlgs/lib/type1ops.ps b/Master/tlpkg/tlgs/lib/type1ops.ps index bfb11478272..041c38c5638 100644 --- a/Master/tlpkg/tlgs/lib/type1ops.ps +++ b/Master/tlpkg/tlgs/lib/type1ops.ps @@ -1,19 +1,19 @@ % Copyright (C) 1992, 1997, 1998, 1999 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: type1ops.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % type1ops.ps % Define the Type 1 and Type 2 font opcodes for use by Ghostscript utilities. @@ -26,7 +26,7 @@ /Type1encode 70 dict - % Data types + % Data types dup /nulltype { pop () @@ -46,14 +46,14 @@ dup /integertype { 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 + dup 8 mul 32 sub 3 index exch bitshift 255 and + 2 index 3 1 roll put } for exch pop } ifelse } ifelse } put - % Operators + % Operators % Identical or similar in Type 1 and Type 2. /c_hstem 1 def dup /hstem <01> put @@ -130,7 +130,7 @@ readonly def Type1encode { dup type /stringtype eq { dup length 1 eq { 0 get } { 1 get 256 add } ifelse - % stack: array key code + % stack: array key code exch 2 index 3 1 roll put } { pop pop diff --git a/Master/tlpkg/tlgs/lib/uninfo.ps b/Master/tlpkg/tlgs/lib/uninfo.ps index 92a0e9e97e5..e7876458ad4 100644 --- a/Master/tlpkg/tlgs/lib/uninfo.ps +++ b/Master/tlpkg/tlgs/lib/uninfo.ps @@ -1,20 +1,20 @@ %! % Copyright (C) 1997 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: uninfo.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % uninfo.ps: Utilities for "printing" PostScript items, especially dictionaries % Usage: % (prefix-string) dict unprint @@ -77,7 +77,7 @@ } if 2 index exch 2 index exch put 1 add - } ifelse + } ifelse } forall 1 index exch (\)) putinterval }{ exch pop @@ -116,7 +116,7 @@ exch }{ ( ) print - 2 index add 1 add + 2 index add 1 add 3 -1 roll pop exch } ifelse @@ -140,7 +140,7 @@ [ 1 index { pop dup type /nametype eq { dup length string cvs - }{ + }{ pop } ifelse } forall @@ -151,7 +151,7 @@ 1 index 1 add 1 4 index length 1 sub { % stack: dic nam I nam[I] J 3 index 1 index get % dic nam I S[I] J S[J] 2 index 1 index gt { % swap them - 4 index 2 index 4 index put + 4 index 2 index 4 index put 4 index 4 index 2 index put 3 1 roll } if @@ -170,22 +170,22 @@ length 2 copy lt { exch } if pop } forall % Print out all the items, stack: pre dic nam maxlen - (\n) print + (\n) print exch { % pre dic maxlen nam[I] % no prefix yet, -> flush right 3 index length 0 eq { dup length 2 index exch sub HSpindent }{ 3 index print (/) print - } ifelse + } ifelse % print the name dup print -% prefix: fill up with blanks +% prefix: fill up with blanks 3 index length 0 ne { dup length 2 index exch sub HSpindent } if % now print the item itself, stack: pre dic maxlen nam[I] - 2 index 1 index cvn get dup type % stack: pre dic maxlen nam[i] item typ + 2 index 1 index cvn get dup type % stack: pre dic maxlen nam[i] item typ % Dict-Syntax dup /dicttype eq { pop % stack: pre dic maxlen nam[i] item ( ) print dup HScvs print @@ -203,7 +203,7 @@ 3 -1 roll pop % tack: pre dic maxlen item typ % Array-Syntax dup /arraytype eq { pop % stack: pre dic maxlen item - 3 index length dup 0 ne { 1 add } if 2 index add + 3 index length dup 0 ne { 1 add } if 2 index add exch HSaprint }{ pop ( ) print diff --git a/Master/tlpkg/tlgs/lib/unprot.ps b/Master/tlpkg/tlgs/lib/unprot.ps index c8faefebdb7..4c5ee8add8c 100644 --- a/Master/tlpkg/tlgs/lib/unprot.ps +++ b/Master/tlpkg/tlgs/lib/unprot.ps @@ -1,19 +1,19 @@ % Copyright (C) 1991, 1992, 1998 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: unprot.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Disable all access checks. This is useful for printing out % eexec-encrypted Type 1 fonts, and similar purposes. diff --git a/Master/tlpkg/tlgs/lib/viewcmyk.ps b/Master/tlpkg/tlgs/lib/viewcmyk.ps index 5476e3732d5..864f6e1344c 100644 --- a/Master/tlpkg/tlgs/lib/viewcmyk.ps +++ b/Master/tlpkg/tlgs/lib/viewcmyk.ps @@ -1,19 +1,19 @@ % Copyright (C) 1996, 1997, 1998 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: viewcmyk.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % viewcmyk.ps % Display a raw CMYK file. % Requires the colorimage operator. @@ -31,14 +31,14 @@ mark fname status pop pop pop /flen exch def cleartomark /h flen w bpc 4 mul mul 7 add 8 idiv idiv def (Dimensions: ) print [w h] == flush - % Set up scaling. + % Set up scaling. /SCALE where { pop - % Map pixels SCALE-for-1. Assume orthogonal transformation. + % Map pixels SCALE-for-1. Assume orthogonal transformation. SCALE 1 0 dtransform add abs div SCALE 0 1 dtransform add abs div } { - % Scale the image (uniformly) to fit the page. + % Scale the image (uniformly) to fit the page. clippath pathbbox pop pop translate pathbbox 3 -1 roll sub h div 3 1 roll exch sub w div .min dup diff --git a/Master/tlpkg/tlgs/lib/viewgif.ps b/Master/tlpkg/tlgs/lib/viewgif.ps index 2b7aecae71b..78c45bdb221 100644 --- a/Master/tlpkg/tlgs/lib/viewgif.ps +++ b/Master/tlpkg/tlgs/lib/viewgif.ps @@ -1,19 +1,19 @@ % Copyright (C) 1989, 1992, 1993, 1998 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: viewgif.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % viewgif.ps % Display a GIF file. @@ -48,7 +48,7 @@ } bind def /readGIFimageHeader % <file> readGIFimageHeader <dict> - % Note: GIF header must be on dict stack + % Note: GIF header must be on dict stack { 10 dict begin { dup read1 dup (!) 0 get ne { exit } if pop % extension @@ -80,21 +80,21 @@ /imageGIF % <imagedict> imageGIF { /ImageOut where { pop - % We know BitsPerComponent = 8, Decode = [0 255]. - % and there is only a single data source which is - % either a filter or a string whose size is exactly - % the width of the row. + % We know BitsPerComponent = 8, Decode = [0 255]. + % and there is only a single data source which is + % either a filter or a string whose size is exactly + % the width of the row. dup /DataSource get dup type /stringtype eq { ImageOut exch writestring } { pop dup /Width get string - 1 index /Height get - { 1 index /DataSource get 1 index readstring pop - ImageOut exch writestring - } - repeat pop pop + 1 index /Height get + { 1 index /DataSource get 1 index readstring pop + ImageOut exch writestring + } + repeat pop pop } - ifelse + ifelse } { image } @@ -115,9 +115,9 @@ VGIFDEBUG { ImageHeader { exch == == } forall (----------------\n) print flush } if /D F << /InitialCodeLength F read1 - /FirstBitLowOrder true - /BlockData true - /EarlyChange 0 + /FirstBitLowOrder true + /BlockData true + /EarlyChange 0 >> /LZWDecode filter def [/Indexed /DeviceRGB 1 BitsPerPixel bitshift 1 sub Palette] setcolorspace @@ -125,25 +125,25 @@ 0 1 3 { 2 copy get dup 0 ne { dup abs div } if 3 copy put pop pop } for setmatrix << /ImageType 1 - /ImageMatrix [1 0 0 -1 0 Height] - /BitsPerComponent 8 - /Decode [0 255] + /ImageMatrix [1 0 0 -1 0 Height] + /BitsPerComponent 8 + /Decode [0 255] Interlaced { /Width Width /Height 1 - /row Width string def - /DataSource row + /row Width string def + /DataSource row >> /I exch def /inter % <num> <denom> inter - { /denom exch def /num exch def gsave - /lines Height denom 1 sub add num sub denom idiv def - 0 1 lines 1 sub { - Height exch denom mul num add sub - I /ImageMatrix get 5 3 -1 roll put - D row readstring pop pop - I imageGIF - } for - grestore + /lines Height denom 1 sub add num sub denom idiv def + 0 1 lines 1 sub { + Height exch denom mul num add sub + I /ImageMatrix get 5 3 -1 roll put + D row readstring pop pop + I imageGIF + } for + grestore } bind def 0 8 inter @@ -152,9 +152,9 @@ 1 2 inter } { /Width Width /Height Height - /DataSource D + /DataSource D >> imageGIF } ifelse saved end end end restore - } bind def + } bind def diff --git a/Master/tlpkg/tlgs/lib/viewjpeg.ps b/Master/tlpkg/tlgs/lib/viewjpeg.ps index 9ba1b61f9a6..7de234015eb 100644 --- a/Master/tlpkg/tlgs/lib/viewjpeg.ps +++ b/Master/tlpkg/tlgs/lib/viewjpeg.ps @@ -2,18 +2,18 @@ % % 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: viewjpeg.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % View JPEG files with Ghostscript % % This PostScript code relies on level 2 features. @@ -30,7 +30,7 @@ % pstack exec quit | voice +49/89/29160728 % ------------------------------+ tm@muc.de http://www.muc.de/~tm/ % -% $Id: viewjpeg.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Updated by L. Peter Deutsch 20-May-1997: % move the usage example to the beginning % Updates by Tom Lane 6-Sep-1995 @@ -58,7 +58,7 @@ JPEGdict begin % read one byte from file F % - ==> int --or-- stop context -/NextByte { +/NextByte { F read not { (Read error in ViewJPEG!\n) print flush stop } if } bind def @@ -72,38 +72,38 @@ JPEGdict begin 5 dict begin { % loop: read JPEG marker segments until we find SOFn marker or EOF - NextByte - 16#FF eq { % found marker - /markertype NextByte def - % Is it S0F0=baseline, SOF1=extended sequential, SOF2=progressive ? - markertype dup 16#C0 ge exch 16#C2 le and { - NextByte pop NextByte pop % segment length - % Ghostscript and Adobe PS accept only data precision 8 - NextByte 8 ne { - (Error: not 8 bits per component!\n) print flush stop - } if - - % Read crucial image parameters - /height NextByte 8 bitshift NextByte add def - /width NextByte 8 bitshift NextByte add def - /colors NextByte def - - VJPGDEBUG { currentdict { exch == == } forall flush } if - exit - } if - - % detect several segment types which are not compatible with PS - NotSupportedMarkers { - markertype eq { - (Marker ) print markertype == - (not supported!\n) print flush stop - } if - } forall - - % Skip segment if marker has parameters associated with it - true NoParamMarkers { markertype eq {pop false exit} if } forall - { SkipSegment } if - } if + NextByte + 16#FF eq { % found marker + /markertype NextByte def + % Is it S0F0=baseline, SOF1=extended sequential, SOF2=progressive ? + markertype dup 16#C0 ge exch 16#C2 le and { + NextByte pop NextByte pop % segment length + % Ghostscript and Adobe PS accept only data precision 8 + NextByte 8 ne { + (Error: not 8 bits per component!\n) print flush stop + } if + + % Read crucial image parameters + /height NextByte 8 bitshift NextByte add def + /width NextByte 8 bitshift NextByte add def + /colors NextByte def + + VJPGDEBUG { currentdict { exch == == } forall flush } if + exit + } if + + % detect several segment types which are not compatible with PS + NotSupportedMarkers { + markertype eq { + (Marker ) print markertype == + (not supported!\n) print flush stop + } if + } forall + + % Skip segment if marker has parameters associated with it + true NoParamMarkers { markertype eq {pop false exit} if } forall + { SkipSegment } if + } if } loop currentdict dup /markertype undef @@ -114,7 +114,7 @@ end % JPEGdict % read image parameters from JPEG file and display the image /viewJPEG { % <file|string> ==> - - save + save JPEGdict begin /saved exch def /scratch 1 string def diff --git a/Master/tlpkg/tlgs/lib/viewmiff.ps b/Master/tlpkg/tlgs/lib/viewmiff.ps index 19b47bb95af..ede829b2c64 100644 --- a/Master/tlpkg/tlgs/lib/viewmiff.ps +++ b/Master/tlpkg/tlgs/lib/viewmiff.ps @@ -1,19 +1,19 @@ % Copyright (C) 1998 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: viewmiff.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % viewmiff.ps % Display a MIFF file. You would think the 'display' command would do this, % but many versions of 'display' either core-dump or require unacceptably @@ -39,27 +39,27 @@ } /PseudoClass { [ /Indexed - % The MIFF documentation lies about the size of pixels - % for this case: the pixel size is determined only by - % the number of colors, and is not affected by the image - % depth. Specifically, if there are 256 or fewer colors - % but the depth (of color map entries) is 16, each pixel - % is still only 1 byte, not 2. + % The MIFF documentation lies about the size of pixels + % for this case: the pixel size is determined only by + % the number of colors, and is not affected by the image + % depth. Specifically, if there are 256 or fewer colors + % but the depth (of color map entries) is 16, each pixel + % is still only 1 byte, not 2. currentdict /colors known { - /DeviceRGB colors 1 sub - /BitsPerComponent colors 256 le { 8 } { 16 } ifelse def - colors 3 mul string depth 8 eq { - f exch readstring pop - } { - % 16-bit color map entries: take only the high-order byte. - 0 1 2 index length 1 sub { - f read pop 2 index 3 1 roll put f read pop pop - } for - } ifelse + /DeviceRGB colors 1 sub + /BitsPerComponent colors 256 le { 8 } { 16 } ifelse def + colors 3 mul string depth 8 eq { + f exch readstring pop + } { + % 16-bit color map entries: take only the high-order byte. + 0 1 2 index length 1 sub { + f read pop 2 index 3 1 roll put f read pop pop + } for + } ifelse } { - /colors 256 def - /DeviceGray 255 - 256 string 0 1 255 { 1 index exch dup put } for + /colors 256 def + /DeviceGray 255 + 256 string 0 1 255 { 1 index exch dup put } for } ifelse ] setcolorspace /Decode [ 0 1 BitsPerComponent bitshift 1 sub ] def @@ -69,7 +69,7 @@ % Recognize MIFF compression methods. /rlstring 768 string def /rlread { - % packets is not reliable -- disregard it. + % packets is not reliable -- disregard it. dup rlstring 0 3 getinterval readstring { pop read pop 3 mul 3 3 2 index { rlstring exch rlstring 0 3 getinterval putinterval @@ -90,26 +90,26 @@ 50 dict begin /fname 1 index def /f exch (r) file def - % Set defaults. + % Set defaults. /ImageType 1 def /class /DirectClass def /compression /Uncompressed def /depth 8 def /packets 16#7fffffff def - % Read and parse the header. + % Read and parse the header. { f token pop dup (:) eq { pop exit } if dup type /nametype eq { .namestring (=) search { - exch pop miffwords exch .knownget { exec } { pop } ifelse + exch pop miffwords exch .knownget { exec } { pop } ifelse } { - pop % who knows? + pop % who knows? } ifelse } { pop % probably a comment in braces } ifelse } loop - % Read and display the image. + % Read and display the image. miffclasses class get exec /DataSource miffcompress compression get exec def /ImageMatrix [Width 0 0 Height neg 0 Height] def @@ -118,7 +118,7 @@ gsave 0.8 setgray 0 0 1 1 rectfill grestore % provide background currentdict image showpage - % Clean up. + % Clean up. f closefile end } bind def diff --git a/Master/tlpkg/tlgs/lib/viewpbm.ps b/Master/tlpkg/tlgs/lib/viewpbm.ps index a6934fbab5c..c2dbc5701c3 100644 --- a/Master/tlpkg/tlgs/lib/viewpbm.ps +++ b/Master/tlpkg/tlgs/lib/viewpbm.ps @@ -1,19 +1,19 @@ % Copyright (C) 1992, 1995, 1996, 1998, 1999 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: viewpbm.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % viewpbm.ps % Display a PBM/PGM/PPM file. % Requires the Level 2 `image' operator (to handle variable pixel widths). @@ -58,37 +58,37 @@ /wrem w 8 mod def /ncomp 1 def /invert true def /DeviceGray setcolorspace readwh - { readrow01 } + { readrow01 } } bind /P2 { % ASCII 8-bit gray readwh /bpc 8 def 2 index readmaxv /rsize 2 index def /ncomp 1 def /invert false def /DeviceGray setcolorspace - { readrow } + { readrow } } bind /P3 { % ASCII 8-bit RGB readwh /bpc 8 def 2 index readmaxv /rsize 2 index 3 mul def /ncomp 3 def /invert false def /DeviceRGB setcolorspace - { readrow } + { readrow } } bind /P4 { % Binary 1-bit white/black readwh /bpc 1 def /maxv 1 def /rsize 2 index 7 add 8 idiv def /ncomp 1 def /invert true def /DeviceGray setcolorspace - { readstring pop } + { readstring pop } } bind /P5 { % Binary 8-bit gray readwh /bpc 8 def 2 index readmaxv /rsize 2 index def /ncomp 1 def /invert false def /DeviceGray setcolorspace - { readstring pop } + { readstring pop } } bind /P6 { % Binary 8-bit RGB readwh /bpc 8 def 2 index readmaxv /rsize 2 index 3 mul def /ncomp 3 def /invert false def /DeviceRGB setcolorspace - { readstring pop } + { readstring pop } } bind .dicttomark readonly def /pbmsetup { % <file> <w> <h> <readproc> runpbm - @@ -110,17 +110,17 @@ begin /SCALE where { pop - % Map pixels SCALE-for-1. Assume orthogonal transformation. + % Map pixels SCALE-for-1. Assume orthogonal transformation. Width 1 0 dtransform add abs div SCALE mul Height 0 1 dtransform add abs div SCALE mul } { - % Scale the image (uniformly) to fit the page. + % Scale the image (uniformly) to fit the page. clippath pathbbox pop pop translate pathbbox .min exch pop exch pop ceiling dup Height Width gt { - Width mul Height div exch + Width mul Height div exch } { - Height mul Width div + Height mul Width div } ifelse } ifelse scale @@ -143,15 +143,15 @@ 20 dict begin /fname exch def /sources [ 0 1 3 { - /plane exch def + /plane exch def /pf fname (r) file def pf pbmtypes pf token pop get exec - % Stack: pf w h readproc + % Stack: pf w h readproc plane { - /readproc exch def /h exch def /w exch def pop - /row rsize string def - h { pf row readproc pop } repeat - pf pbmtypes pf token pop get exec + /readproc exch def /h exch def /w exch def pop + /row rsize string def + h { pf row readproc pop } repeat + pf pbmtypes pf token pop get exec } repeat pbmsetup } for ] def diff --git a/Master/tlpkg/tlgs/lib/viewpcx.ps b/Master/tlpkg/tlgs/lib/viewpcx.ps index cab82d213b4..17d180f5b8a 100644 --- a/Master/tlpkg/tlgs/lib/viewpcx.ps +++ b/Master/tlpkg/tlgs/lib/viewpcx.ps @@ -1,19 +1,19 @@ % Copyright (C) 1996, 1999 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: viewpcx.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % viewpcx.ps % Display a PCX file. % Requires the Level 2 `image' operator (to handle variable pixel widths). @@ -51,7 +51,7 @@ { 100 dict begin /fname 1 index def /f exch (r) file def - % Read and unpack the header. + % Read and unpack the header. /header f 128 string readstring pop def /version header 1 get def /bpp header 3 get def @@ -64,32 +64,32 @@ version 5 eq { nbits 8 le { /cspace - [/Indexed /DeviceRGB 1 bpp bitshift 1 sub - f fileposition - 1 nbits bitshift 3 mul string - fname status pop pop pop exch pop - 1 index length sub f exch setfileposition - f exch readstring pop - exch f exch setfileposition - ] def - /decode [0 cspace 2 get] def + [/Indexed /DeviceRGB 1 bpp bitshift 1 sub + f fileposition + 1 nbits bitshift 3 mul string + fname status pop pop pop exch pop + 1 index length sub f exch setfileposition + f exch readstring pop + exch f exch setfileposition + ] def + /decode [0 cspace 2 get] def } { /cspace /DeviceRGB def - /decode [0 1 0 1 0 1] def + /decode [0 1 0 1 0 1] def } ifelse } { /cspace - [/Indexed /DeviceRGB 1 bpp bitshift 1 sub - header 16 1 nbits bitshift 16 .min 3 mul getinterval - ] def + [/Indexed /DeviceRGB 1 bpp bitshift 1 sub + header 16 1 nbits bitshift 16 .min 3 mul getinterval + ] def /decode [0 cspace 2 get] def } ifelse - % Set up scaling. + % Set up scaling. /SCALE where { pop - % Map pixels SCALE-for-1. Assume orthogonal transformation. + % Map pixels SCALE-for-1. Assume orthogonal transformation. w 1 0 dtransform add abs div SCALE mul h 0 1 dtransform add abs div SCALE mul } @@ -99,10 +99,10 @@ dup h w gt { w mul h div exch } { h mul w div } ifelse } ifelse scale - % Since the number of bytes per line is always even, - % it may not match the width specification. + % Since the number of bytes per line is always even, + % it may not match the width specification. /wbpl w bpp mul 7 add 8 idiv def - % Define the data source procedure. + % Define the data source procedure. /s1 bpl wbpl sub string def /df /readpcx load copyarray dup 0 f put cvx bind readonly 0 () /SubFileDecode filter def @@ -112,7 +112,7 @@ cvx bind readonly } repeat ] def - % Construct the image dictionary. + % Construct the image dictionary. 20 dict begin % image dictionary /ImageType 1 def /Width w def @@ -125,7 +125,7 @@ { 0 get } ifelse def currentdict end - % Finally, display the image. + % Finally, display the image. cspace setcolorspace image showpage diff --git a/Master/tlpkg/tlgs/lib/viewps2a.ps b/Master/tlpkg/tlgs/lib/viewps2a.ps index 80b46548ee3..6d8d5d70f29 100644 --- a/Master/tlpkg/tlgs/lib/viewps2a.ps +++ b/Master/tlpkg/tlgs/lib/viewps2a.ps @@ -1,19 +1,19 @@ % Copyright (C) 1995 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: viewps2a.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % Display a file produced by ps2ascii with no switch or with -dCOMPLEX. % This is just a procset to read in before the file to display. diff --git a/Master/tlpkg/tlgs/lib/viewrgb.ps b/Master/tlpkg/tlgs/lib/viewrgb.ps index 18d87c3a544..603ef6710e8 100644 --- a/Master/tlpkg/tlgs/lib/viewrgb.ps +++ b/Master/tlpkg/tlgs/lib/viewrgb.ps @@ -1,22 +1,22 @@ % Copyright (C) 2009 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 that % license. 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. -% $Id: viewrgb.ps 9517 2009-03-02 19:47:28Z giles $ +% $Id$ % viewrgb.ps % Display a raw RGB file created by -sDEVICE=bitrgb. % If SCALE is defined, maps input pixels to output pixels with that scale; % if SCALE is undefined, scales the image to fit the page. % If BITS is defined, it is the number of bits per sample (1,2,8,12). -% NB: BITS=1 (corresponding to -dGrayValues=16) is not supported. +% NB: BITS=4 (corresponding to -dGrayValues=16) is not supported. % if BITS is undefined, its default value is 1. /viewrgb { % <filename> <width> viewrgb - @@ -34,46 +34,46 @@ } if mul 7 add 8 idiv idiv def QUIET not { (Dimensions: ) print [w h] == flush } if - % Set up scaling. + % Set up scaling. /SCALE where { pop - % Map pixels SCALE-for-1. Assume orthogonal transformation. + % Map pixels SCALE-for-1. Assume orthogonal transformation. SCALE 1 0 dtransform add abs div SCALE 0 1 dtransform add abs div } { - % Scale the image (uniformly) to fit the page. + % Scale the image (uniformly) to fit the page. clippath pathbbox pop pop translate pathbbox 3 -1 roll sub h div 3 1 roll exch sub w div .min dup } ifelse scale bpc 1 eq { [ /Indexed /DeviceRGB 15 < - 000000 - 0000FF - 00FF00 - 00FFFF - FF0000 - FF00FF - FFFF00 - FFFFFF - 000000 - 0000FF - 00FF00 - 00FFFF - FF0000 - FF00FF - FFFF00 - FFFFFF + 000000 + 0000FF + 00FF00 + 00FFFF + FF0000 + FF00FF + FFFF00 + FFFFFF + 000000 + 0000FF + 00FF00 + 00FFFF + FF0000 + FF00FF + FFFF00 + FFFFFF > ] setcolorspace /BPC 4 def % change to 4 bit indexed } { bpc 2 eq { [ /Indexed /DeviceRGB 255 < - 000000 000055 0000AA 0000FF - 005500 005555 0055AA 0055FF - 00AA00 00AA55 00AAAA 00AAFF - 00FF00 00FF55 00FFAA 00FFFF + 000000 000055 0000AA 0000FF + 005500 005555 0055AA 0055FF + 00AA00 00AA55 00AAAA 00AAFF + 00FF00 00FF55 00FFAA 00FFFF 550000 550055 5500AA 5500FF 555500 555555 5555AA 5555FF 55AA00 55AA55 55AAAA 55AAFF @@ -87,25 +87,25 @@ FFAA00 FFAA55 FFAAAA FFAAFF FFFF00 FFFF55 FFFFAA FFFFFF - 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 - 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 - 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 - 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 + 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 + 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 + 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 + 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 - 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 - 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 - 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 - 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 + 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 + 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 + 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 + 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 - 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 - 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 - 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 - 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 + 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 + 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 + 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 + 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 - 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 - 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 - 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 - 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 + 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 + 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 + 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 + 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 > ] setcolorspace /BPC 8 def % change to 4 bit indexed @@ -117,13 +117,13 @@ } ifelse << /ImageType 1 - /Width w - /Height h - /BitsPerComponent BPC - /ImageMatrix [1 0 0 -1 0 h] - /DataSource f - /MultipleDataSources false - bpc 4 lt { /Decode [ 0 [ 0 15 255 ] bpc get ] } { /Decode [ 0 1 0 1 0 1 ] } ifelse + /Width w + /Height h + /BitsPerComponent BPC + /ImageMatrix [1 0 0 -1 0 h] + /DataSource f + /MultipleDataSources false + bpc 4 lt { /Decode [ 0 [ 0 15 255 ] bpc get ] } { /Decode [ 0 1 0 1 0 1 ] } ifelse >> image showpage f closefile diff --git a/Master/tlpkg/tlgs/lib/wftopfa.ps b/Master/tlpkg/tlgs/lib/wftopfa.ps index 7d79afd525c..72227f723f7 100644 --- a/Master/tlpkg/tlgs/lib/wftopfa.ps +++ b/Master/tlpkg/tlgs/lib/wftopfa.ps @@ -1,19 +1,19 @@ % Copyright (C) 1995, 1996 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: wftopfa.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % wftopfa.ps % Convert a Wadalab base font to .PFA (or .PFB) format. @@ -47,13 +47,13 @@ wftopfa_dict begin { 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 + { token pop exch token pop exch pop + dup 0 get /highcode exch def + exch chars 3 1 roll put + } + { pop + } + ifelse } { pop } @@ -77,7 +77,7 @@ wftopfa_dict begin /FontInfo 20 dict def FontInfo begin - % Write the clear text part. + % Write the clear text part. /CreationDate (%Calendar%) currentdevparams dup /Weekday get {(Sun )(Mon )(Tue )(Wed )(Thu )(Fri )(Sat )} exch get @@ -269,7 +269,7 @@ ifelse /fontname exch def [ templates { wfdir (/) concatstrings exch concatstrings { copystring } - 8192 string filenameforall + 8192 string filenameforall } forall wfdir (/wadalab-sym/*.ps) concatstrings { copystring } diff --git a/Master/tlpkg/tlgs/lib/winmaps.ps b/Master/tlpkg/tlgs/lib/winmaps.ps index a42ba6a89f0..245c67ce7bf 100644 --- a/Master/tlpkg/tlgs/lib/winmaps.ps +++ b/Master/tlpkg/tlgs/lib/winmaps.ps @@ -1,19 +1,19 @@ % Copyright (C) 1993 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: winmaps.ps 6855 2006-06-14 21:03:34Z giles $ +% $Id$ % winmaps.ps - make maps between PostScript encodings and Windows % character sets. @@ -73,7 +73,7 @@ def /decodeStd StandardEncoding invertencoding def /decodeISO ISOLatin1Encoding - % Remove the redundant characters + % Remove the redundant characters dup length array copy [8#222 8#225 8#230 8#233 8#240] { 2 copy /.notdef put pop } forall invertencoding def diff --git a/Master/tlpkg/tlgs/lib/wrfont.ps b/Master/tlpkg/tlgs/lib/wrfont.ps index f2b331da8e1..63edf36d9a3 100644 --- a/Master/tlpkg/tlgs/lib/wrfont.ps +++ b/Master/tlpkg/tlgs/lib/wrfont.ps @@ -1,19 +1,19 @@ % Copyright (C) 1991, 1995, 1996, 2002 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: wrfont.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % 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 @@ -90,13 +90,13 @@ ifelse {end} wol } bind def /wld % Write a large dictionary more efficiently. - % Ignore the readonly attributes. + % 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 + 1 add dup 200 eq + { wo ({def} repeat) wl 0 } + if } forall dup 0 ne @@ -112,32 +112,32 @@ ifelse { 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 + 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 + { % 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 } @@ -150,10 +150,10 @@ ifelse 0 1 255 { (\221 ) dup 1 3 index put { token } stopped { - pop pop + pop pop } { - % Stack: char () token true - pop exch pop exch snit 3 1 roll put + % Stack: char () token true + pop exch pop exch snit 3 1 roll put } ifelse } for } { @@ -165,7 +165,7 @@ ifelse { psfile exch write==only } bind def - % Lookup table for ASCII output. + % Lookup table for ASCII output. /intbytes % int nbytes -> byte* { { dup 255 and exch -8 bitshift } repeat pop @@ -174,7 +174,7 @@ ifelse { /booleantype /integertype } { { ( ) ws woa } def } forall - % Iterate over arrays so we can print operators. + % Iterate over arrays so we can print operators. /arraytype { dup xcheck {(}) ({)} {(]) ([)} ifelse ws exch dup wol exch ws wop } bind def @@ -183,77 +183,77 @@ ifelse /nametype { dup xcheck { ( ) ws } if woa } bind def - % Map back operators to their names, - % so we can write procedures. + % 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. + % 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! + % == 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 + { 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 + 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. + % 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 + { 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 + 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 + ws wop } bind def end def @@ -274,12 +274,12 @@ ifelse { 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 + % 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 @@ -304,23 +304,23 @@ enc_dict { 1 index where { pop pop pop } { def } ifelse } forall { 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 + 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 @@ -389,7 +389,7 @@ currentdict end /unencrypted_procs exch def .knownEncodings length 256 mul dict begin 0 .knownEncodings { { currentdict 1 index known { pop } { 1 index def } ifelse - 1 add + 1 add } forall } @@ -433,12 +433,12 @@ currentdict end /inverseencodings exch 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 + { 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 } @@ -457,11 +457,11 @@ currentdict end /inverseencodings exch def } { 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 + ( {) 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 } @@ -490,14 +490,14 @@ currentdict end /inverseencodings exch def Font { minimize { .minfontskipkeys 2 index known - { pop pop - } - { //.compactfontdefault 2 index .knownget - { 1 index valueeq { pop pop } { we } ifelse } - { we } - ifelse - } - ifelse + { pop pop + } + { //.compactfontdefault 2 index .knownget + { 1 index valueeq { pop pop } { we } ifelse } + { we } + ifelse + } + ifelse } { .fontskipkeys 2 index known { pop pop } { we } ifelse } @@ -571,9 +571,9 @@ if { (/Subrs[) wl Subrs { dup null ne - { wcs minimize not { () wl } if } - { pop /null cvx wo } - ifelse + { wcs minimize not { () wl } if } + { pop /null cvx wo } + ifelse } forall {] dup {readonly pop} forall readonly def} wol () wl } @@ -599,20 +599,20 @@ if 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 + % 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 + { 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 } diff --git a/Master/tlpkg/tlgs/lib/zeroline.ps b/Master/tlpkg/tlgs/lib/zeroline.ps index 441d9a47f93..6aaee0ac081 100644 --- a/Master/tlpkg/tlgs/lib/zeroline.ps +++ b/Master/tlpkg/tlgs/lib/zeroline.ps @@ -1,20 +1,20 @@ %! % Copyright (C) 1994 Aladdin Enterprises. 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. -% +% % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. -% $Id: zeroline.ps 6300 2005-12-28 19:56:24Z giles $ +% $Id$ % zeroline.ps % Test file to determine how other PostScript implementations handle % filling zero-width lines under a variety of conditions. -- cgit v1.2.3