How to use Chinese correctly in FPPDF?
The Chinese font 'simfang.ttf' is also in this directory('C:\Windows\Fonts\').
Why is the PDF still garbled when I load the name 'Fangsong' of the Chinese font 'simfang.ttf'? How to load Chinese fonts correctly here?
See attachment for detailed routines. Thank you very much.
g := TFPFontCacheList.Create;
g.SearchPath.Add('C:\Windows\Fonts\'); { 'simfang.ttf','Fangsong' The Chinese font 'simfang.ttf' is also in this directory, }
g.BuildFontCache;
//doc properties
d := TPDFDocument.Create(nil);
d.Options := [poCompressText, poCompressImages, poUseRawJPEG, poNoEmbeddedFonts, poPageOriginAtTop];
d.Infos.Title := 'sample pdf';
d.Infos.Author := 'me';
d.Infos.Producer := 'lazarus';
d.Infos.ApplicationName := 'test';
d.Infos.CreationDate := Now;
d.StartDocument;
s := d.Sections.AddSection;
f := g.Find('fangsong', False, False); {Why is the PDF still garbled when I load the name 'Fangsong' of the Chinese font 'simfang.ttf'?
How to load Chinese fonts correctly here?}
if f <> nil then
d.AddFont(f.FileName, f.FamilyName);