Jump to content
John Kouraklis

Right To Left Components

Recommended Posts

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

try this from github


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
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


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;
   for I := 0 to 9 do
  // supprime autres caractères spéciaux
   if not E.IsEmpty then
        for I := 1 to Length(Exceptions) do

   // arabic + hebrew
   for I := $590 to $6ff do carray[i-$590]:=Char(I);
   // there are some farsi char to be added 
   if S.IsEmpty then exit;
   if inOpArray(S[1],carray) then result:=TTextAlign.Leading;

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


  • Like 1
  • Thanks 1

Share this post

Link to post

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


  • Like 1

Share this post

Link to post

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.

  • Sad 1

Share this post

Link to post
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

@John Kouraklis It works.

I used this link



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


9. AND IT WORKS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

10-. in my case it is HEBREW !!


P.S 4 not needed as you have 5

Edited by limelect
  • Like 1

Share this post

Link to post

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

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
        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))) -

          Advance := 0;


    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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now