DynaPDF Manual - Page 345

Previous Page 344   Index   Next Page 346

Function Reference
Page 345 of 839
Example (Delphi):
// In this example we have a combo box on the form that should be
// filled with the available fonts when the form is created.
// The font names passed to the callback function are already sorted in
// ascending order by PostScript name, so that we do not need to sort
// them again.
// Note that the font selection mode must be set to smPostScriptName
// if you want to use postscript names for font selection.
function EnumFontProc(const Data: Pointer; const FamilyName: PWideChar;
const PostScriptName: PAnsiChar; Style: TFStyle): Integer; stdcall;
var cb: TComboBox;
begin
// Data holds the pointer of our combo box cbFonts.
cb := Data;
cb.AddItem(PostScriptName, nil);
Result := 0; // Any other return value break enumeration!
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
// First, we create an instance of the class TPDF. This is our main
// instance used until the form will be destroyed. cbFonts is the
// combo box on our form that should be used for font selection.
PDF := TPDF.Create;
PDF.EnumHostHonts(cbFonts, @EnumFontProc);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
PDF.Free;
end;
EnumHostFontsEx
Syntax:
SI32 pdfEnumHostFontsEx(
const PPDF* IPDF,
// Instance pointer
const void* Data,
// User defined pointer
TEnumFontProcEx* EnumProc) // Callback function see below
typedef SI32 PDF_CALL TEnumFontProcEx(
const void* Data,
// User defined pointer
const UI16* FamilyName,
// Family name
const char* PostScriptName, // PostScript name
SI32 Style,
// Font Style
TFontBaseType BaseType,
// Base font type
TEnumFontProcFlags Flags,
// See below
const char* FilePath)
// File path to font file
#define PDF_CALL __stdcall
// Windows only, otherwise empty
 

Previous topic: EnumHostFonts

Next topic: ExchangeBookmarks