bug-groff
[Top][All Lists]
Advanced

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

pic: rescaling diagnostic


From: Jennifer Sayers
Subject: pic: rescaling diagnostic
Date: Thu, 31 Aug 2006 14:09:31 +1000
User-agent: Mutt/1.3.25i

Dear Groff Maintainer,

I would like to suggest an improvement to GNU pic.

DWB pic gives a diagnostic message on stderr when a picture is
scaled down because it wouldn't fit on the page.

It would be useful if GNU pic did this too.  GNU pic correctly
rescales the picture but does it silently.  This makes it hard to
draw pictures to scale, as your scale changes silently if you accidentally
hit the side of the paper.  Without the diagnostic, you don't know if
you have done this.

******************************************************************************
DEMONSTRATION:
******************************************************************************
$ cat toobig.pic
.PS
box width 10
.PE
/opt/dwb/bin/pic toobig.pic > junk
pic: 10 X 0.5 picture shrunk to 8.5 X 0.425
$ /opt/gnu/bin/gpic toobig.pic > junk
$

******************************************************************************
WHERE TO PATCH:
******************************************************************************

I have looked at the GNU pic source for "GNU pic (groff) version 1.19.3".
I think the patch needs to go in the file

        groff-current/src/preproc/pic/object.cpp

The values of maxpswid and maxpsht are used in only one place:

    lookup_variable("maxpswid", &max_width);
    double max_height = 0.0;
    lookup_variable("maxpsht", &max_height);
    if ((max_width > 0.0 && sdim.x > max_width)
    || (max_height > 0.0 && sdim.y > max_height)) {
      double xscale = dim.x/max_width;
      double yscale = dim.y/max_height;
      return xscale > yscale ? xscale : yscale;
    }

so I'm pretty sure the diagnostic would need to go in the body of
the "if" statement.

I don't really know C++, so I have not suggested actual code to print
the message to stderr, sorry, but I expect it is trivial.

jen.




reply via email to

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