THotPDF.CreateIndirectFontDict Method

 

THotPDF.CreateIndirectFontDict

THotPDF

 

Top

Allocates a fresh empty THPDFDictionaryObject registered as an indirect PDF object in the document's IndirectObjects table. Callers building custom font / colour / OCG / Function dicts that must be serialised as "N G R" indirect references fill the returned dict and pass it through any API that accepts an existing THPDFDictionaryObject. This is the public-API form of the long-standing protected CreateIndirectDictionary helper.

 

Delphi syntax:

function CreateIndirectFontDict: THPDFDictionaryObject;

 

C++ syntax:

THPDFDictionaryObject* CreateIndirectFontDict();

 

Description

The returned dict starts empty (no entries). The caller adds entries via AddNameValue, AddStringValue, AddNumericValue, AddValue, etc. The dict is owned by the document; do not free it manually. Although the method is named "FontDict" for its primary intended use with SetFormUnicodeFontDict, the returned dict has no font-specific semantics - it can hold any PDF dictionary content the caller needs.

 

Return value: an empty indirect THPDFDictionaryObject.

 

Code Example

// Build a minimal Type 0 / CIDFontType2 + Identity-H font dict for
// AcroForm Tx widget AP rendering.
var
  F0: THPDFDictionaryObject;
begin
  HPDF.BeginDoc;
  F0 := HPDF.CreateIndirectFontDict;
  F0.AddNameValue('Type', 'Font');
  F0.AddNameValue('Subtype', 'Type0');
  F0.AddNameValue('BaseFont', 'MyCJK');
  F0.AddNameValue('Encoding', 'Identity-H');
  // ... fill DescendantFonts / CIDSystemInfo / FontDescriptor / ...
  HPDF.SetFormUnicodeFontDict('F0', F0);
  HPDF.EndDoc;
end;

 

See Also

SetFormUnicodeFontDict