Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7171863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:29:55+00:00 2026-05-28T15:29:55+00:00

As you know many ui components and dev tools doesn’t support rtl , we

  • 0

As you know many ui components and dev tools doesn’t support rtl , we can call it flipping text , cause result is same example :

LTR

سلام salam متن راهنما word

RTL

word متن راهنما salam  سلام

is there anyway to convert this LTR to RTL , i don’t have any idea and language doesn’t matter

Actually i am seeking for a solution to get this done in RAD Studio Firemonkey Application , as you may know firemonkey apps doesn’t support rtl it’s in roadmap of rad studio but not implemented yet

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T15:29:56+00:00Added an answer on May 28, 2026 at 3:29 pm

    Under Windows, you can do that via the UniScribe API.

    I’ve used this to convert Unicode text into set of glyphs, for our Open Source PDF writer.

    You have source code sample in SynPdf.pas unit. See the TPdfWrite.AddUnicodeHexTextUniScribe method:

    function TPdfWrite.AddUnicodeHexTextUniScribe(PW: PWideChar;
      WinAnsiTTF: TPdfFontTrueType; NextLine: boolean; Canvas: TPdfCanvas): boolean;
    var L, i,j: integer;
        res: HRESULT;
        max, count, numSp: integer;
        Sp: PScriptPropertiesArray;
        W: PWideChar;
        items: array of TScriptItem;
        level: array of byte;
        VisualToLogical: array of integer;
        psc: pointer; // opaque Uniscribe font metric cache
        complex,R2L: boolean;
        complexs: array of byte;
        glyphs: array of TScriptVisAttr;
        glyphsCount: integer;
        OutGlyphs, LogClust: array of word;
    procedure Append(i: Integer);
    // local procedure used to add glyphs from items[i] to the PDF content stream
    var L: integer;
        W: PWideChar;
    procedure DefaultAppend;
    var tmpU: array of WideChar;
    begin
      SetLength(tmpU,L+1); // we need the text to be ending with #0
      move(W^,tmpU[0],L*2);
      AddUnicodeHexTextNoUniScribe(pointer(tmpU),WinAnsiTTF,false,Canvas);
    end;
    begin
      L := items[i+1].iCharPos-items[i].iCharPos; // length of this shapeable item
      if L=0 then
        exit; // nothing to append
      W := PW+items[i].iCharPos;
      if not GetBit(complexs[0],i) then begin
        // not complex items are rendered as fast as possible
        DefaultAppend;
        exit;
      end;
      res := ScriptShape(0,psc,W,L,max,@items[i].a,
        pointer(OutGlyphs),pointer(LogClust),pointer(glyphs),glyphsCount);
      case res of
        E_OUTOFMEMORY: begin // max was not big enough (should never happen)
          DefaultAppend;
          exit;
        end;
        E_PENDING, USP_E_SCRIPT_NOT_IN_FONT: begin // need HDC and a selected font object
          res := ScriptShape(Canvas.FDoc.GetDCWithFont(WinAnsiTTF),
            psc,W,L,max,@items[i].a,
            pointer(OutGlyphs),pointer(LogClust),pointer(glyphs),glyphsCount);
          if res<>0 then begin // we won't change font if necessary, sorry
            // we shall implement the complex technic as stated by
            // http://msdn.microsoft.com/en-us/library/dd374105(v=VS.85).aspx
            DefaultAppend;
            exit;
          end;
        end;
        0: ; // success -> will add glyphs just below
        else exit;
      end;
      // add glyphs to the PDF content
      // (NextLine has already been handled: not needed here)
      AddGlyphs(pointer(OutGlyphs),glyphsCount,Canvas);
    end;
    begin
      result := false; // on UniScribe error, handle as Unicode
      // 1. Breaks a Unicode string into individually shapeable items
      L := StrLenW(PW)+1; // include last #0
      max := L+2; // should be big enough
      SetLength(items,max);
      count := 0;
      if ScriptItemize(PW,L,max,nil,nil,pointer(items),count)<>0 then
        exit; // error trying processing Glyph Shaping -> fast return
      // 2. guess if requiring glyph shaping or layout
      SetLength(complexs,(count shr 3)+1);
      ScriptGetProperties(sP,numSp);
      complex := false;
      R2L := false;
      for i := 0 to Count-2 do // don't need Count-1 = Terminator
        if fComplex in sP^[items[i].a.eScript and (1 shl 10-1)]^.fFlags then begin
          complex := true;
          SetBit(complexs[0],i);
        end else
          if fRTL in items[i].a.fFlags then
            R2L := true;
      if not complex then begin
        // no glyph shaping -> fast append as normal Unicode Text
        if R2L then begin
          // handle Right To Left but not Complex text
          W := pointer(items); // there is enough temp space in items[]
          W[L] := #0;
          dec(L);
          for i := 0 to L do
            W[i] := PW[L-i];
          AddUnicodeHexTextNoUniScribe(W,WinAnsiTTF,NextLine,Canvas);
          result := true; // mark handled here
        end;
        exit;
      end;
      // 3. get Visual Order, i.e. how to render the content from left to right
      SetLength(level,count);
      for i := 0 to Count-1 do
        level[i] := items[i].a.s.uBidiLevel;
      SetLength(VisualToLogical,count);
      if ScriptLayout(Count,pointer(level),pointer(VisualToLogical),nil)<>0 then
        exit;
      // 4. now we have enough information to start drawing
      result := true;
      if NextLine then
        Canvas.MoveToNextLine; // manual NextLine handling
      // 5. add glyphs for all shapeable items
      max := (L*3)shr 1+32; // should be big enough - allocate only once
      SetLength(glyphs,max);
      SetLength(OutGlyphs,max);
      SetLength(LogClust,max);
      psc := nil; // cached for the same character style used
      if Canvas.RightToLeftText then
        // append from right to left visual order
        for j := Count-2 downto 0 do // Count-2: ignore last ending item
          Append(VisualToLogical[j]) else
        // append from left to right visual order
        for j := 0 to Count-2 do // Count-2: ignore last ending item
          Append(VisualToLogical[j]);
    end;
    

    Of course, this is under Windows only. So it won’t work on Mac OS X. You’ll have to use another library under Mac OS X…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know of many utilities that can tell me the bitrate of an MP3
Does anyone know how many options a drop down list can have? Is it
I know many people who use computers every day, who do not know how
I know many:many isn't supported in Linq2Sql but I am working on a workaround
I would like to know many minutes between 2 dates? Example : Now -
I use VIM editor for PHP, i know many people will point to PDT
Does any Common Lisp (builtin) function return more than 2 values? I know many
As many of us know (and many, many more don't), C++ is currently undergoing
In order to know how many times a pattern exists in current buffer, I
I want to know how many users are connected to the IIS web server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.