SetStructElemWritingMode
PDF ที่มีแท็ก, การช่วยการเข้าถึง
คำอธิบาย
ตั้งแอตทริบิวต์ /WritingMode (เจ้าของแอตทริบิวต์แบบ Layout) บนองค์ประกอบโครงสร้างที่เปิดอยู่บนสแตกแท็ก writing mode ประกาศทิศทางการเขียนหลักของข้อความในองค์ประกอบ และมีผลต่อวิธีที่เทคโนโลยีช่วยเหลือตีความลำดับการอ่าน เทียบเท่ากับการเรียก AddTagAttribute โดยให้ Owner=Layout, Name=WritingMode และชื่อโหมดเป็นค่า
ไวยากรณ์
Delphi
Function TPDFlib.SetStructElemWritingMode(Const WritingMode: WideString): Integer;
ActiveX
Function PDFlib::SetStructElemWritingMode(WritingMode As String) As Long
DLL
int DLSetStructElemWritingMode(int InstanceID, const wchar_t * WritingMode);
พารามิเตอร์
| WritingMode | The writing direction for the element. Must be one of the following values (case-sensitive): LrTb — left to right, top to bottom (default; Latin, Cyrillic, Greek, and most scripts) RlTb — right to left, top to bottom (Arabic, Hebrew) TbRl — top to bottom, right to left (traditional CJK vertical text) |
|---|
ค่าที่ส่งกลับ
คืนค่า 1 เมื่อสำเร็จ คืนค่า 0 ถ้าไม่มีเอกสารเปิดอยู่หรือตอนนี้ไม่มีแท็กใดเปิดค้างบนสแตกแท็ก
หมายเหตุ
Call this function after BeginTag or BeginTagEx and before EndTag. The /WritingMode attribute is defined in ISO 32000-1 §14.8.5.4.2 (Layout attribute owner, Table 340).
When a document uses a consistent writing direction throughout, it is not necessary to set /WritingMode on every element — the default LrTb applies when the attribute is absent. Set the attribute explicitly on block-level elements whose writing direction differs from the surrounding content, for example a Hebrew quotation embedded in an English paragraph.
PDF/UA-1 (ISO 14289-1 §7.2) requires that the natural language of every piece of text can be unambiguously determined. /WritingMode complements the /Lang attribute (SetStructElemLang): /Lang declares what language is spoken, while /WritingMode declares the physical writing direction assistive technology should use for presentation.
ตัวอย่าง
// Arabic paragraph — right-to-left writing direction
PDFlib.BeginTagEx('P', '', '', 'ar-SA');
PDFlib.SetStructElemWritingMode('RlTb');
PDFlib.DrawText('...Arabic text...', 450, 700);
PDFlib.EndTag;
// Vertical CJK heading
PDFlib.BeginTagEx('H1', '', '', 'zh-TW');
PDFlib.SetStructElemWritingMode('TbRl');
PDFlib.DrawText('...CJK vertical text...', 500, 700);
PDFlib.EndTag;ดูเพิ่มเติม
SetStructElemBBox, SetStructElemLang, AddTagAttribute, BeginTag, EndTag