The address book sample displays Arabic characters messed up, like that س ا ش ص
. I tried to change the font of the text item to "Arial" or "Courier New", but the result is the same. Is there a way to display non-English characters correctly in TListView
?
Loading contacts code:
procedure TForm1.FillContactList(Source: TAddressBookSource);
var
I: Integer;
Contacts: TAddressBookContacts;
begin
Contacts := TAddressBookContacts.Create;
try
AddressBook1.AllContacts(Source, Contacts);
ListViewContacts.BeginUpdate;
try
ListViewContacts.Items.Clear;
for I := 0 to Contacts.Count - 1 do
AddListViewItem(Contacts.Items[I]);
finally
ListViewContacts.EndUpdate;
end;
finally
Contacts.Free;
end;
end;
procedure TForm1.AddListViewItem(Contact: TAddressBookContact);
var
ListViewItem: TListViewItem;
begin
ListViewItem := ListViewContacts.Items.Add;
ListViewItem.Text := Contact.DisplayName;
ListViewItem.Tag := Contact.ID;
end;
Skia indeed solved the problem. More Details:
https://github.com/skia4delphi/skia4delphi#right-to-left
Right-to-Left
Using Skia's Canvas, your application will now support Right-To-Left text rendering. But for that you will need to make 3 changes to your project:
Open the source of your Delphi Application Project (.dpr), include the line Application.BiDiMode := TBiDiMode.bdRightToLeft;, like below:
program Project1;
uses
System.StartUpCopy,
FMX.Forms,
System.Classes,
Skia.FMX,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.BiDiMode := TBiDiMode.bdRightToLeft;
GlobalUseSkia := True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
Set the property BiDiMode of your forms to bdRightToLeft;
Keyboard input controls like TEdit and TMemo, need to be fixed by Embarcadero, meanwhile, as a workaround, set the ControlType property of these controls to Platform.