#2 PDF Engine » The spacing of some Chinese fonts is incorrectly displayed » 2021-11-10 11:24:01

txgha
Replies: 2
var
  lPdf: TPdfDocumentGDI;
  lPage: TPdfPage;
begin
  lPdf := TPdfDocumentGDI.Create;
  lPage := lPdf.AddPage;
  try
    lPdf.VCLCanvas.Font.Name := '黑体'; //Display incorrect
    //lPDF.VCLCanvas.Font.Name := '宋体';  //Display correct
    lPdf.VCLCanvas.Font.Size := 20;
    lPdf.VCLCanvas.TextOut(100, 100, '测试内容');
    lPdf.SaveToFile('C:\Syntest.pdf');
  finally
    lPdf.Free;
  end;
end;

Display incorrect

Display correct

Board footer

Powered by FluxBB