]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
Bug 422: fix faxq preparation of A3 and banner faxes
authorLee Howard <faxguy@howardsilvan.com>
Wed, 11 Feb 2004 16:37:59 +0000 (16:37 +0000)
committerLee Howard <faxguy@howardsilvan.com>
Wed, 11 Feb 2004 16:37:59 +0000 (16:37 +0000)
         extend B4 and A3 page-size resolution support
         improve faxinfo page-size recognition

faxd/FaxModem.c++
util/Class2Params.c++
util/faxinfo.c++
util/pdf2fax.gs.sh.in
util/ps2fax.gs.sh.in

index aca25381c2b3f8837c07f1a1c047585b3010167f..5b31afe4a6e9e3c79c1c9edf4f659e0b050e0ed9 100644 (file)
@@ -492,6 +492,10 @@ FaxModem::supportsPageWidth(u_int w, u_int r) const
        case VR_300X300:
            switch (w) {
                case 2592:   return (modemParams.wd & BIT(WD_1728)) != 0;
+               case 3072:   return (modemParams.wd & BIT(WD_2048)) != 0;
+               case 3648:   return (modemParams.wd & BIT(WD_2432)) != 0;
+               case 1824:   return (modemParams.wd & BIT(WD_1216)) != 0;
+               case 1296:   return (modemParams.wd & BIT(WD_864)) != 0;
            }
        case VR_NORMAL:
        case VR_FINE:
index 0b537b4a99d4439a9292cd18cc44ba2448f3401e..afd3f1d6a8c0a8a08d41be71f8350e39ff09301a 100644 (file)
@@ -400,6 +400,10 @@ Class2Params::pageWidth() const
     switch (vr) {
        case VR_300X300: 
            widths[0] = 2592;
+           widths[1] = 3072;
+           widths[2] = 3648;
+           widths[3] = 1824;
+           widths[4] = 1296;
            break;  
        case VR_R16:
            widths[0] = 3456;
@@ -423,8 +427,20 @@ Class2Params::pageWidth() const
 void
 Class2Params::setPageWidthInMM(u_int w)
 {
-    // This function is unused and doesn't support VR_300X300 and VR_R16.
-    wd = (w == 255 ? WD_2048 : w == 303 ? WD_2432 : WD_1728);
+    /*
+     * We get the width in MM from the q file.  Basically,
+     * faxing only deals with three page widths defined by
+     * pixel-widths: 1728, 2048, and 2432 (in R8 resolution).
+     * The associated page size names are A4, B4, and A3.  
+     * However, the calculated size in millimeters differs
+     * between pixel-widths and page size.
+     * 1728 pixels = 215 mm : A4 = 209.903 mm
+     * 2048 pixels = 255 mm : B4 = 250.119 mm
+     * 2432 pixels = 303 mm : A3 = 297.039 mm
+     * The client program may therefore use a range of
+     * pagewidth (mm) values.  We must interpret wisely.
+     */
+    wd = (w > 270 ? WD_2432 : w > 230 ? WD_2048 : WD_1728);
 }
 
 void
@@ -447,6 +463,10 @@ Class2Params::setPageWidthInPixels(u_int w)
        //w == 2432 ? WD_1216 :         // collision
        //w == 1728 ? WD_864 :          // collision
          w == 2592 ? WD_1728 :
+         w == 3072 ? WD_2048 :
+         w == 3648 ? WD_2432 :
+         w == 1824 ? WD_1216 :
+         w == 1296 ? WD_864 :
                      WD_1728);
 }
 
@@ -468,7 +488,8 @@ Class2Params::setPageLengthInMM(u_int l)
     ln = (l == (u_int) -1 ?  LN_INF :
          l <= 280 ?         LN_LET :
          l <= 300 ?         LN_A4 :
-                            LN_B4);
+         l <= 380 ?         LN_B4 :
+                            LN_INF);
 }
 
 u_int
