|
רושם פונט Unicode נוסף, מסוג Type 0 / CID-keyed, להכללה במילון Default Resources (/DR) של AcroForm. מאפשר למסמך PDF יחיד לחשוף כמה פונטי Unicode ל-AcroForm widgets בו זמנית, בדרך כלל בטפסים רב-לשוניים שצריכים למשל פונט Latin, פונט CJK ופונט Arabic באותו טופס
Delphi syntax:
procedure RegisterAcroFormFont(const FontResourceName: AnsiString;
FontIndirectRef: THPDFObject);
תיאור
AcroForm widgets מפנים לפונטים דרך מילון Default Resources (/DR) במילון AcroForm, המשמש כמאגר משאבים משותף לכל appearance streams של שדות הטופס. לפני v2.119.42, AcroForm /DR חשף בדיוק פונט Unicode אחד, בדרך כלל פונט Type 0 שנקבע על ידי helper ונרשם דרך SetFormUnicodeFontDict, דבר שהגביל תהליכי טפסים רב-לשוניים משום שכל widget נדרש לרנדר דרך אותה תוכנית פונט
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 שאליו מפנה operator המראה /Tf. מוסכמה: מזהה קצר ויציב ללא slash בתחילה, למשל 'NotoSansArab' או 'NotoSansCJK'. HotPDF כותבת את ה-slash בתחילה בזמן 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 יכולים לכתוב את appearance streams שלהם עם /NotoSansArab 12 Tf, בעוד widgets עם תוכן Japanese משתמשים ב-/NotoSansJP 12 Tf, כשהם חולקים מאגר AcroForm /DR אחד ברמת המסמך
Coexistence with SetFormUnicodeFontDict
העזר הקיים לפונט יחיד, SetFormUnicodeFontDict, ממשיך לעבוד עבור פרויקטים שצריכים רק פונט Unicode אחד ב-AcroForm /DR. RegisterAcroFormFont הוא additive: קוראים יכולים להשתמש בו בנוסף ל-SetFormUnicodeFontDict, או להחליף את SetFormUnicodeFontDict לחלוטין כאשר נדרש יותר מפונט Unicode אחד
See also: THotPDF.SetFormUnicodeFontDict, THotPDF.CreateIndirectFontDict, AcroForm Support, THPDFPage.AddTextField
|