THotPDF 印度系文字重排與 GSUB 塑形方法

THotPDF API 參考

 

THotPDF Methods  Auto Shaping  GSUB

記錄 Indic reorder 與 GSUB shaping surface,包括 per-script reorder helpers、dispatcher,以及 v2.167 Indic GSUB producer path

 

Delphi 語法

function ApplyIndicReorder(const Wide: UnicodeString): UnicodeString; overload;

function ApplyIndicReorder(const Wide: UnicodeString; const Features: THPDFShapingFeatures): UnicodeString; overload;

function ApplyIndicShaping(const S: UnicodeString): UnicodeString;

function IndicShapeToGIDs(const S: UnicodeString): TGSUBLookupArray;

function ApplyDevanagariReorder(const Wide: UnicodeString): UnicodeString;

function ApplyBengaliReorder(const Wide: UnicodeString): UnicodeString;

function ApplyGujaratiReorder(const Wide: UnicodeString): UnicodeString;

function ApplyTamilReorder(const Wide: UnicodeString): UnicodeString;

function ApplyTeluguReorder(const Wide: UnicodeString): UnicodeString;

function ApplyKannadaReorder(const Wide: UnicodeString): UnicodeString;

function ApplyMalayalamReorder(const Wide: UnicodeString): UnicodeString;

function ApplySinhalaReorder(const Wide: UnicodeString): UnicodeString;

function ApplyKhmerReorder(const Wide: UnicodeString): UnicodeString;

function ApplyMyanmarReorder(const Wide: UnicodeString): UnicodeString;

 

Covered APIs

API使用注意事項
ApplyIndicReorder在 GSUB shaping 或文字輸出之前派送各文字專屬的 Indic 重排 helper。無參數形式涵蓋完整文字;接受 THPDFShapingFeatures 集合的多載只重排帶對應 shaping 旗標的文字,與文字輸出期間套用的逐旗標隔離一致
ApplyIndicShaping套用重排與 Indic GSUB feature 鏈,傳回供輸出使用的合成碼位文字
IndicShapeToGIDs傳回 Indic 字串 shaping 後的字形 ID 序列,但不輸出 PDF 文字
ApplyDevanagariReorder在 cmap 與 GSUB lookup 之前套用天城體(Devanagari)音節重排前置處理
ApplyBengaliReorder在 cmap 與 GSUB lookup 之前套用孟加拉(Bengali)音節重排前置處理
ApplyGujaratiReorder在 cmap 與 GSUB lookup 之前套用古吉拉特(Gujarati)音節重排前置處理
ApplyTamilReorder在 cmap 與 GSUB lookup 之前套用泰米爾(Tamil)音節重排前置處理
ApplyTeluguReorder在 cmap 與 GSUB lookup 之前套用泰盧固(Telugu)音節重排前置處理
ApplyKannadaReorder在 cmap 與 GSUB lookup 之前套用卡納達(Kannada)音節重排前置處理
ApplyMalayalamReorder在 cmap 與 GSUB lookup 之前套用馬拉雅拉姆(Malayalam)音節重排前置處理
ApplySinhalaReorder在 cmap 與 GSUB lookup 之前套用僧伽羅(Sinhala)音節重排前置處理
ApplyKhmerReorder在 cmap 與 GSUB lookup 之前套用高棉(Khmer)音節重排前置處理
ApplyMyanmarReorder在 cmap 與 GSUB lookup 之前套用緬甸(Myanmar)音節重排前置處理
GetDevanagariCategory為音節與重排判斷分類天城體(Devanagari)碼位
GetBengaliCategory為 Indic 重排判斷分類孟加拉(Bengali)碼位
GetGujaratiCategory為 Indic 重排判斷分類古吉拉特(Gujarati)碼位
GetTamilCategory為 Indic 重排判斷分類坦米爾(Tamil)碼位
GetTeluguCategory為 Indic 重排判斷分類泰盧固(Telugu)碼位
GetKannadaCategory為 Indic 重排判斷分類坎那達(Kannada)碼位
GetMalayalamCategory為 Indic 重排判斷分類馬拉雅拉姆(Malayalam)碼位
GetSinhalaCategory為 Indic 重排判斷分類僧伽羅(Sinhala)碼位
GetKhmerCategory為共用的複雜文字重排路徑分類高棉(Khmer)碼位
GetMyanmarCategory為共用的複雜文字重排路徑分類緬甸(Myanmar)碼位
sfIndicShaping在文字輸出前執行保守的 Indic 音節重排路徑,不強制套用完整 GSUB feature
sfIndicGSUB執行 Indic 重排與 GSUB feature 鏈,然後透過合成碼位輸出 shaping 後的字形 ID

 

使用注意事項

sfIndicShaping 會執行 reorder-only output,並維持為保守選項。sfIndicGSUB 會重新排序每個 syllable、套用 OpenType Indic feature chain、透過 synthetic codepoints 輸出 shaped GIDs,並在 font 缺少相關 GSUB script 時降級為 reorder path

僧伽羅語的 diga kombuva(U+0DDA)把 kombuva 放在基前,並把它的第二個分量放在基後。GSUB 路徑在字型提供專用基後形式時使用該形式。預組合輸入與規範分解輸入遵循相同的置放規則

孟加拉語的 reph 跟隨基下母音,並位於右手側母音(包括分裂母音的右分量)之前。古吉拉特語的 reph 跟隨基上母音,並位於基下母音與右手側母音之前

對泰盧固語與僧伽羅語,重排路徑只有在音節起始的 Ra 與 halant 之後緊接 ZWJ 與一個子音時才辨識 reph。GSUB 路徑還要求字型提供相符的替換;字型缺少該替換時保留一般連字順序

Indic GSUB 路徑把 reph 替換限定在音節起始的 reph 序列,把半形式限定在符合條件的前基字形,把後基形式限定在後基區域。上下文替換遵循相同的位置規則,插入的字形繼承它所替換字形的定位

 

請參閱: International Script Shaping ShapingFeatures GSUB lookup methods