limelect 51 Posted March 22 (edited) I am trying to understand my problem with reverse HEBREW TEXT. I have 3 rich edit components and a memo for testing. RichEdit1, jvRichEdit, and AdvRichEditor jvRichEdit and AdvRichEditor reverse my string(my Hebrew name) The source is a Richedit file. procedure TForm1.BitBtn2Click(Sender: TObject); var s: TStringList; begin s := TStringList.Create; OpenDialog1.Filter := 'RTF files (*.rtf)|*.rtf|Any files (*.*)|*.*'; if OpenDialog1.Execute then begin AdvRichEditor1.Clear; RichEdit1.Clear; jvRichEdit1.Clear; RichEdit1.Lines.LoadFromFile(OpenDialog1.FileName); jvRichEdit1.Lines.LoadFromFile(OpenDialog1.FileName); s.LoadFromFile(OpenDialog1.FileName); Memo1.Clear; memo1.Text := RtfToText(s.Text, true); <<<< procedure from the Internet AdvRichEditor1.InsertText(0, memo1.Text); <<<<< Inserting memo text to ADVrich is OK AdvRichEditor1.Repaint; AdvRichEditorRTFIO1.Load(OpenDialog1.FileName); <<<<< reverse Hebrew string s.Free; end; end; My main rich is AdvRichEditor. P.S My final file contains pictures too Unless I have to go into the sources any solution? Untitled_1.bmp Edited March 22 by limelect Share this post Link to post
PeterBelow 250 Posted March 22 (edited) Is the BiDiMode property set to true on all controls in question? Also look at the methods in the see also section at the bottom of the page linked to for BiDiMode, may be important if you test on a non-hebrew locale. Edited March 22 by PeterBelow Share this post Link to post
limelect 51 Posted March 22 (edited) @PeterBelowd10.2.3 on AdvRichEditor1 which I am using there is NO BidiMode Bidi Mode on jvRichEdit does not help it only moves to the right but not revers Edited March 22 by limelect Share this post Link to post
limelect 51 Posted March 22 Let's stay on 2 components. RichEdit1.Lines.LoadFromFile(OpenDialog1.FileName); <<<<< Hebrew Text OK jvRichEdit1.Lines.LoadFromFile(OpenDialog1.FileName); <<<< Hebrew text reverse Any Idea? Share this post Link to post
limelect 51 Posted March 22 (edited) Ok some research this is rtf string {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil Segoe UI;}}{\colortbl \red0\green0\blue0;}\viewkind4\uc1\f0\cf0\f0\fs20 \u1513G\u1500G\u1502G\u1492G\par abcd\par} On the screen my name is OK but in the rtf saving is backward Underneath there is abcd 2 lines of text 1513 is my first Unicode letter of my name. On the screen, it is the fourth charter What is going on? and finally, if I write English Hebrew English text it still revers the Hebrew {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil Segoe UI;}}{\colortbl \red0\green0\blue0;}\viewkind4\uc1\f0\cf0\f0\fs20 abcd \u1513G\u1500G\u1502G\u1492G cdef\par} Edited March 22 by limelect Share this post Link to post
PeterBelow 250 Posted March 22 Microsoft has released several versions of the richedit control over the decades, TRichedit in the current Delphi version (since 11.0 if memory serves) is based on version 4 (the latest and most feature-rich). The Jedi version may be based on an older version. The divers versions are implemented in separate DLLs with different names and use different window class names, so they can coexist on a given Windows system. Different versions may explain the behaviour you see. Share this post Link to post
limelect 51 Posted March 22 @PeterBelow I am deep in understanding the reverse of text in TAdvRichEditorBase.GetContentAsRTF(UseSelection: boolean): string; P.s the text comes OK to this point Share this post Link to post
limelect 51 Posted March 22 @peterbelow I hope I fixed it on this procedure TRTFEngine.AddInternal(S: String; KWCode: Integer); for i := 1 to length(S) do begin ch := CharInStr(S,i); {$IFNDEF LCLLIB} if ord(ch) > 127 then {$ENDIF} {$IFDEF LCLLIB} if ch > #127 then {$ENDIF} //shlomo enc := enc + '\u' + IntToStr(ord(ch))+ 'G' <<<<< the original enc := '\u' + IntToStr(ord(ch))+ 'G'+enc <<< I changed the order else enc := enc + ch; end; But this is good ONLY for HEBREW obviously other languages are different problems. The saving was the problem Share this post Link to post
limelect 51 Posted March 22 (edited) @peterbelow I had to fix the same problem for PDF ALSO ONLY FOR HEBREW The only problem on the same line ONLY the same language function TAdvPDFGraphicsLibOutputWriter.ConvertStringToHex(AValue: UnicodeString): String; var I: integer; v: Integer; idx: integer; begin Result := ''; {$IFDEF DELPHI_LLVM} for I := 0 to Length(AValue) - 1 do {$ENDIF} {$IFNDEF DELPHI_LLVM} for I := 1 to Length(AValue) do {$ENDIF} begin v := Ord(AValue); if (v >= 32) then begin if not FontCharArrayContainsValue(v) then FontCharArrayAddValue(v); idx := FontCharArray.IndexOf(v); if idx > -1 then //shlomo Result := Result + AddHex4(FontCharWidths[idx].g);<< original Result := AddHex4(FontCharWidths[idx].g)+Result ;change for Hebrew end; end; end; Edited March 22 by limelect Share this post Link to post
dwrbudr 8 Posted March 23 AdvRichEditor is VERY buggy. We use it in our program and already fixed 50+ issues reported by users. As always TMS rushes to release something that is not even an alpha version. We plan to switch to TRichView at some point. Share this post Link to post
limelect 51 Posted March 23 (edited) @dwrbudr This is the demo of TRichView with mixed Hebrew and English but the PDF is PDF24 But as I wanted the PDF to be built within I used AdvRichEditor maybe I will consider it too P.S. I suspect one can take PDF basic of AdvRichEditor and use it for TRichView Edited March 23 by limelect Share this post Link to post
JonRobertson 81 Posted April 16 On 3/23/2025 at 4:56 AM, dwrbudr said: AdvRichEditor is VERY buggy. We use it in our program and already fixed 50+ issues reported by users. As always TMS rushes to release something that is not even an alpha version. We plan to switch to TRichView at some point. TRichView was an excellent control when I started using it 15 years ago. I would absolutely use it again if I needed a powerful WYSIWYG editor. I had the same experience with TMS components, although I never used AdvRichEditor. 1 Share this post Link to post