groff
[Top][All Lists]
Advanced

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

Re: [Groff] Possible bug?


From: Egil Kvaleberg
Subject: Re: [Groff] Possible bug?
Date: 13 Mar 2003 12:12:42 +0100

On Thu, 2003-03-13 at 11:19, Ralph Corderoy wrote:

> Sounds like the `paperlength' value in
> /usr/share/groff/1.17.2/font/devps/DESC or similiar has changed in the
> upgrade.  Common values are 841890 and 792000.

Here is the fix that omits putting paper size information in the
postscript if the paper size is highly unlikely (i.e. zero):

Egil

---------------------------------------------------------------
--- NEWS.orig   2003-03-13 11:09:09.000000000 +0000
+++ NEWS        2003-03-13 11:08:45.000000000 +0000
@@ -1,6 +1,15 @@
 This file describes recent user-visible changes in groff.  Bug fixes are not
 described.  There are more details in the man and info pages.
 
+Grops
+-----
+
+o If the area of the paper is defined as zero, no paper size declaration will
+  be given, and the following warning messages will appear as appropriate:
+       "paper height is zero"
+       "paper width is zero"
+
+
 VERSION 1.18.2
 ==============
 
--- src/devices/grops/ps.cc.orig        2003-03-13 11:09:13.000000000 +0000
+++ src/devices/grops/ps.cc     2003-03-13 11:04:48.000000000 +0000
@@ -1302,9 +1302,18 @@
        .comment_arg("*PageSize")
        .comment_arg(media_name())
        .end_comment();
+
+    int w = media_width();
+    int h = media_height();
+    if (w > 0 && h > 0) {
+       /* 
+        *  only tell postscript about size if area is non-zero
+        *  warning to user done elsewhere
+       */
     fprintf(out.get_file(),
            "<< /PageSize [ %d %d ] /ImagingBBox null >> setpagedevice\n",
            media_width(), media_height());
+    }
     out.simple_comment("EndFeature");
   }
 }
@@ -1396,15 +1405,22 @@
      .end_comment();
 
   if (!(broken_flags & NO_PAPERSIZE)) {
+      int w = media_width();
+      int h = media_height();
+      if (w > 0 && h > 0) {
       fprintf(out.get_file(),
              "%%%%DocumentMedia: %s %d %d %d %s %s\n",
              media_name(),                     // tag name of media
-             media_width(),                    // media width
-             media_height(),                   // media height
+             w,                                // media width
+             h,                                // media height
              0,                                // weight in g/m2
              "()",                             // paper color, e.g. white
              "()"                              // preprinted form type
       );
+      } else {
+         if (h <= 0) warning("paper height is zero");
+         if (w <= 0) warning("paper width is zero");
+      }
   }
 
   out.begin_comment("Orientation:")


---------------------------------------------------------------

Attachment: patch
Description: Text document


reply via email to

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