(Delphi XE4 / Win 7)
The TRichEdit component behaves strangely when both Western and Asian characters are to be displayed. Demo program (form, listbox, richedit with default setting from Object Inspector; Asian chars copied from a japanese website):
unit Unit1;
interface
uses
System.Classes, Vcl.Forms, Vcl.StdCtrls, Vcl.ComCtrls, Vcl.Controls;
type
TForm1 = class(TForm)
RichEdit1: TRichEdit;
ListBox1: TListBox;
procedure FormCreate(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
const
arText: array[0..4] of string
= ('00 AbC DEfgH 查找的资 AbC DEfgH 查找的资',
'01 前大 ABCabc 為島 ABCabc 或繩 ABCabc',
'02 AbC DEfgH 繩最 ABCabc',
'03 ABCabc 全面積 ABCabc 全面積 ABCabc',
'04 方公里 AbC DEfgH 方公里');
procedure TForm1.FormCreate(Sender: TObject);
var
i: Integer;
begin
for i:=0 to 4 do
begin
ListBox1.Items.Add(arText[i]);
RichEdit1.Lines.Add(arText[i]);
end;
end;
end.
Demo running:
In the listbox all Western characters have the correct and same size. In the richedit, however, Western chars are only displayed correctly if there are no Asian chars in front of them. Otherwise, all following western chars are displayed with a reduced size.
Note: If you edit the text while the program is running, inserted Western characters will be displayed with the correct size - regardless of the position where they are inserted (inserted characters marked red):
Is there a way to correctly display the text from Western and Asian letters in a richedit? What needs to be done to make it work? Thanks in advance for any help!