Forum > Win32/64

[solved] Right-to-left reading direction under Windows XP

(1/5) > >>

I struggle with RTL under Windows XP. My problem is similar to and the related bug report So I updated via svn and run the submitted program (actually, I'm not able to read Arab letter).
Linux shows in both flavors Qt and Gtk2 the expected RTL output but Windows XP doesn't. Surprisingly the Windows app started from Linux via wine works as expected. And when I compile and run under W7 it works too. What can I do?

Lazarus 1.3 r43599M FPC 2.6.2 x86_64-linux-qt (@Windows fpc 2.6.2 and LCL from todays svn)

Can somebody confirm this issue?

Sample project is attached.

Best is, if you attach a small (minimum) sample project to demonstrate the problem.

Then you have a better chance, that someone will test it.

Right now, I do not even know what component, or function you used for output.

I use the same code as in the linked posts/bugreport but not only with Qt as originally reported but with Windows XP. It's a simple DrawText() on a TCanvas; in my program it's wrong for MessageDlg() too.

It is still a lot of work, and a lot of extra to read...
copy and paste it together, find the correct units to use (assuming you use the same (drawtext from LclIntf?)

Most none RTL users will not bother, even though they could test.

--- anyway I did test, on win vista 32 bit. (with and without manifest)
Someone still needs to test xp

--- Code: ---procedure TForm1.Button1Click(Sender: TObject);
var  s: String;
  R: TRect;
  MessageDlg('% ,خطأ نسبي', '% ,خطأ نسبي', mtInformation, mbYesNo, 0);

s:='% ,خطأ نسبي';
r.Top := 40;
r.Left := 30;
r.Bottom := 88;
r.Right := 222;

  DrawText(Form1.Canvas.Handle, PChar(s), Length(s), R, DT_WORDBREAK);

--- End code ---

Note, the editor will display the messagedialog line in an unexpected way. The ', ' is between 2 RTL sections. The chars are have a weak leading, and will be taken an RTL too, meaning they read in the wrong direction.
However the first '% bound to the LTR text before so the % stays at the beginning.

Test results:
The words are displayed correct, but the % is at the left side not the end. I guess this is because my system is LTR.

For drawtext I can do:

--- Code: ---  DrawText(Form1.Canvas.Handle, PChar(s), Length(s), R, DT_WORDBREAK + DT_RTLREADING);

--- End code ---
And I get the correct words, and the % is on the right side


[0] Message Index

[#] Next page

Go to full version