ApplyKhmerReorder
簽章
function ApplyKhmerReorder(const Wide: UnicodeString): UnicodeString;
用途
對 Wide 套用 Khmer 重排預處理,並傳回可交給 cmap 與 GSUB 使用的 UnicodeString。Khmer 之外的文字與資料保持位元組穩定
涵蓋範圍
- Khmer 對 U+1780-U+17FF 使用
khmrscript 記錄。涵蓋範圍包含independent South-East Asian syllable processing,並維持產生端 API 行為穩定Consonantstays in original order rather than rotating to the end of the cluster. ApplyIndicReorderdispatches to this helper when the active codepoint range matches U+1780-U+17FFCOENG + Consonantpair forms a stacked-consonant cluster. The pair stays in the base buffer in original order and the font's GSUB'pres'/'blws'features handle subscript positioning. Nested coeng (C + COENG + C + COENG + C) is supported by the FSM.- VIRIAM (
U+17D1) is a separate virama-like sign distinct fromCOENG: it does not stack a following consonant. The syllable FSM tracks the previous codepoint (not just the previous category) so it can distinguishCOENGfromVIRIAMwhen deciding whether a trailing consonant continues this syllable. - Pre-base vowels (
MatraPos = 1): E (U+17C1), AE (U+17C2), AI (U+17C3), OE (U+17BE), OO (U+17C4), AU (U+17C5). OE / OO / AU have visual top or right components that are GSUB-rendered; the reorder pre-pass moves only the logical pre-base component to syllable start. - Register shifters — MUUSIKATOAN (
U+17C9, 1st series) and TRIISAP (U+17CA, 2nd series). These plus other signs (U+17CB–U+17D0,U+17D3,U+17DD) are categorised as12and route to the above-base buffer. - Bindu (NIKAHIT
U+17C6) is categorised as6and routes to above-base. - Visarga (REAHMUK
U+17C7, YUUKALEAPINTUU+17C8) is categorised as7and routes to post-base. - Above-base vowels (
MatraPos = 3): I (U+17B7), II (U+17B8), Y (U+17B9), YY (U+17BA). - Below-base vowels (
MatraPos = 4): U (U+17BB), UU (U+17BC), UA (U+17BD). - Post-base vowels (
MatraPos = 2): AA (U+17B6), YA (U+17BF), IE (U+17C0).
重排行為
- Pre-base vowels emit before the base block (analogous to Brahmic R2).
- Above-base vowels emit after the base block.
- Below-base vowels emit after the above-base block.
- Post-base vowels and Visarga emit after the below-base block.
- Register shifters, Bindu, and other above signs all route to the above-base block so they render after the consonant stack.
- Consonant cluster (consonants + COENG pairs) stays in the base block in original logical order — GSUB
'pres'/'blws'handle the visual subscript stacking. - NO Repha extraction: Khmer syllables containing
Ra+COENG+Consonantstay verbatim in the base block.
Output layout per syllable: [pre-vowels] + [consonants + COENG pairs] + [above-vowels / register-shifters / Bindu / signs] + [below-vowels] + [post-vowels / Visarga]. Single-pass; idempotent on simple inputs
範例
var
Wide: UnicodeString;
begin
// Input: KA (U+1780) + E-vowel (U+17C1, pre-base)
Wide:= Doc.ApplyKhmerReorder(#$1780#$17C1);
// Wide is now: E (U+17C1) + KA (U+1780)
// Input: KA + COENG + KHA + AA-vowel (stacked consonant + post vowel)
Wide:= Doc.ApplyKhmerReorder(#$1780#$17D2#$1781#$17B6);
// Wide unchanged: KA + COENG + KHA + AA
// (COENG cluster stays in BaseBuf in original order; AA in PostBuf)
end;
另請參閱
ApplyIndicReorder- 涵蓋範圍GetKhmerCategory- Khmer category lookupApplyBengaliReorder— Bengali counterpart.ApplyGujaratiReorder— Gujarati counterpart.ApplyTamilReorder— Tamil counterpart.ApplyTeluguReorder— Telugu counterpart.ApplyKannadaReorder— Kannada counterpart.ApplyMalayalamReorder— Malayalam counterpart.ApplySinhalaReorder— Sinhala counterpart.GetKhmerCategory— Unicode codepoint → category lookup.
標準
- Unicode 16.0 U+1780-U+17FF
- ISO 32000-1 §9.10
IndicSyllabicCategory.txt,IndicPositionalCategory.txt - OpenType Khmer shaping specification
- OpenType Khmer shaping spec (script tag
'khmr')
版本歷史
- v2.120.9 - 作為 HotPDF Indic 塑形批次的一部分導入