John Kouraklis 94 Posted October 3, 2019 Does anyone have experience with RTL languages in Delphi FMX? I've seen FMXRTL.com but I am unable to download any of the demos and code from that website Share this post Link to post
limelect 48 Posted October 3, 2019 (edited) @John Kouraklis I had very bad experience with the demo it did not work. Edited October 3, 2019 by limelect Share this post Link to post
John Kouraklis 94 Posted October 3, 2019 @limelectHave you got the demo to share? Are there any other components/solutions? Share this post Link to post
Maher Tannous 3 Posted October 6, 2019 try this from github https://github.com/Zeus64/alcinoe I don't test it this app https://play.google.com/store/apps/details?id=club.kiskis.app&hl=en was made with it Share this post Link to post
limelect 48 Posted October 7, 2019 @John Kouraklis Sorry It was long ago. I do not know where the demo is. I think i had a BPL specific to Delphi. Share this post Link to post
John Kouraklis 94 Posted October 8, 2019 On 10/6/2019 at 8:48 AM, Maher Tannous said: try this from github https://github.com/Zeus64/alcinoe I don't test it this app https://play.google.com/store/apps/details?id=club.kiskis.app&hl=en was made with it I know Alcione but didn't know it has RTL components. I will check thanks Share this post Link to post
John Kouraklis 94 Posted October 8, 2019 6 hours ago, limelect said: @John Kouraklis Sorry It was long ago. I do not know where the demo is. I think i had a BPL specific to Delphi. No worries. I emailed the owner of the page and the download links work. Thanks anyway Share this post Link to post
limelect 48 Posted October 29, 2019 @John Kouraklis What did you do with the solution ? alcinoe has no solution. Is FMXRTL is the only solution? Share this post Link to post
John Kouraklis 94 Posted October 30, 2019 @limelect I haven't really tried FMXRTL as I did not have the time. But I did some research and couldn't find anything...sadly Share this post Link to post
Rollo62 536 Posted October 30, 2019 There are some quite old suggestions, regarding D.P.F., but I havent test it. Share this post Link to post
Serge_G 87 Posted October 30, 2019 Hi, I don't write nor read RTL languages, I wrote a function to detect if the text starts with a RTL char function checkRtl (S : string; Exceptions : String = '' ) : TTextAlign; var carray : array of WideChar; i : int64; ws : String; begin for I := 0 to 9 do S:=StringReplace(S,i.ToString,'',[rfReplaceAll]); // supprime autres caractères spéciaux S:=StringReplace(S,'(','',[rfReplaceAll]); S:=StringReplace(S,')','',[rfReplaceAll]); S:=StringReplace(S,'"','',[rfReplaceAll]); S:=StringReplace(S,'''','',[rfReplaceAll]); S:=StringReplace(S,'-','',[rfReplaceAll]); if not E.IsEmpty then begin for I := 1 to Length(Exceptions) do S:=StringReplace(S,Exceptions[i],'',[rfReplaceAll]); end; S:=Trim(S); // arabic + hebrew SetLength(carray,$6ff-$590); for I := $590 to $6ff do carray[i-$590]:=Char(I); // there are some farsi char to be added result:=TTextAlign.Trailing; if S.IsEmpty then exit; if inOpArray(S[1],carray) then result:=TTextAlign.Leading; end; And, with Nabil's Help I test my ideas in a grid. You can find (french) discussion here and my tutorial https://serge-girard.developpez.com/tutoriels/Delphi/Livebindings/Grilles/#LVII-C-1 I did not test for TEdit and TLabel though but my guess it is possible 1 2 Share this post Link to post
limelect 48 Posted October 31, 2019 @Serge_G This is for WIN project or IOS (not tested) BUT not for Android. No solution yet. No TStringColumn in Android. Share this post Link to post
limelect 48 Posted October 31, 2019 @John Kouraklis For now RTL is working in Android Studio where i developed a few applications. Delphi FMX Android is good , now a days , only for English. Share this post Link to post
John Kouraklis 94 Posted November 1, 2019 @Serge_G How do you revert the order of the text that appears in the grid? The code you show just changes the justification not the order of the letters Share this post Link to post
Serge_G 87 Posted November 1, 2019 Oh, it seem that was the TTextLayout.RighttoLeft who do the trick but did not work for Android 😣 and I do not know if it works for those Apple things My friend Nabil just send me an intyeresting link 1 Share this post Link to post
Alexander Sviridenkov 356 Posted November 1, 2019 FMX use different methods for text rendering on mobile and desktop platforms. On desktop platforms native OS methods are used (f.e. Direct2D text layout or CGContext) but on mobile platforms text is rendered as bitmap combination - each font symbol is stored in cache as bitmap. This leads to no RTL support, bad kerning, etc and also is slow., This is why I had to write native canvas support for these platforms. 1 1 Share this post Link to post
John Kouraklis 94 Posted November 2, 2019 @Alexander Sviridenkov So, you don't use bitmaps on those platforms? but the native engines? Do your components support then RTL? Share this post Link to post
John Kouraklis 94 Posted November 2, 2019 @Serge_G Thanks for the link. It looks your friend has made it work Share this post Link to post
John Kouraklis 94 Posted November 2, 2019 @Serge_G Digging a bit from the link you added, here's an interesting project https://github.com/orwah/Arabic-Delphi-VCL-Units But it is for VCL only 1 Share this post Link to post
Alexander Sviridenkov 356 Posted November 2, 2019 41 minutes ago, John Kouraklis said: @Alexander Sviridenkov So, you don't use bitmaps on those platforms? but the native engines? Do your components support then RTL? 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. Share this post Link to post
limelect 48 Posted November 2, 2019 (edited) @John Kouraklis It works. I used this link http://arabteam2000-forum.com/applications/core/interface/file/attachment.php?id=159065 1. with Delphi 10.2.3 i used the berlin version 2. My test project is fmx+memo 3. I added THE 3 pas files 4. i added FMX.Canvas.GPU.pas from the Delphi fmx source 5. I added path of Delphi source fmx to my project 6. compiled 7. apk to my samsung s6 phone 8. DID NOT CHANGE NOTHING IN THE SOURCE !!!! 9. AND IT WORKS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 10-. in my case it is HEBREW !! P.S 4 not needed as you have 5 Edited November 2, 2019 by limelect 1 Share this post Link to post
limelect 48 Posted November 2, 2019 @Serge_G Thank you for your help The link in your answer did the TRICK. I had many weeks of search for the answer Share this post Link to post
limelect 48 Posted November 2, 2019 I just put it in my REAL application and it works great. 1 Share this post Link to post
limelect 48 Posted November 2, 2019 Last thought. It is still not perfect solution. As it is not a REAL BIDI. it is specific to Arabic or Hebrew but other languages do not apply. So it cannot be given to the world. Share this post Link to post
limelect 48 Posted November 3, 2019 Further investigating it seem that my last statement (not real BIDI) mite be wrong since if Char > 3000 then if ((Char = 3633) or ((Char >= 3635) and (Char <= 3642)) or ((Char >= 3655) and (Char <= 3662))) then begin if LastThaiChar = 0 then LastThaiChar := 3585; // DoLogInfo(format('Detected new advance from %d + %d',[ FLastThaiChar,char])); // Advance := FPaint.measureText(StringToJString(System.Char.ConvertFromUtf32(3585)+System.Char.ConvertFromUtf32(Char))); if Char = 3635 then // ׂ Advance := FPaint.measureText (StringToJString(System.Char.ConvertFromUtf32(LastThaiChar) + System.Char.ConvertFromUtf32(Char))) - FPaint.measureText (StringToJString(System.Char.ConvertFromUtf32(LastThaiChar))) else Advance := 0; end; if Char >= 3585 then if Char <= 3630 then LastThaiChar := Char; since above section has nothing to do with MY !!! Hebrew fonts. is it useless ???? i do not know. Share this post Link to post