Arabic right to left text pre Delphi 4

I am doing this with D4 but D3 is similar.

1. Put main menu on form. Set OWNERDRAW to True
2. Put each menu item on form and set two events for each of them
   OnMeasureItem and OnDrawItem event.

   Make sure the every Menuitem you do hooks to these same two events
   (I called mine MeasureItems and DrawItems)

3. Code the two events as follows:

procedure TForm1.MeasureItems(Sender: TObject; ACanvas: TCanvas; var
Width,
  Height: Integer);
begin
  Height := ACanvas.TextHeight(TMenuItem(Sender).Caption);
  Width := ACanvas.TextWidth(TMenuItem(Sender).Caption);
end;

procedure TForm1.DrawItems(Sender: TObject; ACanvas: TCanvas; ARect:
TRect;
  Selected: Boolean);
begin
  SetTextAlign(ACanvas.Handle, TA_RIGHT or TA_TOP);
  TextOut(ACanvas.Handle, ARect.Right, ARect.Top,
          PChar(TMenuItem(Sender).Caption),
          Length(TMenuItem(Sender).Caption));
end;

For Windows95 there is also a TA_RTLREADING which is for Arabic and Hebrew
type languages.

Also in D4 there is a new property on TControl called BiDiMode, it can
probably be used instead. I don't read RTL nor do I have a computer set up
that way so I can't test it.