summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2022-01-20 15:13:23 +0000
committerKen Sharp <ken.sharp@artifex.com>2022-01-20 15:13:23 +0000
commitd26413100329c7018b71442ec988e40915d7dc8c (patch)
tree90494dd1f72b043feb79e3f34bc2b2c62345865a /lib
parent0294d0c6937fc6fcc6eeed86fcba4679ffeea5fc (diff)
downloadghostpdl-d26413100329c7018b71442ec988e40915d7dc8c.tar.gz
Fix gslp.ps with -p option
Commit 8d8e90560bf6bbf0415b28445e7d49c005454f77 added a new option 'encoding' which is intended to specify the font encoding to be used instead of always using ISOLatin1. However, the commit broke the output PostScript produced by use of the -p option, and didn't re-encode the default fonts when -p was used, which meant the re-encoding didn't work with the default fonts, only if a specific font was used (-f command line option). This fixes both problems, it's not as neat as the original code, but the previous commit means that ship has already sailed.
Diffstat (limited to 'lib')
-rw-r--r--lib/gslp.ps20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/gslp.ps b/lib/gslp.ps
index 9a3a2f3e6..b2cb80df4 100644
--- a/lib/gslp.ps
+++ b/lib/gslp.ps
@@ -411,6 +411,15 @@ lpdict begin
/prevHFont null def
/lpfirst { % - lpfirst -
+ % If writing to file we need to emit the definition of 'encoding' or it will
+ % produce non-working PostScript. If we are executing directly then encoding is
+ % already defined. This defines encoding as an array instead of a name, but it will work OK
+ % and avoids changing the /RE procedure.
+ OutFile null eq not {
+ OutFile (/encoding /) writestring
+ OutFile encoding 256 string cvs writestring
+ OutFile ( /Encoding findresource def\n) writestring
+ } if
% Define some abbreviating procedures.
/B {save 3 1 roll translate /X 0 def} lpdef
/BL {save 3 1 roll 90 rotate translate /X 0 def} lpdef
@@ -610,7 +619,16 @@ lpdict begin
/--duplex { /Duplex {Landscape} def } def
/--duplex-long-edge { /Duplex false def } def
/--duplex-short-edge { /Duplex true def } def
-/--encoding { cvn /encoding exch def } def
+/--encoding {
+ cvn /encoding exch def
+ %% If we changed the encoding, then we need to remake the default fonts with the correct encoding
+ /defaultBodyFontPortrait
+ /Courier find-latin-font 10 scalefont def
+ /defaultBodyFontLandscape
+ /Courier find-latin-font 7 scalefont def
+ /defaultBodyFont
+ { Landscape { defaultBodyFontLandscape } { defaultBodyFontPortrait } ifelse } def
+} def
/--first-page { cvi /PageFirst exch def } def
/--footing-center { /FootingCenter exch def /Footers true def } def
/--footing-left { /FootingLeft exch def /Footers true def } def