[Libreoffice-bugs] [Bug 104597] Text runs of RTL scripts (e.g. Arabic, Hebrew, Persian) from imported PDF are reversed, PDFIProcessor::mirrorString not behaving

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Fri Jul 16 08:08:19 UTC 2021


https://bugs.documentfoundation.org/show_bug.cgi?id=104597

--- Comment #56 from Armin Le Grand <Armin.Le.Grand at me.com> ---
To comment 53: I would not recommend to remove the transformation comparison. I
have made bad experiences with guesses like 'will nearly never happen'. That
often is true, but when you multiply that probablility with LO being used by
hundreds of millions -> it WILL happen. Just my 2ct...

To the problem: This is an opportunity to do it correct and rotate/shear-
independent. Use linear algebra as it is intended...

We need to compare if the start point of the next charbox (C) (lower left) is
touching the vector starting from the start point of the current charbox (A) to
the lower right of that box (B).
To get (A) we can multiply Point(0.0,0.0) with current matrix
To get (B) we can multiply Point(1.0,0.0) with current matrix
To get (C) we can multiply Point(0.0,0.0) with next matrix

Now we need to check if (C) touches Vector (A,B) and if it does e.g. inside the
right third of it (need a hand-crafted unsharp-value here due to the mentioned
special Scale-role of the FontScale given in the matrices, usually a decent
'guessed' CharWidth is 0.7 of CharHeight)

You can use basegfx::B2DVector/B2DPoint for all that. You may compare length of
vector (A,B) with length of vector (A,C). For parallelism you may use dot
product, or for using the tooling, e.g. use the method that calculates the
angle between these two vectors.

That test should go to a subroutine, will work rotate/shear independent and
even when no transformation is there (due to then having the unit matrix).

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210716/e9ea0f2f/attachment.htm>


More information about the Libreoffice-bugs mailing list