[gs-cvs] rev 6918 - trunk/gs/src

leonardo at ghostscript.com leonardo at ghostscript.com
Thu Jul 13 14:35:15 PDT 2006


Author: leonardo
Date: 2006-07-13 14:35:15 -0700 (Thu, 13 Jul 2006)
New Revision: 6918

Modified:
   trunk/gs/src/gdevpdf.c
Log:
Fix (pdfwrite) : A further improvement for the text rotation logic.

DETASILS :

Bug 688793 "document pages rotated with Ghostscript, not with Acrobat"

This patch implements Raph's suggestion how I understand it.

[beg quote]
There are two issues here. First, the document-global viewing_orientation info
isn't being copied into the page-specific info. [skipped]

Second, when the inferred text rotation and the dsc orientation can't match
(i.e. are off by an odd multiple of 90 degrees), precedence is given to the text
rotation. [skipped]

[Skipped] reverse the precedence so that if
both dsc orientation is set and text rotation is inferred, use the dsc value.
[end quote]

See the bug 688793 for more details.

I marked the change with Bug688793 macro
because I can't say that I fully foresee its consequences.
The mark will help to analyze problems if any appear.

DIFFERENCES :

pdfwrite:
Bug687044.ps 
japan-.ps 


Modified: trunk/gs/src/gdevpdf.c
===================================================================
--- trunk/gs/src/gdevpdf.c	2006-07-13 12:37:03 UTC (rev 6917)
+++ trunk/gs/src/gdevpdf.c	2006-07-13 21:35:15 UTC (rev 6918)
@@ -727,7 +727,7 @@
 	    (page != NULL ? &page->text_rotation : &pdev->text_rotation);
 	int angle = -1;
 
-#define  Bug687800
+#define Bug687800
 #ifndef Bug687800 	/* Bug 687800 together with Bug687489.ps . */
 	const gs_point *pbox = &(page != NULL ? page : &pdev->pages[0])->MediaBox;
 
@@ -748,14 +748,23 @@
 		angle = 90;
 	}
 
+	if (angle < 0) {
+#define Bug688793
+#ifdef  Bug688793
+	/* If not combinable, prefer dsc rotation : */
+	    if (dsc_orientation >= 0)
+		angle = dsc_orientation * 90;
+	    else
+		angle = ptr->Rotate;
+#else
 	/* If not combinable, prefer text rotation : */
-	if (angle < 0) {
 	    if (ptr->Rotate >= 0)
 		angle = ptr->Rotate;
 #ifdef Bug687800
 	    else
 		angle = dsc_orientation * 90;
 #endif
+#endif
 	}
 
 	/* If got some, write it out : */
@@ -858,6 +867,11 @@
     page->dsc_info = pdev->page_dsc_info;
     if (page->dsc_info.orientation < 0)
 	page->dsc_info.orientation = pdev->doc_dsc_info.orientation;
+#ifdef Bug688793
+    if (page->dsc_info.viewing_orientation < 0)
+       page->dsc_info.viewing_orientation =
+           pdev->doc_dsc_info.viewing_orientation;
+#endif
     if (page->dsc_info.bounding_box.p.x >= page->dsc_info.bounding_box.q.x ||
 	page->dsc_info.bounding_box.p.y >= page->dsc_info.bounding_box.q.y
 	)



More information about the gs-cvs mailing list