stdfonttest.pp 965 B

1234567891011121314151617181920212223242526272829303132333435
  1. {
  2. Demo program to demonstrate standard font strange character support, with strikethrough and underline.
  3. }
  4. program stdfonttest;
  5. {$mode objfpc}{$H+}
  6. {$codepage UTF8}
  7. uses
  8. {$ifdef unix}cwstring,{$endif}SysUtils, fpTTF, fpPDF;
  9. var
  10. PDF: TPDFDocument;
  11. StdFtHelvetica: Integer;
  12. P: TPDFPage;
  13. begin
  14. PDF := TPDFDocument.Create(nil);
  15. PDF.Infos.Producer := 'Test';
  16. PDF.Infos.CreationDate := Now;
  17. PDF.Options := [poPageOriginAtTop, {poNoEmbeddedFonts,} poSubsetFont, poCompressFonts, poCompressImages];
  18. PDF.DefaultOrientation := ppoPortrait;
  19. PDF.DefaultPaperType := ptA4;
  20. PDF.DefaultUnitOfMeasure := uomMillimeters;
  21. PDF.StartDocument;
  22. PDF.Sections.AddSection;
  23. PDF.Sections[0].AddPage(PDF.Pages.AddPage);
  24. StdFtHelvetica := PDF.AddFont('Helvetica');
  25. P:=PDF.Pages[0];
  26. P.SetFont(StdFtHelvetica, 14);
  27. P.WriteText(10,10,'FPC Demo: PDF öäü ÖÄÜ Test',0,true,true);
  28. PDF.SaveToFile('test-stdfont.pdf');
  29. PDF.Free;
  30. end.