THotPDF.RegisterAcroFormFont

THotPDF AcroForm /DR multi-font registration (v2.119.42)

 

AddXFAPacket  AcroForm Support  SetFormUnicodeFontDict

Реєструє additional Unicode (Type 0 / CID-keyed) font for inclusion in AcroForm Default Resources (/DR) dictionary Це дає одному PDF document expose multiple Unicode fonts to AcroForm widgets simultaneously - типово для multilingual forms, яким потрібні, наприклад, Latin font + CJK font + Arabic font in same form

 

Delphi syntax:

procedure RegisterAcroFormFont(const FontResourceName: AnsiString;

  FontIndirectRef: THPDFObject);

 

Опис

AcroForm widgets посилаються на fonts через Default Resources (/DR) dictionary у AcroForm dict, який є shared resource pool для всіх form-field appearance streams До v2.119.42 AcroForm /DR expose лише один Unicode font, що обмежувало multilingual form workflows, бо every widget had to render through same font

 

After v2.119.42 callers can register additional Unicode fonts at arbitrary resource names. Each registered font becomes a /DR /Font /<name> <indirect ref> entry inside the AcroForm /DR dict at EndDoc. Widget appearance streams can then reference any of the registered names through their own /Tf <name> <size> operator inside the appearance content stream.

 

Parameters

FontResourceName - PDF Name, який references appearance stream /Tf operator Convention: short stable identifier without leading slash (наприклад 'NotoSansArab', 'NotoSansCJK') HotPDF writes leading slash during serialization

FontIndirectRef - an existing indirect Type 0 (CID-keyed) font dictionary, typically the result of CreateIndirectFontDict over a font registered via RegisterUnicodeTTF.

 

Typical workflow (multilingual form)

 

PDF.RegisterUnicodeTTF('NotoSansArab', 'NotoSansArabic-Regular.ttf');

PDF.RegisterUnicodeTTF('NotoSansJP'  , 'NotoSansJP-Regular.otf');

ArabRef := PDF.CreateIndirectFontDict('NotoSansArab');

JPRef   := PDF.CreateIndirectFontDict('NotoSansJP');

PDF.RegisterAcroFormFont('NotoSansArab', ArabRef);

PDF.RegisterAcroFormFont('NotoSansJP'  , JPRef);

 

Тепер widgets з Arabic content можуть author appearance streams із /NotoSansArab 12 Tf, while widgets з Japanese content use /NotoSansJP 12 Tf, sharing one document-wide AcroForm /DR resource pool

 

Coexistence with SetFormUnicodeFontDict

Наявний single-font helper SetFormUnicodeFontDict продовжує працювати для проєктів, яким потрібен лише один Unicode font у AcroForm /DR. RegisterAcroFormFont є additive: callers можуть використовувати його разом із SetFormUnicodeFontDict або повністю замінити SetFormUnicodeFontDict, коли потрібно більше ніж один Unicode font

 

See also: THotPDF.SetFormUnicodeFontDict, THotPDF.CreateIndirectFontDict, AcroForm Support, THPDFPage.AddTextField