groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Groff] scaling in pic


From: Ted Harding
Subject: RE: [Groff] scaling in pic
Date: Tue, 04 Sep 2001 01:57:05 +0100 (BST)

On 03-Sep-01 Peter Gerbrandt wrote:
> I still have my problems with scaling in pic. 
> I made some examples to show the problem. The page is as big as DIN A4
> paper. Both examples show five linked boxes, the second one has almost
> the half of the width, but the only effect is, that the heigth grows. 
> 
> .PS 10 8.26
> [Figure with "internal" height 32.5, width 123]
> .PE
> 
> .PS 10 8.26
[Figure with "internal" height 32.5, width 63]
> .PE

>From "man pic":

       The .PS line can have a second argument specifying a maxi-
       mum height for the picture.  If the width of zero is spec-
       ified  the  width will be ignored in computing the scaling
       factor for the picture.  Note that  GNU  pic  will  always
       scale  a picture by the same amount vertically as horizon-
       tally.  This is different from the DWB 2.0 pic  which  may
       scale a picture by a different amount vertically than hor-
       izontally if a height is specified.

This is the key to your problem (if I understand it right).
It means, in essence, that the shape of the Figure is preserved
under scaling. The scaling will be such that the Figure will be
made as large as possible, provided (in your example) that the
width _does_not_exceed_ 10, and the height _does_not_exceed_ 8.26.
(i.e. one of the two constraints is attained).

For your example, the result is that the first comes out 10 inches
wide and approx 10*32.5/123 = 2.64... inches high (since
2.64... < 8.26), while the second comes out 10 inches wide and
10*32.5/63 = 5.15... inches high (since, again, 5.15 < 8.2).
If you had specified ".PS 10 4" for the second, then you would
have had a figure 4 inches high, but 4*63/32.5 = 7.75... inches
wide (since it is now the height constraint which is attained).
Note that in each case the height/width ration is 32.6/63.

Since I'm not sure what you want to do, I can't advise you precisely
how to do it. But, as noted above, the _shape_ of the Figure
defined by the 'pic' code is preserved whatever you do.

If you want to impose different horizontal and vertical scalings
in GNU pic, you have to do it inside the 'pic' code (where
it then changes the "internal" shape). For example,

.PS 10 8.26
s_x = 1.0 ; s_y = 2.0
box ht 7*s_y wid 60*s_x
box ht 0.5*s_y wid 3*s_x with .nw at last box.se
box ht 7*s_y wid 60*s_x with .sw at last box.ne
box ht 25*s_y wid 60*s_x with .ne at 2nd box.sw
box ht 20*s_y wid 60*s_x with .nw at 2nd box.se
.PE

I hope this helps,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 167 1972
Date: 04-Sep-01                                       Time: 01:57:05
------------------------------ XFMail ------------------------------

reply via email to

[Prev in Thread] Current Thread [Next in Thread]