summaryrefslogtreecommitdiff
path: root/gs/Resource/Init/gs_init.ps
diff options
context:
space:
mode:
authorRussell Lang <gsview@ghostgum.com.au>2009-01-08 09:17:18 +0000
committerRussell Lang <gsview@ghostgum.com.au>2009-01-08 09:17:18 +0000
commitcd4914d8f7b3911301ae9db62cee233275c5010a (patch)
tree26f23c0f613a6cefdd59d2dfd4500e9dd900d2d4 /gs/Resource/Init/gs_init.ps
parentc9d32ad521db92aa177f677bbae9115d838bd09b (diff)
downloadghostpdl-cd4914d8f7b3911301ae9db62cee233275c5010a.tar.gz
Automatically select the default paper size from the locale
on the Windows platform, and make provision for doing this on Linux. DETAILS: This adds a new platform function gp_defaultpapersize and a new operator .defaultpapersize. In order of priority, the paper size is set from PAPERSIZE, DEFAULTPAPERSIZE, .defaultpapersize, or the compiled in device paper size. It has been tested on Windows 98, XP and Vista. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@9334 a1074d23-0009-0410-80fe-cf8c14f379e6
Diffstat (limited to 'gs/Resource/Init/gs_init.ps')
-rw-r--r--gs/Resource/Init/gs_init.ps23
1 files changed, 22 insertions, 1 deletions
diff --git a/gs/Resource/Init/gs_init.ps b/gs/Resource/Init/gs_init.ps
index cea25cc81..0833f76c9 100644
--- a/gs/Resource/Init/gs_init.ps
+++ b/gs/Resource/Init/gs_init.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 1989-2004 Artifex Software, Inc. All rights reserved.
+% Copyright (C) 1989-2009 Artifex Software, Inc. All rights reserved.
%
% This software is provided AS-IS with no warranty, either express or
% implied.
@@ -1752,6 +1752,27 @@ defaultdevice
% If the paper size is not specifed and the device defaults to
% letter or A4 paper, select the DEFAULTPAPERSIZE.
+systemdict /DEFAULTPAPERSIZE known not
+ {
+ % Use .defaultpapersize if it returns a known paper size
+ .defaultpapersize
+ {
+ false statusdict /.pagetypenames get
+ {
+ 2 index eq { pop true exit } if
+ }
+ forall
+ {systemdict exch /DEFAULTPAPERSIZE exch put}
+ {QUIET
+ { pop }
+ { (Unknown .defaultpapersize: ) print ==only (.) = }
+ ifelse
+ }
+ ifelse
+ }
+ if
+ }
+if
systemdict /DEFAULTPAPERSIZE known
systemdict /PAPERSIZE known not and
systemdict /DEVICEWIDTH known not and