|
AcroForm Default Resources (/DR) dictionary に含める追加 Unicode (Type 0 / CID-keyed) font を登録します。1 つの PDF document が複数の Unicode fonts を AcroForm widgets に同時に公開できるようにします。通常は、同じ form 内で Latin font、CJK font、Arabic font などを必要とする multilingual forms に使用します
Delphi syntax:
procedure RegisterAcroFormFont(const FontResourceName: AnsiString;
FontIndirectRef: THPDFObject);
説明
AcroForm widgets は AcroForm dict 上の Default Resources (/DR) dictionary を通じて fonts を参照します。この dictionary はすべての form-field appearance streams の shared resource pool として機能します。v2.119.42 より前は AcroForm /DR が正確に 1 つの Unicode font (通常は SetFormUnicodeFontDict で登録された helper-set Type 0 font) だけを公開していたため、multilingual form workflows ではすべての widget が同じ font program で render される制約がありました
v2.119.42 以降、callers は任意の resource names で追加 Unicode fonts を登録できます。登録された各 font は EndDoc 時に AcroForm /DR dict 内の /DR /Font /<name> <indirect ref> entry になります。widget appearance streams は、その後 appearance content stream 内の /Tf <name> <size> operator で登録済み names のいずれかを参照できます
パラメータ
FontResourceName - appearance stream の /Tf operator が参照する PDF Name です。慣例として、leading slash のない短く安定した identifier を使います (例: 'NotoSansArab'、'NotoSansCJK')。HotPDF は serialise 時に leading slash を書き込みます
FontIndirectRef - 既存の indirect Type 0 (CID-keyed) font dictionary です。通常は RegisterUnicodeTTF で登録した font に対して CreateIndirectFontDict を呼んだ結果です
典型的な workflow
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);
これにより、Arabic-content widgets は /NotoSansArab 12 Tf で appearance streams を author でき、Japanese-content widgets は /NotoSansJP 12 Tf を使用できます。どちらも 1 つの document-wide AcroForm /DR resource pool を共有します
SetFormUnicodeFontDict との共存
既存の single-font helper (SetFormUnicodeFontDict) は、AcroForm /DR に 1 つの Unicode font だけが必要な projects で引き続き機能します。RegisterAcroFormFont は additive です。callers は SetFormUnicodeFontDict と併用することも、複数の Unicode fonts が必要な場合に SetFormUnicodeFontDict を完全に置き換えることもできます
関連項目: THotPDF.SetFormUnicodeFontDict, THotPDF.CreateIndirectFontDict, AcroForm Support, THPDFPage.AddTextField
|