index 00f19df693dd861e87741769cf15c7e387626f88..f84b5778eb0df4a31681d3941ff508163f522f39 100644 (file)
@@ -173,8 +173,8 @@ main(int argc, char** argv)
        params.vr == VR_FINE ? 7.7 :
        params.vr == VR_200X200 ? 7.87 : 
        params.vr == VR_R8 ? 15.4 : 
-       params.vr == VR_200X400 ? 12.81 : 
-       params.vr == VR_300X300 ? 9.14 : 15.4);
+       params.vr == VR_200X400 ? 15.75 : 
+       params.vr == VR_300X300 ? 11.81 : 15.4);
     TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &v);
     float w = v / (params.vr == VR_NORMAL ? 8.0 : 
        params.vr == VR_200X100 ? 8.00 : 
index 7106c284ae59a336d3016b35d95d1c4bd071f8e3..31b9a1a31e7c7d18a2dfe6efb705ac0eb644fcd8 100644 (file)
@@ -98,6 +98,8 @@ case "${pagewidth}x${pagelength}" in
     paper=a4;;
 *x364)
     paper=b4;;
+2432x*|3648x*|4864x*)
+    paper=a3;;
 *)
     echo "$0: Unsupported page size: $pagewidth x $pagelength";
     exit 254;;                 # causes document to be rejected
@@ -109,18 +111,25 @@ esac
 case "$paper" in
     a4)
        case "$pagewidth" in
-           2592) hres=313.65;;         # VR_R300X300
+           2592) hres=313.65;;         # VR_300X300
            3456) hres=418.20;;         # VR_R16
            *) hres=209.10;;            # everything else, 1728 pixels
        esac;;
-    b4)                                        # no 300x300 available with B4
+    b4)
        case "$pagewidth" in
+           3072) hres=311.97;;         # VR_300X300
            4096) hres=415.95;;         # VR_R16
            *) hres=207.98;;            # everything else, 2048 pixels
        esac;;
+    a3)
+       case "$pagewidth" in
+           3648) hres=311.94;;         # VR_300X300
+           4864) hres=415.93;;         # VR_R16
+           *) hres=207.96;;            # everything else, 2432 pixels
+       esac;;
     *)                                 # letter, legal
        case "$pagewidth" in
-           2592) hres=304.94;;         # VR_R300X300
+           2592) hres=304.94;;         # VR_300X300
            3456) hres=406.59;;         # VR_R16
            *) hres=203.29;;            # everything else, 1728 pixels
        esac;;
index eb138e67fff6b73c3c426be8ae70ba25c8dcc896..109f0a2818bd21bd52aafea1d1c524497371e0e1 100644 (file)
@@ -98,6 +98,8 @@ case "${pagewidth}x${pagelength}" in
     paper=a4;;
 *x364)
     paper=b4;;
+2432x*|3648x*|4864x*)
+    paper=a3;;
 *)
     echo "$0: Unsupported page size: $pagewidth x $pagelength";
     exit 254;;                 # causes document to be rejected
@@ -109,18 +111,25 @@ esac
 case "$paper" in
     a4)
        case "$pagewidth" in
-           2592) hres=313.65;;         # VR_R300X300
+           2592) hres=313.65;;         # VR_300X300
            3456) hres=418.20;;         # VR_R16
            *) hres=209.10;;            # everything else, 1728 pixels
        esac;;
-    b4)                                        # no 300x300 available with B4
+    b4)
        case "$pagewidth" in
+           3072) hres=311.97;;         # VR_300X300
            4096) hres=415.95;;         # VR_R16
            *) hres=207.98;;            # everything else, 2048 pixels
        esac;;
+    a3)
+       case "$pagewidth" in
+           3648) hres=311.94;;         # VR_300X300
+           4864) hres=415.93;;         # VR_R16
+           *) hres=207.96;;            # everything else, 2432 pixels
+       esac;;
     *)                                 # letter, legal
        case "$pagewidth" in
-           2592) hres=304.94;;         # VR_R300X300
+           2592) hres=304.94;;         # VR_300X300
            3456) hres=406.59;;         # VR_R16
            *) hres=203.29;;            # everything else, 1728 pixels
        esac;;