summaryrefslogtreecommitdiff
path: root/psi
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2023-04-05 09:58:23 +0100
committerKen Sharp <ken.sharp@artifex.com>2023-04-05 15:45:43 +0100
commitd7ea2428d9db699b8b3e277f629555b3428c6987 (patch)
treed629b16ebf88c2cda4102c44517b19e97fec5ad0 /psi
parente85dc479135f50b4ab70905007ae509e0d92d61d (diff)
downloadghostpdl-d7ea2428d9db699b8b3e277f629555b3428c6987.tar.gz
Ghostscript - convert the system default paper size to lower case
Bug 706544 "Unknown .defaultpapersize: (Letter). error shown at startup" The problem appears to be that the system libpaper is configured to have a default paper size of 'Letter' rather than the all lower case 'letter', so Ghostscript doesn't have a matching media size. libpaper says that lower case is 'preferred' but there's apparently no reason why we couldn't also have (for example) A4 instead of a4. We can tackle this by making the system defined paper size lower case before returning it to Ghostscript. However, a few of the paper sizes in statusdict do have upper case characters in their name, so we need to duplicate those few sizes as lower case. The contents of statusdict, and in particular the defined media sizes, are not specified so we're OK to do this.
Diffstat (limited to 'psi')
-rw-r--r--psi/zmisc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/psi/zmisc.c b/psi/zmisc.c
index 75c36459b..bb514b972 100644
--- a/psi/zmisc.c
+++ b/psi/zmisc.c
@@ -255,7 +255,7 @@ zdefaultpapersize(i_ctx_t *i_ctx_p)
{
os_ptr op = osp;
byte *value;
- int len = 0;
+ int len = 0, i;
if (gp_defaultpapersize((char *)0, &len) > 0) {
/* no default paper size */
@@ -269,6 +269,10 @@ zdefaultpapersize(i_ctx_t *i_ctx_p)
return_error(gs_error_VMerror);
}
DISCARD(gp_defaultpapersize((char *)value, &len)); /* can't fail */
+ /* Note 'len' includes the NULL terminator, which we can ignore */
+ for (i = 0;i < (len - 1); i++)
+ value[i] = tolower(value[i]);
+
/* Delete the stupid C string terminator. */
value = iresize_string(value, len, len - 1,
"defaultpapersize value"); /* can't fail */