Serge_G 87 Posted November 3, 2019 What about using TTextService ? I just had a (deep) look into Delphi source and found TTextServiceAndroid.DrawSingleLine {$IFDEF ANDROID} if SupportsPlatformService(IFMXTextService,aService) then begin alignement:=CheckRtl(Value.ToString,''); if alignement=TTextAlign.Trailing then flag := [TFillTextFlag.RightToLeft] else flag:=[]; // had to get font aService.DrawSingleLine(Canvas,Value.ToString,Bounds,Afont, 1,flag, alignement); end; {$ENDIF} My only problem is to get the right font though (the one in the style i presume). I don't go further with this for now.. Share this post Link to post
Guest Posted November 4, 2019 Those files/patches looks promising, but they are useless for someone with Delphi Professional or Community, like me !, unless there is a way to patch the dcu files themselves . For Arabic support only Delphi HTML components helped me, yet this forced me to use HTML for most of the UI On 11/2/2019 at 4:08 AM, Alexander Sviridenkov said: Depends on selected canvas, For iOS, Android and OSX there are both native and FMX canvases. RTL is supported internally, library has own BIDI processor because even on native canvases each word is rendered separately, so layout should be prepared before passing to renderer. Would you please post a detailed instructions with a sample code for rendering right-to-left languages on Android and iOS ? this might help many. and please the difference/comparison between available canvases with your components each platform, i am using them for two years and still don't have full details about the real differences ( quality and anti-aliasing, rendering speed, font types ....) I remember trying to benchmark and find if there is performance increase/decrease based on the font used ( ttf or otf ) in rendering huge page, i can't recall the result now 😞 Share this post Link to post
Alexander Sviridenkov 356 Posted November 4, 2019 OK, several samples. FMX form with HtPanel on left and standard memo on right. Windows, standard FMX canvas: Here kerning pairs are correct on both sides and arabic letters are connected as it should and have correct order because FMX canvas use windows Direct2D layout for rendering. But word order in sentense with mixed english/arabic text is incorrect on right side and correct on left, because in HtPanel text is prepared by internal BiDi processor. Android, standard FMX canvas: On mobile platforms FMX output each letter as single bitmap. So kerning pairs are not processed and arabic letters are not connected. Word and letter order is correct on left side because of internal BiDi processor, but still no kerning and letter connectors. Android, native Android canvas: Kerning and letter connectors are correct. There is also another issue with FMX canvas ion mobiles. Here is the same form with scaling set to 10x for both components. FMX use bitmap scaling instead of preparing bitmaps for each font size. This leads to visual artefacts and blurred text. 1 Share this post Link to post
Guest Posted November 4, 2019 @Alexander Sviridenkov Thank you very much. Share this post Link to post
limelect 48 Posted November 6, 2019 (edited) @Alexander SviridenkovI cannot comment on what you wrote since Arabic is not my native lang. But in my case i used the source i shown before and it works even for mixing Hebrew and English. Can you elaborate on the problem in your case showing very simple text here. I using memo and 10.2.3 Edited November 6, 2019 by limelect Share this post Link to post
Alexander Sviridenkov 356 Posted November 6, 2019 @limelect try to display the following text in Android Student: How do you write "What's your name?" in Arabic? Teacher: ما اسمك؟ Student: Thanks. Teacher: That's written "شكرًا". Teacher: Do you know how to write "Please"? Student: "من فضلك", right? Share this post Link to post
limelect 48 Posted November 7, 2019 @Alexander SviridenkovI do not have Arabic on my keyboard And i do not know the Alpha. How ever in Hebrew i can mix with English with no problem Have a look at the top right corner on the memo I have abcdeשלמהfgh "שלמה" is my name in Hebrew The mix is OK!!! Share this post Link to post
Alexander Sviridenkov 356 Posted November 7, 2019 @limelect AFAIK Hebrew doesn't have special connectors between letters so can be correctly rendered using separate symbols, but Arabic - can't. 1 Share this post Link to post
limelect 48 Posted November 7, 2019 @Alexander Sviridenkov Then is this guy wrong ? https://serge-girard.developpez.com/tutoriels/Delphi/Livebindings/Grilles/#LVII-C-1 Share this post Link to post
Alexander Sviridenkov 356 Posted November 7, 2019 @limelectdepends on platform, this will work on Windows and (probably) OSX but not on mibiles. Share this post Link to post
Serge_G 87 Posted November 8, 2019 14 hours ago, limelect said: @Alexander Sviridenkov Then is this guy wrong ? https://serge-girard.developpez.com/tutoriels/Delphi/Livebindings/Grilles/#LVII-C-1 Yes, I only check for windows not for other platforms. I think Interface IFMXTextService and DrawSingleLine is a track to follow, but I am blocked with this Font argument (needed to be retrieve in style ?) 1 Share this post Link to post
Maher Tannous 3 Posted November 18, 2019 OK what is the best solution now ? Share this post Link to post
limelect 48 Posted November 19, 2019 (edited) @Maher Tannous For Hebrew I am using the above solution. It works great. changing those 3 files FMX.TextLayout.GPU, FMX.FontGlyphs and FMX.FontGlyphs.Android. Since i do not know Arabic i cannot check for it. What i will do in the future add Arabic K.B and see the connection of characters. May be some one around me will help with this. Further on my project see a new problem Edited November 19, 2019 by limelect Share this post Link to post