Preventing reordering and realignment of LTR Text
-
Hallo,
When dealing with bidirectional Text (i.e. mixed LTR/RTR) Text I found the following.
-
I implement Text alignment with the code found "here":http://www.cesarbs.org/blog/2011/05/30/aligning-text-in-qgraphicstextitem/ but the QGraphicsTextItem inverts the the meaning of Left and Right Alignment when displaying e.g. a Hebrew paragraph. Is there a way to force left/right alignment independent of what the curent LTR/RTL status of the current paragraph is ?
-
Qt implements its own Bidi reordering algorithm. Since the output of our program is intended@@ to be handled by another one which uses the "fribidi":http://www.fribidi.org/ implementation I would like to disable reordering altogether and and do the logical=>visual mapping myself. Is there a way to achieve this ?
Thank you very much....
O.
-
-
To disable the direction switch you must set your application to do so by using "QApplication::setLayoutDirection()":http://qt-project.org/doc/qt-5.0/qtgui/qguiapplication.html#layoutDirection-prop which sets the direction.
Basically, upon the application start, you just call setLayoutDirection() with a Qt::LeftToRight or Qt::RightToLeft parameter, and it will set the application to use this direction no matter what the user native language is.
I'm not sure what Bidi and fribidi is but I guess it's related to the direction of objects in the application or something; by Using setLayoutDirection you're actually blocking any object and text direction switch, so I guess you're good to go with any custom ordering algorithm you want. -
QApplication::setLayoutDirection doesn't seem to have any effect on QGraphicsTextItem elements. Perhaps because it's not a QWidget subtype