]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix number-up=2 and classification/page label orientation.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 23 Jan 2002 22:30:42 +0000 (22:30 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 23 Jan 2002 22:30:42 +0000 (22:30 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@2062 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES.txt
conf/mime.convs
filter/Makefile
filter/common.c
filter/common.h
filter/imagetops.c
filter/pstops.c

index f2e83eeb22de10a57eb5f609e6cc9cb3b8c61020..71ff0c93ef7508c84647d3f609d8aaefdac15053 100644 (file)
@@ -3,6 +3,8 @@ CHANGES.txt - 01/23/2002
 
 CHANGES IN CUPS V1.1.13
 
+       - Classification and page labels were not rotated to
+         match the page orientation.
        - Now set the TCP "no delay" option on network
          connections to improve performance/response time.
        - Improved the IRIX printing tools support with patches
index f675e0c99f8be92b6888b91baff87db2056bf23f..7b86bf84d0fbd8055b87ca4d4a88b90f3250264b 100644 (file)
@@ -1,5 +1,5 @@
 #
-# "$Id: mime.convs,v 1.14 2002/01/02 17:58:38 mike Exp $"
+# "$Id: mime.convs,v 1.15 2002/01/23 22:30:41 mike Exp $"
 #
 #   MIME converts file for the Common UNIX Printing System (CUPS).
 #
@@ -80,8 +80,8 @@ application/vnd.cups-postscript       application/vnd.cups-raster     100     pstoraster
 # option.
 #
 
-#*/*                   application/vnd.cups-raw        0       -
+#application/octet-stream      application/vnd.cups-raw        0       -
 
 #
-# End of "$Id: mime.convs,v 1.14 2002/01/02 17:58:38 mike Exp $".
+# End of "$Id: mime.convs,v 1.15 2002/01/23 22:30:41 mike Exp $".
 #
index 5d486b51c9267c8ebb5ab6d595e05cca0c9b265a..1958a19bbf738b09dd4d9ba04d641968a647064a 100644 (file)
@@ -1,5 +1,5 @@
 #
-# "$Id: Makefile,v 1.56 2002/01/23 17:25:38 mike Exp $"
+# "$Id: Makefile,v 1.57 2002/01/23 22:30:42 mike Exp $"
 #
 #   Filter makefile for the Common UNIX Printing System (CUPS).
 #
@@ -169,7 +169,7 @@ imagetops:  imagetops.o common.o $(LIBCUPSIMAGE) ../Makedefs \
        echo Linking $@...
        $(CC) $(LDFLAGS) -o $@ imagetops.o common.o $(LINKCUPSIMAGE) \
                $(IMGLIBS) $(LIBS)
-imagetops:     common.h image.h
+imagetops.o:   common.h image.h
 
 
 #
@@ -181,7 +181,7 @@ imagetoraster:      imagetoraster.o common.o $(LIBCUPSIMAGE) ../Makedefs \
        echo Linking $@...
        $(CC) $(LDFLAGS) -o $@ imagetoraster.o common.o $(LINKCUPSIMAGE) \
                $(IMGLIBS) $(LIBS)
-imagetoraster: common.h image.h raster.h
+imagetoraster.o:       common.h image.h raster.h
 
 
 #
@@ -242,5 +242,5 @@ $(OBJS):    ../Makedefs ../cups/cups.h ../cups/ppd.h ../cups/language.h
 
 
 #
-# End of "$Id: Makefile,v 1.56 2002/01/23 17:25:38 mike Exp $".
+# End of "$Id: Makefile,v 1.57 2002/01/23 22:30:42 mike Exp $".
 #
index 3f96539681e9798335e37e92ec01dc5944222d18..8d693f63f1f5492cccbf1cdf640ab1111eb779b7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: common.c,v 1.17 2002/01/02 17:58:56 mike Exp $"
+ * "$Id: common.c,v 1.18 2002/01/23 22:30:42 mike Exp $"
  *
  *   Common filter routines for the Common UNIX Printing System (CUPS).
  *
  *
  * Contents:
  *
- *   SetCommonOptions()          - Set common filter options for media size,
- *                                 etc.
- *   UpdatePageVars()            - Update the page variables for the
- *                                 orientation.
- *   WriteClassificationProlog() - Write the prolog with the classification
- *                                 and page label.
+ *   SetCommonOptions() - Set common filter options for media size,
+ *                        etc.
+ *   UpdatePageVars()   - Update the page variables for the orientation.
+ *   WriteLabelProlog() - Write the prolog with the classification
+ *                        and page label.
+ *   WriteLabels()      - Write the actual page labels.
  */
 
 /*
@@ -113,7 +113,7 @@ SetCommonOptions(int           num_options, /* I - Number of options */
 
   if ((val = cupsGetOption("page-left", num_options, options)) != NULL)
   {
-    switch (Orientation)
+    switch (Orientation & 3)
     {
       case 0 :
           PageLeft = (float)atof(val);
@@ -132,7 +132,7 @@ SetCommonOptions(int           num_options, /* I - Number of options */
 
   if ((val = cupsGetOption("page-right", num_options, options)) != NULL)
   {
-    switch (Orientation)
+    switch (Orientation & 3)
     {
       case 0 :
           PageRight = PageWidth - (float)atof(val);
@@ -151,7 +151,7 @@ SetCommonOptions(int           num_options, /* I - Number of options */
 
   if ((val = cupsGetOption("page-bottom", num_options, options)) != NULL)
   {
-    switch (Orientation)
+    switch (Orientation & 3)
     {
       case 0 :
           PageBottom = (float)atof(val);
@@ -170,7 +170,7 @@ SetCommonOptions(int           num_options, /* I - Number of options */
 
   if ((val = cupsGetOption("page-top", num_options, options)) != NULL)
   {
-    switch (Orientation)
+    switch (Orientation & 3)
     {
       case 0 :
           PageTop = PageLength - (float)atof(val);
@@ -214,7 +214,7 @@ UpdatePageVars(void)
   float                temp;           /* Swapping variable */
 
 
-  switch (Orientation)
+  switch (Orientation & 3)
   {
     case 0 : /* Portait */
         break;
@@ -269,12 +269,15 @@ UpdatePageVars(void)
 
 
 /*
- * 'WriteClassificationProlog()' - Write the prolog with the classification
- *                                 and page label.
+ * 'WriteLabelProlog()' - Write the prolog with the classification
+ *                        and page label.
  */
 
 void
-WriteLabelProlog(const char *label)    /* I - Page label */
+WriteLabelProlog(const char *label,    /* I - Page label */
+                float      bottom,     /* I - Bottom position in points */
+                float      top,        /* I - Top position in points */
+                float      width)      /* I - Width in points */
 {
   const char   *classification;        /* CLASSIFICATION environment variable */
 
@@ -336,20 +339,62 @@ WriteLabelProlog(const char *label)       /* I - Page label */
   puts("/espWL{");
   puts("  espPF setfont");
   printf("  espPL stringwidth pop dup 12 add exch  -0.5 mul %.0f add\n",
-         PageWidth * 0.5f);
+         width * 0.5f);
   puts("  1 setgray");
-  printf("  dup 6 sub %.0f 3 index 20 rectfill\n", PageBottom - 2.0);
-  printf("  dup 6 sub %.0f 3 index 20 rectfill\n", PageTop - 18.0);
+  printf("  dup 6 sub %.0f 3 index 20 rectfill\n", bottom - 2.0);
+  printf("  dup 6 sub %.0f 3 index 20 rectfill\n", top - 18.0);
   puts("  0 setgray");
-  printf("  dup 6 sub %.0f 3 index 20 rectstroke\n", PageBottom - 2.0);
-  printf("  dup 6 sub %.0f 3 index 20 rectstroke\n", PageTop - 18.0);
-  printf("  dup %.0f moveto espPL show\n", PageBottom + 2.0);
-  printf("  %.0f moveto espPL show\n", PageTop - 14.0);
+  printf("  dup 6 sub %.0f 3 index 20 rectstroke\n", bottom - 2.0);
+  printf("  dup 6 sub %.0f 3 index 20 rectstroke\n", top - 18.0);
+  printf("  dup %.0f moveto espPL show\n", bottom + 2.0);
+  printf("  %.0f moveto espPL show\n", top - 14.0);
   puts("pop");
   puts("}bind def");
 }
 
 
 /*
- * End of "$Id: common.c,v 1.17 2002/01/02 17:58:56 mike Exp $".
+ * 'WriteLabels()' - Write the actual page labels.
+ */
+
+void
+WriteLabels(int orient)        /* I - Orientation of the page */
+{
+  float        width,          /* Width of page */
+       length;         /* Length of page */
+
+
+  puts("gsave");
+
+  if ((orient ^ Orientation) & 1)
+  {
+    width  = PageLength;
+    length = PageWidth;
+  }
+  else
+  {
+    width  = PageWidth;
+    length = PageLength;
+  }
+
+  switch (orient & 3)
+  {
+    case 1 : /* Landscape */
+        printf("%.1f 0.0 translate 90 rotate\n", length);
+        break;
+    case 2 : /* Reverse Portrait */
+        printf("%.1f %.1f translate 180 rotate\n", width, length);
+        break;
+    case 3 : /* Reverse Landscape */
+        printf("0.0 %.1f translate -90 rotate\n", width);
+        break;
+  }
+
+  puts("espWL");
+  puts("grestore");
+}
+
+
+/*
+ * End of "$Id: common.c,v 1.18 2002/01/23 22:30:42 mike Exp $".
  */
index ccf277985be74df553b6a1f1c4e65adb29f5efbc..ed0c5a822dea852037b55f107ee02cd746a317e4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: common.h,v 1.8 2002/01/02 17:58:56 mike Exp $"
+ * "$Id: common.h,v 1.9 2002/01/23 22:30:42 mike Exp $"
  *
  *   Common filter definitions for the Common UNIX Printing System (CUPS).
  *
@@ -61,10 +61,11 @@ extern float        PageLeft,       /* Left margin */
 extern ppd_file_t *SetCommonOptions(int num_options, cups_option_t *options,
                                    int change_size);
 extern void    UpdatePageVars(void);
-extern void    WriteLabelProlog(const char *label);
-#define                WriteLabels() puts("espWL");
+extern void    WriteLabelProlog(const char *label, float bottom,
+                                float top, float width);
+extern void    WriteLabels(int orient);
 
 
 /*
- * End of "$Id: common.h,v 1.8 2002/01/02 17:58:56 mike Exp $".
+ * End of "$Id: common.h,v 1.9 2002/01/23 22:30:42 mike Exp $".
  */
index 4abc1d702c3f56633f6e06fb66233fc1dcf1c0fe..0708c30ceeb28061632f466afb728177d44474a7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: imagetops.c,v 1.41 2002/01/02 17:59:00 mike Exp $"
+ * "$Id: imagetops.c,v 1.42 2002/01/23 22:30:42 mike Exp $"
  *
  *   Image file to PostScript filter for the Common UNIX Printing System (CUPS).
  *
@@ -577,7 +577,8 @@ main(int  argc,             /* I - Number of command-line arguments */
     printf("{ neg 1 add dup 0 lt { pop 1 } { %.3f exp neg 1 add } "
            "ifelse %.3f mul } bind settransfer\n", g, b);
 
-  WriteLabelProlog(cupsGetOption("page-label", num_options, options));
+  WriteLabelProlog(cupsGetOption("page-label", num_options, options),
+                   PageBottom, PageTop, PageWidth);
 
   if (realcopies > 1)
   {
@@ -720,7 +721,7 @@ main(int  argc,             /* I - Number of command-line arguments */
        }
 
        puts("grestore");
-       WriteLabels();
+       WriteLabels(Orientation);
        puts("showpage");
       }
 
@@ -865,5 +866,5 @@ ps_ascii85(ib_t *data,              /* I - Data to print */
 
 
 /*
- * End of "$Id: imagetops.c,v 1.41 2002/01/02 17:59:00 mike Exp $".
+ * End of "$Id: imagetops.c,v 1.42 2002/01/23 22:30:42 mike Exp $".
  */
index af9feb4446535cf773035845d70ec871d5e5251d..0e0d7509eb4d11d1101ad0f07c52661bdbaffa22 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: pstops.c,v 1.71 2002/01/23 17:25:38 mike Exp $"
+ * "$Id: pstops.c,v 1.72 2002/01/23 22:30:42 mike Exp $"
  *
  *   PostScript filter for the Common UNIX Printing System (CUPS).
  *
@@ -308,7 +308,21 @@ main(int  argc,                    /* I - Number of command-line arguments */
     UseESPsp = 1;
   }
 
-  WriteLabelProlog(val);
+  if (NUp == 2)
+  {
+   /*
+    * For 2-up output, rotate the labels to match the orientation
+    * of the pages...
+    */
+
+    if (Orientation & 1)
+      WriteLabelProlog(val, PageBottom, PageWidth - PageLength + PageTop,
+                       PageLength);
+    else
+      WriteLabelProlog(val, PageLeft, PageRight, PageLength);
+  }
+  else
+    WriteLabelProlog(val, PageBottom, PageTop, PageWidth);
 
   if (UseESPsp)
     puts("userdict begin\n"
@@ -887,7 +901,7 @@ end_nup(int number) /* I - Page number */
     case 1 :
        if (UseESPsp)
        {
-         WriteLabels();
+         WriteLabels(Orientation);
           puts("ESPshowpage");
        }
        break;
@@ -895,7 +909,23 @@ end_nup(int number)        /* I - Page number */
     case 2 :
        if ((number & 1) == 1 && UseESPsp)
        {
-         WriteLabels();
+         if (Orientation & 1)
+         {
+          /*
+           * Rotate the labels back to portrait...
+           */
+
+           WriteLabels(Orientation - 1);
+         }
+         else
+         {
+          /*
+           * Rotate the labels to landscape...
+           */
+
+           WriteLabels(Orientation + 1);
+         }
+
           puts("ESPshowpage");
        }
         break;
@@ -903,7 +933,7 @@ end_nup(int number) /* I - Page number */
     case 4 :
        if ((number & 3) == 3 && UseESPsp)
        {
-         WriteLabels();
+         WriteLabels(Orientation);
           puts("ESPshowpage");
        }
         break;
@@ -1113,5 +1143,5 @@ start_nup(int number)     /* I - Page number */
 
 
 /*
- * End of "$Id: pstops.c,v 1.71 2002/01/23 17:25:38 mike Exp $".
+ * End of "$Id: pstops.c,v 1.72 2002/01/23 22:30:42 mike Exp $".
  */