GNOME Bugzilla – Bug 543164
Wrong view when viewing a right-to-left document
Last modified: 2018-05-22 13:24:43 UTC
Right-to-left documents are set to a wrong view when they are opened and when you navigate to another page. That is, the horizontal scroll bar is put at the very left and the left part of the document is show-- which is suitable only for left-to-right documents. So, this default behavior should be corrected for RTL documents. The necessity to scroll to right every time you go to another page is really annoying. To reproduce the bug, make a document in Open Office Writer in a right-to-left language (like Persian) and make a PDF file from it. Open the file in Evince and you will see the problem.
Just to check if I understand the problem correctly: when the zoom level is bigger than "fit to width", by default the interface snaps to the upper-left corner of the document which is obviously wrong for an RTL document, where it should snap to the upper-right corner.
Well, I think the code to handle this situation should probably be in ev-window.c in ev_window_load_job_cb( .. ) before setup_document_from_metadata(..) in line 1378 (master branch) the EvDocument structure has a property ui_hints which can have the flag EV_DOCUMENT_UI_HINT_DIRECTION_RTL set from the poppler backend's POPPLER_VIEWER_PREFERENCES_DIRECTION_RTL which is poppler's exposition of the "Direction R2L" keyword of the PDF viewer preferences dictionary. This is as far as I got because I don't know how to get the view to do what I want at this point. -Bartek
It seems to me that the viewer preferences property in poppler isn't implemented yet. See: http://cgit.freedesktop.org/poppler/poppler/tree/glib/poppler-document.cc#n1163 Perhaps in addition to acting on the RTL hint in the document, when using a right-to-left locale, the default should be to open the view to the right-top corner of the document?
I don't know the code much, but I think a good place to fix this bug would be in the ev_view_scroll_to_page_position function (http://git.gnome.org/browse/evince/tree/libview/ev-view.c#n541). It should scroll the view to the top-right corner of a page, instead of the top-left corner, when required. If I understand correctly, this would make evince scroll the view to the correct position not only when opening a file, but also when navigating to a different page.
Created attachment 194310 [details] [review] A patch to scroll to the top-right when page scrolling in RTL locales. Here's a patch that does what I suggested. I tested it and it works as I expected when changing the page, but not when loading a new document. I looked in the code of ev_document_changed_cb, and the function will only call ev_view_change_page if the current page is different than the document's current page. Otherwise it just scrolls to keep position. Is there a reason why it shouldn't always scroll to the model's current page when loading a new document?
-- 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/67.