I guess that repainting is done in the ancesstor class?
I installed FortesReportCE and had a look at TRLCustomMemo. It does not have its own Paint method, but its ancestor, TRLCustomMultiLine, has. This Paint method calls a "MemoDraw" which is a stand-alone procedure (not a method). It does not get any BiDi-related parameter which makes me suspect that this library is not prepared for BiDi at all. But maybe we are lucky and it is sufficient to mirror the Alignment parameter:
procedure TRLCustomMultiLine.Paint;
var
R: TRect;
S: string;
P: TRLCustomReport;
algnmt: TRLTextAlignment;
begin
inherited;
S := Caption;
if (S = '') and not IsPreparing then
S := Name;
R := GetClientRect;
with Canvas do
begin
Font := Self.Font;
if IsTransparent(Self) then
Brush.Style := bsClear
else
begin
Brush.Style := bsSolid;
Brush.Color := Self.Color;
end;
if Alignment = taLeftJustify then // <---- wp: added ....
algnmnt := taRightJustify
else if Alignment = taRightJustify then
algnmnt := taLeftJustify
else
algnmnt := Alignment; // --------------->
MemoDraw(S, Self.Canvas, algmnt, R, Self.WordWrap); // <--- wp: Replace Self.Alignment by algnment
end;
P := FindParentReport;
if not Assigned(P) or P.ShowDesigners then
DrawBounds;
end;
But I fear this is not all because the LCL Canvas must be told to draw text from right to left. I think this is what Canvas.TextStyle.RightToLeft is good for. Unfortunately Canvas.TextStyle is ignored when the text is written by Canvas.TextOut (Canvas.TextRect is ok). Following the chain of function calls leads to CanvasTextRectEx where
procedure CanvasTextRectEx(ACanvas: TCanvas; const ARect: TRect; AX, AY: Integer; const AText: String; AAlignment: TRLMetaTextAlignment; ALayout: TRLMetaTextLayout; ATextFlags: TRLMetaTextFlags);
[...]
if (ATextFlags and MetaTextFlagAutoSize) = MetaTextFlagAutoSize then
ACanvas.TextOut(left, top, buff)
else
ACanvas.TextRect(ARect, left, top, buff);
end;
i.e. you must replace the TextOut call here by a TextRect call.
There are certainly several more of these traps.
Since TextStyle is a LCL-only property such changes will break the library for usage in Delphi.
None of the information given here has been tested, it even may be complete nonsense... Make a backup copy of the original files before making any changes so that you can restore the initial state in case something goes wrong badly.