GNOME Bugzilla – Bug 731786
PostScript files are not rotated correctly
Last modified: 2018-05-22 15:37:44 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
(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.
(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
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.
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?
(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.
-- 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.