ApplyDevanagariReorder
Signature
function ApplyDevanagariReorder(const Wide: UnicodeString): UnicodeString;
Purpose
Applies the Devanagari reorder pre-pass to Wide and returns a UnicodeString prepared for cmap and GSUB consumption. Text outside Devanagari remains byte-stable, so callers can route mixed text without changing unrelated runs
Coverage
- Devanagari uses the
devascript record for U+0900-U+097F. The documented path covers R1-R5 with conjunct preservation while preserving API behaviour for producer-side shaping(Ra, Halant)pair moves to the syllable end. ApplyIndicReorderdispatches to this helper when the active codepoint range matches U+0900-U+097FU+093FI-matra,U+094EPRISHTHAMATRA E) move to the syllable start.- R3 Above-base matras: matras with
MatraPos = 3(e.g.U+0947–U+0948E/AI,U+0945–U+0946CANDRA E/SHORT E) emit after the base block. - R4 Below-base matras: matras with
MatraPos = 4(e.g.U+0941–U+0944U/UU/Vocalic R/RR) emit after above-base. - R5 Post-base matras: matras with
MatraPos = 2(e.g.U+093EAA,U+0940II,U+0949–U+094CCANDRA O/SHORT O/O/AU) emit after below-base.
Output layout per syllable: [pre-matras] + [base + halant + nukta + bindu/visarga/modifier — Repha and matras removed] + [above-matras] + [below-matras] + [post-matras] + [Repha: Ra Halant]?
Conjuncts (C + Halant + C) are preserved by keeping all
non-matra content in the base block in original relative order
Reorder is single-pass and idempotent
Example
var
Wide: UnicodeString;
begin
// Input: RA + HALANT + KA + I-matra
Wide:= Doc.ApplyDevanagariReorder(#$0930#$094D#$0915#$093F);
// Wide is now: I-matra + KA + RA + HALANT (R1 + R2 applied)
end;
See also
ApplyIndicReorder- coverageGetDevanagariCategory- Devanagari category lookup
Standards
- Unicode 16.0 U+0900-U+097F
- ISO 32000-1 §9.10
IndicSyllabicCategory.txtandIndicPositionalCategory.txt - ISO 32000-1 §9.10 (extraction of text content)
- OpenType Devanagari shaping specification
Version history
- v2.119.70 - Introduced as part of the HotPDF Indic shaping batch
- v2.119.67 — Auto-applied inside
BuildUnicode*FieldContentwhensfIndicShapingis set (Phase 8e). - v2.119.69 — Internally routed via
ApplyIndicReorderdispatcher; output unchanged (Phase 8f.0). - v2.119.70 — Complete shaper: R3 above-base + R4 below-base + R5 post-base matra repositioning added; reorder now covers all 4 MatraPos slots (Phase 8f.1).