[okular] [Bug 353300] Text search does not work in Arabic

Saladin Shaban bugzilla_noreply at kde.org
Fri Mar 27 10:44:34 GMT 2026


https://bugs.kde.org/show_bug.cgi?id=353300

--- Comment #9 from Saladin Shaban <salshaaban at gmail.com> ---
Created attachment 191064
  --> https://bugs.kde.org/attachment.cgi?id=191064&action=edit
RTL patch for some Okular backends

I gave this issue multiple tries over the past two years, and I kept hitting
roadblocks in `TextPagePrivate::correctTextOrder()` and the functions called by
it.

But it turned out, for Epub and Mobi and, I think, all document types that are
based on QTextDocument, we don't have to call `correctTextOrder()` at all. We
don't have to guess the layout because it's already figured out correctly by
QTextDocument.

Using the attached patch, text search and selection work for me in Epub and
Mobi files, in both English and Arabic.

In my earlier diff, I checked for RTL characters using QChar::DirAL and
QChar::DirR. This is not enough as it doesn't handle neutral characters like
space and punctuation:

https://gemini.google.com/share/7151fb8470f1

What's the correct way to check the document type in `Page::setTextPage()` so
we skip `correctTextOrder()` only for certain file types?

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Okular-devel mailing list