diff options
Diffstat (limited to 'Master/tlpkg/tlgs/lib')
-rw-r--r-- | Master/tlpkg/tlgs/lib/PDFA_def.ps | 21 | ||||
-rw-r--r-- | Master/tlpkg/tlgs/lib/opdfread.ps | 48 | ||||
-rw-r--r-- | Master/tlpkg/tlgs/lib/ps2epsi.ps | 4 | ||||
-rw-r--r-- | Master/tlpkg/tlgs/lib/viewraw.ps | 77 |
4 files changed, 129 insertions, 21 deletions
diff --git a/Master/tlpkg/tlgs/lib/PDFA_def.ps b/Master/tlpkg/tlgs/lib/PDFA_def.ps index 3923d5fb21a..f0ff0d1b6f9 100644 --- a/Master/tlpkg/tlgs/lib/PDFA_def.ps +++ b/Master/tlpkg/tlgs/lib/PDFA_def.ps @@ -1,22 +1,31 @@ %! % 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. % Define entries in the document Info dictionary : - -/ICCProfile (ISO Coated sb.icc) % Customize. +/ICCProfile (srgb.icc) % Customise def -[ /Title (Title) % Customize. +[ /Title (Title) % Customise /DOCINFO pdfmark % Define an ICC profile : [/_objdef {icc_PDFA} /type /stream /OBJ pdfmark -[{icc_PDFA} <</N systemdict /ProcessColorModel get /DeviceGray eq {1} {4} ifelse >> /PUT pdfmark +[{icc_PDFA} +<< + /N currentpagedevice /ProcessColorModel known { + currentpagedevice /ProcessColorModel get dup /DeviceGray eq + {pop 1} { + /DeviceRGB eq + {3}{4} ifelse + } ifelse + } { + (ERROR, unable to determine ProcessColorModel) == flush + } ifelse +>> /PUT pdfmark [{icc_PDFA} ICCProfile (r) file /PUT pdfmark % Define the output intent dictionary : @@ -26,6 +35,6 @@ def /Type /OutputIntent % Must be so (the standard requires). /S /GTS_PDFA1 % Must be so (the standard requires). /DestOutputProfile {icc_PDFA} % Must be so (see above). - /OutputConditionIdentifier (CGATS TR001) % Customize + /OutputConditionIdentifier (sRGB) % Customize >> /PUT pdfmark [{Catalog} <</OutputIntents [ {OutputIntent_PDFA} ]>> /PUT pdfmark diff --git a/Master/tlpkg/tlgs/lib/opdfread.ps b/Master/tlpkg/tlgs/lib/opdfread.ps index ebb7caaaaca..62da258f098 100644 --- a/Master/tlpkg/tlgs/lib/opdfread.ps +++ b/Master/tlpkg/tlgs/lib/opdfread.ps @@ -156,9 +156,14 @@ end % A dictionary for local binding /HexDigits (0123456789ABCDEF) readonly def +%% This routine assumes that a PostScript int is only 32 bits +%% we partially address that by and'ing 15 with the 4 bits of +%% data in order to ensure that we don't index off the end of +%% the string above. However, if the integer is genuinely +%% more than 32 bits we still only print the first 32. /PrintHex % <int> PrintHex - { 8 { - dup -28 bitshift //HexDigits exch 1 getinterval //=only exec + dup -28 bitshift 15 and //HexDigits exch 1 getinterval //=only exec 4 bitshift } repeat pop @@ -742,7 +747,7 @@ currentdict end readonly def copypage } repeat } if - showpage + EPS2Write not {showpage} if } if } bind def @@ -896,13 +901,27 @@ currentdict end readonly def 0 0 % dummy page size values if not known }ifelse % bw bh px0 py0 bw bh bool bw bh Width Height - round cvi 2 index round cvi % bw bh px0 py0 bw bh bool bw bh Width bool + round cvi 2 index round cvi eq % bw bh px0 py0 bw bh bool bw bh Width bool exch round cvi 3 index round cvi eq and % bw bh px0 py0 bw bh bool bw bh bool { % Page Size unchanged, do not emit setpagedevice pop pop % bw bh px0 py0 bw bh bool } { - 2 array astore % bw bh px0 py0 bw bh bool [] - << exch /PageSize exch >> setpagedevice % bw bh px0 py0 bw bh bool + /MediaRequested where { + % bw bh px0 py0 bw bh + /MediaRequested get aload pop % bw bh px0 py0 bw bh Width Height + round cvi 2 index round cvi eq % bw bh px0 py0 bw bh bool bw bh Width bool + exch round cvi 3 index round cvi eq and % bw bh px0 py0 bw bh bool bw bh bool + {pop pop false} % We already requested this media size, so don't re-request + {true} ifelse % Media request different to last request + } { + true % No stored media request, so apply setpagedevice + } ifelse + { + 2 array astore % bw bh px0 py0 bw bh bool [] + dup /MediaRequested exch def + << exch /PageSize exch >> setpagedevice % bw bh px0 py0 bw bh bool + /pagesave save def + } if } ifelse userdict /PDFR_InitialGS gstate put setglobal % bw bh px0 py0 bw bh @@ -971,7 +990,7 @@ currentdict end readonly def 1 index exch /Context exch put % id obj dup /ImmediateExec true put dup /IsPage true put - dup /Context get //SetupPageView exec + SetPageSize {dup /Context get //SetupPageView exec} if } bind def /FontFileDaemon % <id> <obj> <font_descriptor> FontFileDaemon <id> <obj> @@ -1447,11 +1466,14 @@ end /StringOffset StringOffset 4 add % () def } { - dup % () loca - StringOffset getu16 % () - LocaArray LocaIndex 3 -1 roll put % () + StringOffset getu16 2 mul % () loca + LocaArray length LocaIndex gt { % take account of apdding in the string + LocaArray LocaIndex 3 -1 roll put % () + }{ % + pop % ignore indices off the end of the array + }ifelse % /LocaIndex LocaIndex 1 add def % () - /StringOffset StringOffset 4 add % () + /StringOffset StringOffset 2 add % () def } ifelse }{ % () @@ -4624,9 +4646,9 @@ currentdict end readonly def /d0 /setcharwidth load def /d1 /setcachedevice load def - /BDC { BeginMarkedContentSequenceWithPropertyList } bind def - /BMC { BeginMarkedContentSequence } bind def - /EMC { EndMarkedContentSequence } bind def + /BDC { pop pop } bind def + /BMC { pop } bind def + /EMC { } bind def /BX { BeginCompatibilitySection } bind def /EX { EndCompatibilitySection } bind def /DP { DefineMarkedContentPointWithPropertyList } bind def diff --git a/Master/tlpkg/tlgs/lib/ps2epsi.ps b/Master/tlpkg/tlgs/lib/ps2epsi.ps index cc308ae484d..35c203a85c6 100644 --- a/Master/tlpkg/tlgs/lib/ps2epsi.ps +++ b/Master/tlpkg/tlgs/lib/ps2epsi.ps @@ -190,8 +190,8 @@ ps2edict begin epsifile (\n) writestring epsifile flushfile - epsifile BBoxString writestring epsifile (\r) writestring - epsifile HiresBBoxString writestring epsifile (\r) writestring + epsifile BBoxString writestring epsifile (\n) writestring + epsifile HiresBBoxString writestring epsifile (\n) writestring % Define character and bit widths for the output line buffer: /cwidth rm lm sub 1 add def diff --git a/Master/tlpkg/tlgs/lib/viewraw.ps b/Master/tlpkg/tlgs/lib/viewraw.ps new file mode 100644 index 00000000000..c456afe5d1c --- /dev/null +++ b/Master/tlpkg/tlgs/lib/viewraw.ps @@ -0,0 +1,77 @@ +% Copyright (C) 2001-2012 Artifex Software, Inc. +% All Rights Reserved. +% +% This software is provided AS-IS with no warranty, either express or +% implied. +% +% This software is distributed under license and may not be copied, +% modified or distributed except as expressly authorized under the terms +% of the license contained in the file LICENSE in this distribution. +% +% Refer to licensing information at http://www.artifex.com or contact +% Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael, +% CA 94903, U.S.A., +1(415)492-9861, for further information. +% + +% viewcmyk.ps +% Display a raw CMYK file. +% Requires the colorimage operator. +% 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,4,8,12); +% if BITS is undefined, its default value is 1. +% Colorspace defaults to cmyk, but -dGray or -dRGB can change it + +/viewraw { % <filename> <ncomp> <width> viewraw - + 20 dict begin + % Default ncomp is 4 == CMYK + /w exch def + /fname exch def + /ncomp + /Gray where + { pop 1 } % DeviceGray is 1 component + { /RGB where { pop 3 } { 4 } ifelse % DeviceRGB is 3 component, DeviceCMYK is 4 component + } ifelse + def + /bpc /BITS where { pop BITS } { 1 } ifelse def + /f fname (r) file def + mark fname status pop pop pop /flen exch def cleartomark + /h flen w bpc ncomp mul mul 7 add 8 idiv idiv def + %% (Dimensions: ) print [w h] == flush + % Set up scaling. + /SCALE where { + pop + % 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. + clippath pathbbox pop pop translate + pathbbox 3 -1 roll sub h div + 3 1 roll exch sub w div .min dup + } ifelse scale + %% w h bpc [1 0 0 -1 0 h] f false ncomp colorimage + << /ImageType 1 /Width w /Height h /ImageMatrix [1 0 0 -1 0 h] + /MultipleDataSources false /DataSource f /BitsPerComponent BITS + /Decode BITS 1 gt % inverted sense for 1 bit per component + { [ [ 0 1 ] [0] [ 0 1 0 1 0 1 ] [ 0 1 0 1 0 1 0 1 ] ] ncomp 1 sub get } + { [ [ 1 0 ] [0] [ 1 0 1 0 1 0 ] [ 1 0 1 0 1 0 1 0 ] ] ncomp 1 sub get } + ifelse + >> image + showpage + f closefile + end +} bind def + +% If the program was invoked from the command line, run it now. +[ shellarguments { + counttomark 2 eq { + cvi viewraw + } { + cleartomark + (Usage: gs -- viewraw filename.raw width\n) print + ( e.g.: gs -- viewraw my.raw 2550\n) print flush + } ifelse +} { + pop +} ifelse |