summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlgs/lib/opdfread.ps
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlgs/lib/opdfread.ps')
-rw-r--r--Master/tlpkg/tlgs/lib/opdfread.ps48
1 files changed, 35 insertions, 13 deletions
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