THotPDF.RegisterAcroFormFont

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

 

AddXFAPacket  AcroForm Support  SetFormUnicodeFontDict

Registruje dodatni Unicode (Type 0 / CID-keyed) font za uključivanje u AcroForm Default Resources (/DR) rečnik. Omogućava da jedan PDF dokument istovremeno izlaže više Unicode fontova AcroForm widgetima - obično se koristi za višejezične forme koje zahtevaju, na primer, Latin font, CJK font i Arapski font u istoj formi

 

Delphi syntax:

procedure RegisterAcroFormFont(const FontResourceName: AnsiString;

  FontIndirectRef: THPDFObject);

 

Opis

AcroForm widget-i referenciraju fontove kroz Default Resources (/DR) rečnik u AcroForm dict-u, koji funkcioniše kao zajednički skup resursa za sve appearance streamove polja forme. Pre-v2.119.42, AcroForm /DR je sadržao tačno jedan Unicode font (obično helper-set Type 0 font registrovan kroz SetFormUnicodeFontDict), što je ograničavalo višejezične tokove rada jer je svaki widget morao da renderuje kroz isti font program

 

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 koji appearance stream /Tf operator referencira Konvencija: kratak stabilan identifikator bez vodećeg slash-a (npr. 'NotoSansArab', 'NotoSansCJK') HotPDF pri serijalizaciji upisuje vodeći slash

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);

 

Sada widgeti sa arapskim sadržajem mogu da pišu appearance tokove sa /NotoSansArab 12 Tf dok widgeti sa japanskim sadržajem koriste /NotoSansJP 12 Tf, deleći jedan dokument-wide AcroForm /DR resursni pool

 

Coexistence with SetFormUnicodeFontDict

Postojeći pomoćnik za jedan font (SetFormUnicodeFontDict) i dalje radi za projekte kojima je potreban samo jedan Unicode font u AcroForm /DR. RegisterAcroFormFont je dopuna: pozivaoci mogu da ga koriste pored SetFormUnicodeFontDict, ili da potpuno zamene SetFormUnicodeFontDict kada je potrebno više od jednog Unicode fonta

 

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