Bug 392064 - New text tool doesn't use the SVG property for RTL text
Summary: New text tool doesn't use the SVG property for RTL text
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tool/Text (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-19 15:21 UTC by Safa Alfulaij
Modified: 2023-07-19 12:19 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Krita displaying Arabic text and the exclamation mark is on the right instead of left (45.14 KB, image/png)
2018-03-19 15:21 UTC, Safa Alfulaij
Details
Krita displaying Arabic and English texts, and the exclamation mark is on the right side of the Arabic sentence instead of left (51.87 KB, image/png)
2018-03-19 15:22 UTC, Safa Alfulaij
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Safa Alfulaij 2018-03-19 15:21:07 UTC
Created attachment 111507 [details]
Krita displaying Arabic text and the exclamation mark is on the right instead of left

This was reported[1] first in Phabricator.

I was testing one of the last nightly (or beta) builds and found out that the direction of Arabic text is LTR. The special SVG "direction"[2] property is needed for the direction to be applied.

Sample text used (Don't care about the wrongness in the web browsers, they can't handle both directions):
كريتا هو برنامج للرسم الرقمي!
Krita is a digital painting tool!


1: https://phabricator.kde.org/T8198
2: https://svgwg.org/svg2-draft/text.html#DirectionProperty
Comment 1 Safa Alfulaij 2018-03-19 15:22:39 UTC
Created attachment 111508 [details]
Krita displaying Arabic and English texts, and the exclamation mark is on the right side of the Arabic sentence instead of left
Comment 2 wolthera 2018-03-19 15:25:35 UTC
Thanks for reporting. I suspect the property just isn't converted at all when doing from qdocument to svg.
Comment 3 Halla Rempt 2018-03-20 07:11:57 UTC
Dmitry, can you take a look?
Comment 4 Dmitry Kazakov 2018-03-21 19:27:24 UTC
Git commit a7c8affee3437ea80c27ec6f3670044ce788b250 by Dmitry Kazakov.
Committed on 21/03/2018 at 19:27.
Pushed by dkazakov into branch 'master'.

Implement automatic 'rtl' tag for arabic text pasted in the text editor

Thanks samirosman for his consultations on the topic
of Arabic languages! :)

M  +26   -2    libs/flake/text/KoSvgTextShapeMarkupConverter.cpp

https://commits.kde.org/krita/a7c8affee3437ea80c27ec6f3670044ce788b250
Comment 5 Safa Alfulaij 2018-03-21 19:48:55 UTC
Thanks a lot Dmitry!

I was wondering why we don't use just http://doc.qt.io/qt-5/qstring.html#isRightToLeft...

Or even http://doc.qt.io/qt-5/qtextblock.html#textDirection :)
Comment 6 Halla Rempt 2018-04-03 11:22:18 UTC
Git commit a3ca8183306a6436dbfb6d622c6f65241bb7cf39 by Boudewijn Rempt, on behalf of Dmitry Kazakov.
Committed on 03/04/2018 at 11:15.
Pushed by rempt into branch 'krita/4.0'.

Implement automatic 'rtl' tag for arabic text pasted in the text editor

Thanks samirosman for his consultations on the topic
of Arabic languages! :)
(cherry picked from commit a7c8affee3437ea80c27ec6f3670044ce788b250)

M  +26   -2    libs/flake/text/KoSvgTextShapeMarkupConverter.cpp

https://commits.kde.org/krita/a3ca8183306a6436dbfb6d622c6f65241bb7cf39
Comment 7 Safa Alfulaij 2018-04-03 11:26:38 UTC
I'm still wondering about why not using the direction detect function of QString/QTextBlock, by the way :)
Comment 8 Bug Janitor Service 2023-07-19 09:25:06 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1859
Comment 9 Alvin Wong 2023-07-19 12:19:28 UTC
Git commit 40c638f2ca312a50186698b65622a17579db7b54 by Alvin Wong.
Committed on 19/07/2023 at 09:20.
Pushed by dkazakov into branch 'master'.

flake: Use more reliable way to check RTL from QTextDoc

Use the text direction given by QTextBlock directly instead of
reinventing the RTL detection. The old check is still kept as a backup,
but probably won't be called.

M  +35   -19   libs/flake/text/KoSvgTextShapeMarkupConverter.cpp

https://invent.kde.org/graphics/krita/-/commit/40c638f2ca312a50186698b65622a17579db7b54