r22520 by jghali - #15301: Rotated PDF Form fields are not positioned correctly in final PDF

scribus-commit scribus-commit at lists.scribus.net
Fri May 4 22:19:56 UTC 2018


Author: jghali
Date: Fri May  4 22:19:56 2018
New Revision: 22520

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22520
Log:
#15301: Rotated PDF Form fields are not positioned correctly in final PDF

Modified:
    trunk/Scribus/scribus/pdflib_core.cpp

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22520&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp	(original)
+++ trunk/Scribus/scribus/pdflib_core.cpp	Fri May  4 22:19:56 2018
@@ -8824,7 +8824,14 @@
 	if (ite->annotation().borderColor() != CommonStrings::None)
 		PutDoc("/BC [ "+SetColor(ite->annotation().borderColor(), 100)+" ] ");
 	if (ite->rotation() != 0)
-		PutDoc("/R "+Pdf::toPdf((abs(static_cast<int>(ite->rotation())) / 90)*90)+" ");
+	{
+		int rot = -(static_cast<int>(ite->rotation()) / 90) * 90;
+		while (rot < 0)
+			rot += 360;
+		while (rot >= 360)
+			rot -= 360;
+		PutDoc("/R " + Pdf::toPdf(rot) + " ");
+	}
 	PutDoc(">>\n");
 	QByteArray onState = Pdf::toName(ite->itemName().replace(".", "_" ));
 	if (ite->annotation().IsChk())
@@ -8855,7 +8862,13 @@
 			PutDoc("/AA " + Pdf::toPdf(AActionObj) + " 0 R\n");
 		}
 	}
-	switch (((abs(static_cast<int>(ite->rotation())) / 90)*90))
+
+	int rotation = -(static_cast<int>(ite->rotation()) / 90) * 90;
+	while (rotation < 0)
+		rotation += 360;
+	while (rotation >= 360)
+		rotation -= 360;
+	switch (rotation)
 	{
 		case 0:
 			break;
@@ -9203,7 +9216,14 @@
 					break;
 			}
 			if (ite->rotation() != 0)
-				PutDoc("/R "+Pdf::toPdf((abs(static_cast<int>(ite->rotation())) / 90)*90)+" ");
+			{
+				int rot = -(static_cast<int>(ite->rotation()) / 90) * 90;
+				while (rot < 0)
+					rot += 360;
+				while (rot >= 360)
+					rot -= 360;
+				PutDoc("/R " + Pdf::toPdf(rot) + " ");
+			}
 			PutDoc(">>\n");
 			if ((ite->annotation().ActionType() != Annotation::Action_None) || (ite->annotation().AAact()))
 			{
@@ -9285,7 +9305,13 @@
 		}
 	if ((ite->annotation().Type() < 2) || ((ite->annotation().Type() > Annotation::Listbox) && (ite->annotation().Type() < Annotation::Annot3D)))
 		PutDoc("/Border [ 0 0 0 ]\n");
-	switch (((abs(static_cast<int>(ite->rotation())) / 90)*90))
+
+	int rotation = -(static_cast<int>(ite->rotation()) / 90) * 90;
+	while (rotation < 0)
+		rotation += 360;
+	while (rotation >= 360)
+		rotation -= 360;
+	switch (rotation)
 	{
 		case 0:
 			break;




More information about the scribus-commit mailing list