following
https://wiki.freepascal.org/fcl-image the fontdraw example works as expected.When I changed the text string to
const
text_str='Hello world!'+
'こんにちは世界!'+
'你好世界!' +
'नमस्ते दुनिया!'+
'👋 🌎 !';
Remarks: the last three character of the above string is 👋🌎! but I don't know why the webpage shows like that.
the output png file shows garbled characters after "Hello world!".Please see below screen shot.
【Edit】I have already set {$codepage utf8} and also add lazutf8 unit to the project.
But when I tried TPicture,the saving png file shows proper characters.
Image := TPicture.Create();
Image.PNG.SetSize(1024, 256);
with Image.PNG.Canvas do begin
Brush.Color := TColor($F7F4F0);
Brush.Style := bsSolid;
FillRect(0, 0, Image.Width, Image.Height);
Font.Color := clTeal;
Font.Name := 'DejaVuSans';
Font.Height :=20;
TextOut(16, 96, Text);
end;
// Save & destroy image
Image.SaveToFile('test.png');
Image.Free();
So was I missing somthing?