From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.0.7-1.1.fc4 Firefox/1.0.7
Description of problem:
The '-M' option of mpage allows for changing the paper magins, and scales the input PostScript to fill the new margins. This calculation is done incorrectly, as acknowledged in the mpage(1) manpage:
"Very large values have funny effects.
This is left as an exercise to the user."
Well, this user found the error: it lies in post.c lines 730-731 and 867-868. These lines compute the scaling factor as (WIDTH-MARGIN)/WIDTH, which incorrect since the margins are given in logical units (i.e., units of the input page rather than the output page), as explained in the manpage. Moreover, the left and bottom margins are handled by translation in logical units, so the current code is inconsistent any way you look at it.
Attached is a patch which fixes this, by calculating the ratio as WIDTH/(WIDTH+MARGIN).
As a sanity check, consider the case WIDTH=MARGIN, which should shrink by a factor of 2 (and does with my formula), but with the current code shrinks to the content to zero size.
Compatibility-wise this sould be OK, since the old and new code give similar results for small margins, and for large margins the old code was broken and inconsistent anyway (as warned in the manpage). But I suggest changing the version number (add a suffix?), in case some applications (like mike) need to check for a good version.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
$ mpage -1 -M500r /usr/share/doc/bash-3.0/bash.ps > out.ps && evince out.ps
and observe that the content is shrunk too much (as if the right margin is given in physical units instead of logical unit)
$ mpage -1 -M500l /usr/share/doc/bash-3.0/bash.ps > out.ps && evince out.ps
and observe that the left margin is determined correctly in logical units, but again the content is shrunk too much.
page -1 -M300l300r /usr/share/doc/bash-3.0/bash.ps > out.ps && evince out.ps
and observe that the result is nonsensical.
Created attachment 121266 [details]
Patch to fix the reported problem