After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 731786 - PostScript files are not rotated correctly
PostScript files are not rotated correctly
Status: RESOLVED OBSOLETE
Product: evince
Classification: Core
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-06-17 15:46 UTC by Marek Kašík
Modified: 2018-05-22 15:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Unify direction of rotation (1.60 KB, patch)
2014-06-19 12:12 UTC, Marek Kašík
reviewed Details | Review

Description Marek Kašík 2014-06-17 15:46:15 UTC
PostScript files rotates opposite direction with current libspectre. I think that libspectre does it right now so my guess is that it is an evince bug.

I've found that evince rotates to the left by using this:

ev_document_model_set_rotation (ev_window->priv->model, rotation - 90);

Shouldn't it be:

ev_document_model_set_rotation (ev_window->priv->model, rotation + 90);

?

This works for PostScript and DjVu.

Marek
Comment 1 Marek Kašík 2014-06-17 15:47:13 UTC
(In reply to comment #0)
> ev_document_model_set_rotation (ev_window->priv->model, rotation - 90);

This is in ev_window_cmd_edit_rotate_left() in shell/ev-window.c.
Comment 2 Carlos Garcia Campos 2014-06-18 16:28:13 UTC
(In reply to comment #0)
> PostScript files rotates opposite direction with current libspectre. I think
> that libspectre does it right now so my guess is that it is an evince bug.
> 
> I've found that evince rotates to the left by using this:
> 
> ev_document_model_set_rotation (ev_window->priv->model, rotation - 90);
> 
> Shouldn't it be:
> 
> ev_document_model_set_rotation (ev_window->priv->model, rotation + 90);
> 
> ?

hmm, I think it depends on the backend, in PostScript "The default user space in the landscape orientation will be rotated 90 degrees counterclockwise with respect to the default user space in the portrait orientation". In evince we do the rotation clockwise, because that's what cairo does ("With the default axis orientation of cairo, positive angles rotate in a clockwise direction"), so we need to invert it only for postscript (and any other backend doing the rotation itself). PDF defines the rotation the same way than PostScript, but we do the rotation on the cairo context before rendering the page with poppler, so it's done right.

> This works for PostScript and DjVu.
> 
> Marek
Comment 3 Marek Kašík 2014-06-19 12:12:34 UTC
Created attachment 278761 [details] [review]
Unify direction of rotation

(In reply to comment #2)
> (In reply to comment #0)
> > PostScript files rotates opposite direction with current libspectre. I think
> > that libspectre does it right now so my guess is that it is an evince bug.
> > 
> > I've found that evince rotates to the left by using this:
> > 
> > ev_document_model_set_rotation (ev_window->priv->model, rotation - 90);
> > 
> > Shouldn't it be:
> > 
> > ev_document_model_set_rotation (ev_window->priv->model, rotation + 90);
> > 
> > ?
> 
> hmm, I think it depends on the backend, in PostScript "The default user space
> in the landscape orientation will be rotated 90 degrees counterclockwise with
> respect to the default user space in the portrait orientation". In evince we do
> the rotation clockwise, because that's what cairo does ("With the default axis
> orientation of cairo, positive angles rotate in a clockwise direction"), so we
> need to invert it only for postscript (and any other backend doing the rotation
> itself). PDF defines the rotation the same way than PostScript, but we do the
> rotation on the cairo context before rendering the page with poppler, so it's
> done right.

I've prepared a patch which converts the rotation from clockwise direction to counterclockwise direction for postscript and djvu backends.
I've tested other backends and it seems that just the postscript and djvu needs this conversion.
Comment 4 Carlos Garcia Campos 2014-06-19 14:36:14 UTC
Review of attachment 278761 [details] [review]:

The djvu change is correct in any case, so please push only that part for now, but add a comment in the code explaining why revert the orientation

::: backend/ps/ev-spectre.c
@@ +303,3 @@
 					       &width, &height);
 
+	rotation = (360 - rc->rotation + get_page_rotation (ps_page)) % 360;

hmm, the problem is that this depends on the changes in libspectre no?
Comment 5 Marek Kašík 2014-06-23 12:26:57 UTC
(In reply to comment #4)
> Review of attachment 278761 [details] [review]:
> 
> The djvu change is correct in any case, so please push only that part for now,
> but add a comment in the code explaining why revert the orientation

Thank you for the review.
I've pushed the change of direction of rotation of the djvu backend to master together with the comment.


> ::: backend/ps/ev-spectre.c
> @@ +303,3 @@
>                             &width, &height);
> 
> +    rotation = (360 - rc->rotation + get_page_rotation (ps_page)) % 360;
> 
> hmm, the problem is that this depends on the changes in libspectre no?

I've just tested evince with the ghostscript 9.05 and it seems that it rotates documents in clockwise direction so we shouldn't change it here but modify the patch in libspectre so that it rotates documents in clockwise direction too.
Comment 6 GNOME Infrastructure Team 2018-05-22 15:37:44 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/evince/issues/471.