Why DrawText output is different on Bitmap.Canvas and Form.Canvas? lazarus / 39-Graphics ---------------------------------------------------------------------- Yurii · 2013-04-27 09:17 Why DrawText output is different on Bitmap.Canvas and Form.Canvas for strings which combine arabic and other symbols? (See attachment) What can I do to fix that? ...   DrawText(Form1.Canvas.Handle, PChar(s), Length(s), R, DT_WORDBREAK);   DrawText(Bitmap.Canvas.Handle, PChar(s), Length(s), R, DT_WORDBREAK);   Form1.Canvas.Draw (10, 40, Bitmap); ... ---------------------------------------------------------------------- Blaazen · 2013-04-27 09:59 So this is about Themes and Qt4, yes? I'm not sure, I don't use RightToLeft and I cannot test. I guess Canvas.TextStyle can affect it. Try: Code: [Select]with Bitmap.Canvas.TextStyle do RightToLeft:=True; EDIT: Better (cross-platform) solution: Code: [Select]with Bitmap.Canvas.TextStyle do RightToLeft:=Application.IsRightToLeft; ---------------------------------------------------------------------- Yurii · 2013-04-27 15:17 Using Canvas.TextStyle is the same as using DT_RTLREADING flag. Code: [Select]DrawText(Form1.Canvas.Handle, PChar(s), Length(s), R, DT_WORDBREAK or DT_RTLREADING);   DrawText(Bitmap.Canvas.Handle, PChar(s), Length(s), R, DT_WORDBREAK or DT_RTLREADING); Both don't change anything. ---------------------------------------------------------------------- Blaazen · 2013-04-27 16:09 Sorry, the code above does not work (it is packed record). Try this: Code: [Select]var aTS: TTextStyle; begin   aTS.RightToLeft:=True;   Canvas.TextStyle:=aTS; ---------------------------------------------------------------------- Yurii · 2013-04-27 16:51 Nothing changed again. In Windows many strings  like this ':مایع تحقیق' are shown in a proper way, but not this Code: [Select]s := '% ,خطأ نسبي'; Strings like this 'Pa ,تنش' are shown in a proper way both in Linux and Windows. When I faced this problem for the first time I prepared two Persian language files for Linux and for Windows. But in Linux I couldn't use the same strings for translation data input forms and result presentation. I think that creation of different strings for this purpos is not right. ---------------------------------------------------------------------- zeljko · 2013-06-14 10:38 Quote from: Yurii on April 27, 2013, 11:17:24 amWhy DrawText output is different on Bitmap.Canvas and Form.Canvas for strings which combine arabic and other symbols? (See attachment) What can I do to fix that? ...   DrawText(Form1.Canvas.Handle, PChar(s), Length(s), R, DT_WORDBREAK);   DrawText(Bitmap.Canvas.Handle, PChar(s), Length(s), R, DT_WORDBREAK);   Form1.Canvas.Draw (10, 40, Bitmap); ... http://bugs.freepascal.org/view.php?id=24340  and issue is resolved. Note that it'll work correct only with Qt libs >= 4.7 (I've tested with qt 4.7.4 and 4.8.3(4))