Incorrect page layout in dual view with RTL languages

Bug #1281870 reported by abdullahc
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
qpdfview
Fix Released
Wishlist
Adam Reichold

Bug Description

In dual page view, the current state, pages are shown as:

1 2
3 4
-
1
2 3
-
 1
2 3

Where for RTL (Right to Left Languages) documents or interface, it should be:

2 1
4 3
-
  1
3 2
-
 1
3 2

Like Acroread, it provides options under " Preferences > International":
- Enable RTL language switch, so you check it in the menu/toolbar to flip pages
order/alignment.
- Default direction: Document, LTR, RTL

Tags: i18n rtl

Related branches

abdullahc (sneetsher)
tags: added: i18n rtl
description: updated
description: updated
Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello,

thanks for reporting this issue. I'll look into it as soon as I find some spare time.

Best regards, Adam.

Changed in qpdfview:
status: New → Triaged
importance: Undecided → Wishlist
Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello again,

I have to questions for implementing this: Could you attach a document that specifies that it is to be layouted right-to-left so I can try to figure how Poppler tells me about this. And I actually don't understand the third case in your sketches: I don't think there is any layout mode in qpdfview where the first page will be centered? Could explain that further.

Best regards, Adam.

Changed in qpdfview:
assignee: nobody → Adam Reichold (adamreichold)
status: Triaged → In Progress
Revision history for this message
Adam Reichold (adamreichold) wrote :

Btw., you can already try out the attached patch with only the "Default" option currently being the same as left-to-right since I do not yet know how to detect a document-supplied default.

Revision history for this message
Adam Reichold (adamreichold) wrote :

Sorry, I meant linked branch not attached patch.

Revision history for this message
Adam Reichold (adamreichold) wrote :

I decided to do this differently and just add this as an option on a per-tab basis as would will probably use documents that are RTL alongside with LRT ones. (The branch is still missing per-file settings support which needs a change to the database scheme and a corresponding migration routine...)

Revision history for this message
Adam Reichold (adamreichold) wrote :

