From 3605fab59cdc1afbbce026262462f94b95e65571 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 2 Jun 2007 23:04:09 +0000 Subject: use where operator for both setpagedevice and letter/a4 git-svn-id: svn://tug.org/texlive/trunk@4407 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/dvipsk/config.ps | 42 ++++++++++++++++++++++++++----------- Build/source/texk/dvipsk/dvips.texi | 13 ++++++------ Master/texmf/dvips/config/config.ps | 42 ++++++++++++++++++++++++++----------- 3 files changed, 67 insertions(+), 30 deletions(-) diff --git a/Build/source/texk/dvipsk/config.ps b/Build/source/texk/dvipsk/config.ps index 8e398dcb091..fa85a2934a1 100644 --- a/Build/source/texk/dvipsk/config.ps +++ b/Build/source/texk/dvipsk/config.ps @@ -44,42 +44,60 @@ Z0 % Partially download Type 1 fonts by default. Only reason not to do % this is if you encounter bugs. (Please report them to -% @email{tex-k@@mail.tug.org} if you do.) +% @email{tex-k@tug.org} if you do.) j % This shows how to add your own map file. % Remove the comment and adjust the name: % p +myfonts.map -% 0 0 595 842 is the right bounding box that most applications expect -% for A4. Since dvips always rounds up, choose something slightly smaller. +% If we have setpagedevice, use that. +% else if we have the a4 resp. letter operator, use that. +% else do nothing to set the page size. +% +% In the past, the a4size and letterSize definitions did not set the +% page size, but we want to set it if we can so that ps2pdf can work +% properly. Here, a4 and a4size, and letter and letterSize, are +% identical, and we prefer the a4/letter names -- texconfig uses them. + +% 0 0 595 842 is the right bounding box that applications expect +% for A4. Since dvips always rounds up, choose something slightly +% smaller for our paper size. @ a4 209.9mm 297.04mm @+ ! %%DocumentPaperSizes: a4 @+ %%BeginPaperSize: a4 -@+ << /PageSize [595 842] >> setpagedevice +@+ /setpagedevice where +@+ { pop << /PageSize [595 842] >> setpagedevice } +@+ { /a4 where { pop a4 } if } +@+ ifelse @+ %%EndPaperSize @ letter 8.5in 11in @+ ! %%DocumentPaperSizes: Letter @+ %%BeginPaperSize: Letter -@+ << /PageSize [612 792] >> setpagedevice +@+ /setpagedevice where +@+ { pop << /PageSize [612 792] >> setpagedevice } +@+ { /letter where { pop letter } if } +@+ ifelse @+ %%EndPaperSize -% these used to be the default paper sizes used, and they did not -% execute any page size operator, but now it seems there is no reason -% not to use setpagedevice. -% @ a4size 209.9mm 297.04mm -@+ %%BeginPaperSize: a4 @+ ! %%DocumentPaperSizes: a4 -@+ << /PageSize [595 842] >> setpagedevice +@+ %%BeginPaperSize: a4 +@+ /setpagedevice where +@+ { pop << /PageSize [595 842] >> setpagedevice } +@+ { /a4 where { pop a4 } if } +@+ ifelse @+ %%EndPaperSize @ letterSize 8.5in 11in @+ ! %%DocumentPaperSizes: Letter @+ %%BeginPaperSize: Letter -@+ << /PageSize [612 792] >> setpagedevice +@+ /setpagedevice where +@+ { pop << /PageSize [612 792] >> setpagedevice } +@+ { /letter where { pop letter } if } +@+ ifelse @+ %%EndPaperSize @ halfexecutive 133.35mm 184.15mm diff --git a/Build/source/texk/dvipsk/dvips.texi b/Build/source/texk/dvipsk/dvips.texi index c98741430a8..d5d92ee97c7 100644 --- a/Build/source/texk/dvipsk/dvips.texi +++ b/Build/source/texk/dvipsk/dvips.texi @@ -1726,7 +1726,7 @@ example: @end example If both @var{hsize} and @var{vsize} are zero (you must still specify -units!) then any page size will match. If the @samp{@@} character is +units!)@: then any page size will match. If the @samp{@@} character is immediately followed by a @samp{+} sign, then the remainder of the line (after skipping any leading blanks) is treated as PostScript code to send to the printer, presumably to select that particular paper size: @@ -1781,12 +1781,13 @@ directory may help in determining appropriate paper size definitions. @findex letter @r{paper size} @findex a4 @r{paper size} The default @code{letter} and @code{a4} paper size definitions in -@file{config.ps} execute the @code{setpagedevice} operator, which -always exists. Executing the @samp{letter} or @samp{a4} or other -PostScript operators cause the document to be nonconforming and thus -perhaps not to print on certain (unknown) printers, while not +@file{config.ps} execute the @code{setpagedevice} operator if it +exists (it was defined in PostScript Level 2), or the @samp{letter} or +@samp{a4} operator if they exist (they are nonstandard and thus +perhaps cause failures on certain (unknown) printers). Not executing any page size definition at all confuses PostScript -conversion programs such as @command{ps2pdf}. +conversion programs such as @command{ps2pdf}, so we want to execute +one if we can. @findex letterSize @r{paper size} @findex A4size @r{paper size} diff --git a/Master/texmf/dvips/config/config.ps b/Master/texmf/dvips/config/config.ps index 8e398dcb091..fa85a2934a1 100644 --- a/Master/texmf/dvips/config/config.ps +++ b/Master/texmf/dvips/config/config.ps @@ -44,42 +44,60 @@ Z0 % Partially download Type 1 fonts by default. Only reason not to do % this is if you encounter bugs. (Please report them to -% @email{tex-k@@mail.tug.org} if you do.) +% @email{tex-k@tug.org} if you do.) j % This shows how to add your own map file. % Remove the comment and adjust the name: % p +myfonts.map -% 0 0 595 842 is the right bounding box that most applications expect -% for A4. Since dvips always rounds up, choose something slightly smaller. +% If we have setpagedevice, use that. +% else if we have the a4 resp. letter operator, use that. +% else do nothing to set the page size. +% +% In the past, the a4size and letterSize definitions did not set the +% page size, but we want to set it if we can so that ps2pdf can work +% properly. Here, a4 and a4size, and letter and letterSize, are +% identical, and we prefer the a4/letter names -- texconfig uses them. + +% 0 0 595 842 is the right bounding box that applications expect +% for A4. Since dvips always rounds up, choose something slightly +% smaller for our paper size. @ a4 209.9mm 297.04mm @+ ! %%DocumentPaperSizes: a4 @+ %%BeginPaperSize: a4 -@+ << /PageSize [595 842] >> setpagedevice +@+ /setpagedevice where +@+ { pop << /PageSize [595 842] >> setpagedevice } +@+ { /a4 where { pop a4 } if } +@+ ifelse @+ %%EndPaperSize @ letter 8.5in 11in @+ ! %%DocumentPaperSizes: Letter @+ %%BeginPaperSize: Letter -@+ << /PageSize [612 792] >> setpagedevice +@+ /setpagedevice where +@+ { pop << /PageSize [612 792] >> setpagedevice } +@+ { /letter where { pop letter } if } +@+ ifelse @+ %%EndPaperSize -% these used to be the default paper sizes used, and they did not -% execute any page size operator, but now it seems there is no reason -% not to use setpagedevice. -% @ a4size 209.9mm 297.04mm -@+ %%BeginPaperSize: a4 @+ ! %%DocumentPaperSizes: a4 -@+ << /PageSize [595 842] >> setpagedevice +@+ %%BeginPaperSize: a4 +@+ /setpagedevice where +@+ { pop << /PageSize [595 842] >> setpagedevice } +@+ { /a4 where { pop a4 } if } +@+ ifelse @+ %%EndPaperSize @ letterSize 8.5in 11in @+ ! %%DocumentPaperSizes: Letter @+ %%BeginPaperSize: Letter -@+ << /PageSize [612 792] >> setpagedevice +@+ /setpagedevice where +@+ { pop << /PageSize [612 792] >> setpagedevice } +@+ { /letter where { pop letter } if } +@+ ifelse @+ %%EndPaperSize @ halfexecutive 133.35mm 184.15mm -- cgit v1.2.3