]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Added autoselecting portrait/landscape on PCL Renderer (see bug #6638)
authorChristian Geisert <chrisg@apache.org>
Tue, 26 Nov 2002 18:15:18 +0000 (18:15 +0000)
committerChristian Geisert <chrisg@apache.org>
Tue, 26 Nov 2002 18:15:18 +0000 (18:15 +0000)
Submitted by: vicentesalvador@netscape.net (Vicente Salvador)

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_20_2-maintain@195629 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
src/org/apache/fop/render/pcl/PCLRenderer.java

diff --git a/CHANGES b/CHANGES
index 164ce79ff264262ba7703f0190a2215dd7ae6212..ae15f71a6563529303ffd788664f7658b4a4a101 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
 ==============================================================================
 Done since 0.20.4 release
 
+- Added autoselecting  portrait/landscape on PCL Renderer (see bug #6638)
+  Submitted by: vicentesalvador@netscape.net (Vicente Salvador)
 - Improved AWT Font-measuring/rendering (see bug #14657)
   Submitted by: Ralph LaChance <Ralph_LaChance@compuserve.com>
 - Updated examples/fo files to remove all errors and warnings during build
index ba52bfee14718f039252d9ce895f25f6c90b9ec2..f77b8678e0614433f90e8a6eb828c62a3ff7df6b 100755 (executable)
@@ -48,8 +48,7 @@ public class PCLRenderer extends PrintRenderer {
     public int curdiv = 0;
     private int divisions = -1;
     public int paperheight = -1;    // Paper height in decipoints?
-    public int orientation =
-        -1;                         // -1=default/unknown, 0=portrait, 1=landscape.
+    public int orientation = 0;     // 0=default/portrait, 1=landscape.
     public int topmargin = -1;      // Top margin in decipoints?
     public int leftmargin = -1;     // Left margin in decipoints?
     private int fullmargin = 0;
@@ -677,6 +676,18 @@ public class PCLRenderer extends PrintRenderer {
             System.out.println("PCLRenderer.renderPage() page.Height() = "
                                + page.getHeight());
 
+        // FIXME: Set orientation. We made this assumption. It's not always correct but we need a
+        // method to generate landscape pages
+        if (page.getHeight() < page.getWidth()) {
+             orientation = 1;
+        }
+        currentStream.add("\033&l" + orientation + "O");
+        if (orientation == 1 || orientation == 3) {
+            xoffset = -144;
+        } else {
+            xoffset = -180;
+        }
+                               
         if (paperheight > 0 && divisions == -1)
             divisions = paperheight / (page.getHeight() / 100);
 
@@ -750,16 +761,6 @@ public class PCLRenderer extends PrintRenderer {
         log.info("rendering areas to PCL");
         currentStream = new PCLStream(outputStream);
 
-        // Set orientation.
-        if (orientation > -1)
-            currentStream.add("\033&l" + orientation + "O");
-        else
-            currentStream.add("\033&l0O");
-        if (orientation == 1 || orientation == 3)
-            xoffset = -144;
-        else
-            xoffset = -180;
-
         // Reset the margins.
         currentStream.add("\033" + "9\033&l0E");
     }