Ok, now the per-file settings support landed in the linked branch which should make this quite useful. Please test and report back here. (Note that this migrates your per-file settings to the new format which might change, so you would backup your database at ~/.local/share/qpdfview/qpdfview/database" first.)

Any suggestions for a default keyboard shortcut or an icon?

Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello sneetsher,

do you feel comfortable with building this branch from source to try it out? I am not sure I want to merge this into trunk without some outside testing as I just found and fixed a problem with non-uniform pages in two-pages-mode.

Best regards, Adam.

Revision history for this message
abdullahc (sneetsher) wrote :

Hi Adam,

Sorry to be late in replay, I was traveling for 3 days. (I fill up this bug report, As I'm an Arabic user too and motivated by this question in Ask Ubuntu https://askubuntu.com/questions/421083/how-to-open-a-pdf-view-2-pages-at-a-time-but-for-arabic-pdfs-where-left-page-i )

- Myself I don't know how to make a PDF document with RTL predefined neither I know specific one which could be used for test that 'from document' option. But I will look for one.

- 3rd layout mode, I didn't use qpdfview before facing this problem. I just put as some other PDF viewers have it (Centered Cover Page), so no problem.

- "per-tab", That's will nice for now. Also I'm not sure if "per-file" is required.

- For icon and shortcut, I will look for it.

- You count on me as an advanced user, I didn't try out yet. I just want to write fast reply for now. I will keep you updated.

Revision history for this message
abdullahc (sneetsher) wrote :

Hi Adam,

I got this error while "make" step in bot branches (qpdfview & rtl-page-layout):

g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DAPPLICATION_VERSION=\"0.4.8.99\" -DWITH_SVG -DWITH_SQL -DWITH_DBUS -DPLUGIN_INSTALL_PATH=\"/usr/lib/qpdfview\" -DWITH_PDF -DPDF_PLUGIN_NAME=\"libqpdfview_pdf.so\" -DWITH_PS -DPS_PLUGIN_NAME=\"libqpdfview_ps.so\" -DWITH_DJVU -DDJVU_PLUGIN_NAME=\"libqpdfview_djvu.so\" -DWITH_CUPS -DWITH_SYNCTEX -DWITH_SIGNALS -DDATA_INSTALL_PATH=\"/usr/share/qpdfview\" -DQT_NO_DEBUG -DQT_SVG_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_DBUS_LIB -DQT_SQL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt5/mkspecs/linux-g++-64 -I. -Isynctex -Iicons -I/usr/include/qt5 -I/usr/include/qt5/QtSvg -I/usr/include/qt5/QtPrintSupport -I/usr/include/qt5/QtWidgets -I/usr/include/qt5/QtDBus -I/usr/include/qt5/QtSql -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore -Imoc -o objects/presentationview.o sources/presentationview.cpp
sources/presentationview.cpp: In member function ‘void PresentationView::prepareScene()’:
sources/presentationview.cpp:541:52: error: ‘devicePixelRatio’ was not declared in this scope
         page->setDevicePixelRatio(devicePixelRatio());
                                                    ^
make[1]: *** [objects/presentationview.o] Error 1
make[1]: Leaving directory `/media/sneetsher/gnu_files/abdellah/cvss/bzr/qpdfview/qpdfview'
make: *** [sub-application-pro-make_first-ordered] Error 2

Is it the same problem as http://forum.openscenegraph.org/viewtopic.php?t=13287 ? I have Qt 5.0.2.

Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello Abdellah,

thanks for trying it out. It seems to be the same problem as in the OSG forum and indeed QPaintDevice::devicePixelRatio() was introduced in Qt 5.1 and is not present in Qt 5.0. I therefore fixed this in trunk and will merge the fix into the RTL branch. Please retry using at least revision 1466 resp. ???.

Sorry for making it more difficult than necessary. However, if I remember correctly, I had other problems with Qt 5.0.x and you will probably need to disable SVG support by passing "CONFIG+=without_svg" as an extra argument to "qmake". Updating to a newer version of Qt 5 or building against Qt 4 might be advisable for concentrating on the issue at hand.

Best regards, Adam.

Revision history for this message
Adam Reichold (adamreichold) wrote :

Sorry, forgot to insert the correct revision of the rtl-page-layout branch which is 1473...

Revision history for this message
abdullahc (sneetsher) wrote :
Download full text (4.0 KiB)

- rtl-page-layout branch r1473 (Qt5 & Qt4 both raise same error)

$ qmake "CONFIG+=without_svg" qpdfview.pro
$ make clean
$ make

g++ -m64 -Wl,-O1 -o qpdfview objects/settings.o objects/pluginhandler.o objects/shortcuthandler.o objects/rendertask.o objects/pageitem.o objects/presentationview.o objects/searchtask.o objects/miscellaneous.o objects/documentlayout.o objects/documentview.o objects/printdialog.o objects/settingsdialog.o objects/fontsdialog.o objects/helpdialog.o objects/recentlyusedmenu.o objects/recentlyclosedmenu.o objects/bookmarkmenu.o objects/database.o objects/mainwindow.o objects/main.o objects/synctex_parser.o objects/synctex_parser_utils.o objects/signalhandler.o objects/qrc_icons.o objects/moc_settings.o objects/moc_model.o objects/moc_pluginhandler.o objects/moc_shortcuthandler.o objects/moc_rendertask.o objects/moc_pageitem.o objects/moc_presentationview.o objects/moc_searchtask.o objects/moc_miscellaneous.o objects/moc_documentview.o objects/moc_printdialog.o objects/moc_settingsdialog.o objects/moc_fontsdialog.o objects/moc_helpdialog.o objects/moc_recentlyusedmenu.o objects/moc_recentlyclosedmenu.o objects/moc_bookmarkmenu.o objects/moc_database.o objects/moc_mainwindow.o objects/moc_signalhandler.o -L/usr/X11R6/lib64 -lz -lQt5Svg -L/usr/lib/x86_64-linux-gnu -lQt5PrintSupport -lQt5Widgets -lQt5DBus -lQt5Sql -lQt5Gui -lQt5Core -lGL -lpthread
objects/documentview.o: In function `DocumentView::printUsingCUPS(QPrinter*, PrintOptions const&, int, int)':
documentview.cpp:(.text+0x79bd): undefined reference to `cupsGetDests'
documentview.cpp:(.text+0x7a18): undefined reference to `cupsGetDest'
documentview.cpp:(.text+0x7aa8): undefined reference to `cupsAddOption'
documentview.cpp:(.text+0x7bbb): undefined reference to `cupsAddOption'
documentview.cpp:(.text+0x7c9e): undefined reference to `cupsAddOption'
documentview.cpp:(.text+0x7d18): undefined reference to `cupsAddOption'
documentview.cpp:(.text+0x7d49): undefined reference to `cupsAddOption'
objects/documentview.o:documentview.cpp:(.text+0x7d76): more undefined references to `cupsAddOption' follow
objects/documentview.o: In function `DocumentView::printUsingCUPS(QPrinter*, PrintOptions const&, int, int)':
documentview.cpp:(.text+0x8275): undefined reference to `cupsFreeDests'
documentview.cpp:(.text+0x8284): undefined reference to `cupsFreeOptions'
documentview.cpp:(.text+0x831b): undefined reference to `cupsPrintFile'
documentview.cpp:(.text+0x83ae): undefined reference to `cupsLastErrorString'
documentview.cpp:(.text+0x84df): undefined reference to `cupsAddOption'
documentview.cpp:(.text+0x84f7): undefined reference to `cupsAddOption'
documentview.cpp:(.text+0x850f): undefined reference to `cupsAddOption'
documentview.cpp:(.text+0x8527): undefined reference to `cupsAddOption'
documentview.cpp:(.text+0x853f): undefined reference to `cupsAddOption'
objects/documentview.o:documentview.cpp:(.text+0x8557): more undefined references to `cupsAddOption' follow
objects/documentview.o: In function `DocumentView::printUsingCUPS(QPrinter*, PrintOptions const&, int, int)':
documentview.cpp:(.text+0x87a1): undefined reference to `cupsLastErrorString'
collect2: error: ld returne...

Read more...

Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello Abdellah,

the problem with using Qt 5.0.x is a known bug of the QtSvg module and is fixed by using a newer version of Qt 5. The linker problems w.r.t. CUPS were reported by several people building on Debian but always turned out to be transient, i.e. I would advise to start from scratch pulling the branch again and restarting the build process. If that does not help, I am not sure how to help you since we never figured out what the problem actually was. (@Benjamin: Do you remember or know a way to resolve this running Debian derivatives?) In any case, the rtl-page-layout does not change anything w.r.t. to CUPS usage. (Of course, "-lcups" is missing in the linker command and that causes the unresolved references, the question is rather why this wasn't added to the Makefiles generated by qmake...)

Best regards, Adam.

Revision history for this message
abdullahc (sneetsher) wrote :

Hello Adam,

After I tried to add "LIBS+=-lcups" , I noticed that nothing was changed in the makefiles.

It turned out that qmake does not re-generate some files (eg: Makefiles.*plugin, ...) if they already exit. Neither "make clean" removes them.

So, I removed all generated files not tracked by bzr:

bzr status | xargs rm -rf {}

Then I started over. It works, without using any additional options. (ie: makefiles were generated previously when there were some missing dependencies)

RTL switch works nicely as supposed to be. Thank you.

Revision history for this message
abdullahc (sneetsher) wrote :

I got an Arabic magazine series with RTL page layout, as I have tested it with Acroread9. Let me know if you need multiple files.

Revision history for this message
abdullahc (sneetsher) wrote :

Hi,

I couldn't find any viewer with icon for such option, I have attached the icon used by LibreOffice as example but that is for editing. So I would suggest some thing similar to the svg I have sketched.

For shortcut, it not very popular option as it is only for users of RTL languages. So I would suggest Ctrl+Shift+r .

abdullahc (sneetsher)
summary: - Incorrect page order in dual view with RTL languages
+ Incorrect page layout in dual view with RTL languages
Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello again,

thank you for being helpful with test and development. I just merged the basic support into trunk and will look into how difficult the automatic detection would be and I'll also have a look at the icon. (I have used your suggested default keyboard shortcut.) So the basic functionality itself should hit the daily builds soon...

Best regards, Adam.

Changed in qpdfview:
status: In Progress → Fix Committed
Changed in qpdfview:
milestone: none → 0.4.9
Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello again,

I really liked the stylized icon you suggested but to keep the graphical style consistent, I tried to more or less recreate it using the fit-to-width icon that is already shipped with qpdfview. It added the icon and made the right-to-left option available in the view tool bar as "rightToLeftMode" in trunk revision 1469. (I also added to the contributors list.)

Best regards, Adam.

Revision history for this message
abdullahc (sneetsher) wrote :

Hi Adam,

Yep, I have tested shortcut and icon, seems good. Thank you.

I would like see the default to be "From Document". If it is not such quick task, it will be good if you would make RTL layout default for RTL locals like Acroread, see http://help.adobe.com/en_US/acrobat/X/pro/using/WS08EC9A35-484E-4ceb-B92A-9FADBC4CB267.w.html#WSB3D57829-5E30-4fdd-892B-32895C4F246B.w

You may already have seen this, but I thought it could be helpful. The option that control page layout direction is at:

12.2, Table 150, "Direction"
https://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf

Acroread shows it at: File > Properties > Advanced Tab > Reading Options: Binding = "Right Edge"

Reference: http://forums.adobe.com/thread/624547

Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello again,

just committed a changed replaces the fallback (i.e. not file specific) setting with a heuristic that determines right-to-left mode from the system locale. So if a file is opened for the first time or if you have disabled per-file settings, right-to-left mode is chosen depending on the text direction of the locale. Otherwise the per-file settings will determine the whether the mode is active, i.e. if you explicitly set a document to left-to-right it should open in this mode the next time you open it.

I still have to investigate how to make this default on the document information, I'll report back here when I found the time to dig into this...

Best regards, Adam.

Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello again,

I just committed the necessary interfaces to load document-supplied defaults like continuous mode or two-pages mode. There also is an interface for right-to-left mode but Poppler does not yet expose this information from the viewer preferences in the document catalog. I have submitted a patch to the Poppler mailing list and if it is considered to be of appropriate quality, it might end up in Poppler 0.26. But I can't promise anything...

Best regards, Adam.

Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello again,

the patch was accepted upstream and the support should be part of Poppler's upcoming 0.26 release. I also just committed the corresponding commit into qpdfview's trunk so that the support will be enabled when qpdfview 0.4.9 is built against Poppler 0.26. Thanks for working this out so thoroughly, let's we don't see too many bugs when things fall into place.

Best regards, Adam.

Revision history for this message
abdullahc (sneetsher) wrote :

Hi,

Nice to hear that, that will help much to fix similar bug already submitted against (Evince & Okular).

Changed in qpdfview:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers