Syriac / Mongolian / Devanagari Shaping Support

Multi-script capability surfaces (v2.119.53 - v2.119.55)

 

Arabic Shaping  Auto Shaping Pipeline  GSUB Engine

HotPDF 針對阿拉伯文之外的三種複雜文字公開 joining-class / positional-analysis / Indic syllabic-category capability surfaces:Syriac(U+0700-U+074F)、Mongolian(U+1800-U+18AF)與 Devanagari(U+0900-U+097F)。每項 capability 都讓呼叫端可透過既有 OpenType GSUB engine 驅動該文字以取得正確 shaping,同時將繁重工作(cluster boundary detection、BiDi resolution、GPOS positioning)保留在 HotPDF 範圍之外

 

敘利亞文塑形能力(v2.119.53)

兩個新方法公開敘利亞文的連接行為:

 

function GetSyriacJoiningClass(CP: Cardinal): TJoiningClass;

function GetSyriacPosition(const Run: array of Cardinal; Index: Integer): TPosition;

 

敘利亞文遵循與阿拉伯文相同的右連接 / 雙連接 / 透明 / 非連接四類架構;GetSyriacJoiningClass 依 Unicode 連接屬性分類 U+0700-U+074F 區塊中的每個 codepoint。GetSyriacPosition 會走訪敘利亞文 run,依緊鄰字元的連接類別,把每個字元解析成隔離 / 詞首 / 詞中 / 詞尾位置。

 

與阿拉伯文不同,敘利亞文區塊沒有預先編入 Unicode 的 Presentation Forms - 不存在等同於 U+FB50-FDFF / U+FE70-FEFC 阿拉伯文 Presentation Forms 的敘利亞文區塊。因此消費端必須透過字型自訂的 GSUB lookup(通常是 init / medi / fina / isol + rlig)驅動敘利亞文塑形,而不是改寫 codepoint。上述能力層提供呼叫端所需的位置標籤,以便為每個 glyph 查詢正確的 GSUB feature。

 

蒙古文塑形能力(v2.119.54)

蒙古文有兩個對應的方法:

 

function GetMongolianJoiningClass(CP: Cardinal): TJoiningClass;

function GetMongolianPosition(const Run: array of Cardinal; Index: Integer): TPosition;

 

涵蓋範圍包括傳統蒙古文(U+1820-U+1842)、托忒文(U+1843-U+1877)、錫伯文(U+1880-U+18A8)、滿文與阿里嘎里擴充。變體選擇子 FVS1 / FVS2 / FVS3(U+180B-U+180D)、軟連字號 NIRUGU(U+180A)與阿里嘎里母音符號都歸類為透明(T 類),因此參與連接而不會中斷走訪。

 

與敘利亞文一樣,蒙古文在 Unicode 中也沒有預先編碼的 Presentation Forms。蒙古文傳統的直排版面、複雜的字形變化規則與 FVS 驅動的形體選擇,預期都由字型自訂的 GSUB lookup 驅動(通常是 init / medi / fina / isol + ccmp / rlig / locl);能力層提供呼叫端查詢這些 feature 所需的位置標籤。

 

天城文 Indic 塑形能力(v2.119.55)

天城文與阿拉伯文 / 敘利亞文 / 蒙古文有根本差異 - 它是 Indic 音節文字(abugida),有意義的單位是音節簇(akshara)而非單一字母,且 cluster 內 glyph 的轉譯順序常與邏輯 Unicode 順序不同。兩個方法構成天城文的 Indic 能力層:

 

function GetDevanagariCategory(CP: Cardinal): TIndicCategory;

procedure ApplyDevanagariReorder(var Run: array of Cardinal);

 

GetDevanagariCategory 把 U+0900-U+097F 中的每個 codepoint 歸入 13 種 Indic 音節類別之一(Base / Consonant / Vowel / Independent Vowel / Vowel Mark / Pre-base Matra / Above-base Matra / Below-base Matra / Halant Virama / Repha / Anusvara / Visarga / Other),呼叫端因此能偵測音節邊界,並辨識 cluster 內哪些位置需要重排。

 

ApplyDevanagariReorder 是一個前置處理,會走訪輸入 run 並套用兩條主要的天城文重排規則:(1) Repha(音節 cluster 開頭的 Ra + Halant)移到 cluster 基底子音之後的位置,使其轉譯為上標鉤;(2) 前置 I-matra(U+093F DEVANAGARI VOWEL SIGN I)移到 cluster 基底子音之前,使其轉譯為左側鉤。其他 Indic 重排(上方 matra、下方 matra、連結字形成)交給字型的 GSUB 引擎,因為它們需要字型專屬的 lookup 表。

 

自動整合(v2.119.67):當 sfIndicShaping in PDF.ShapingFeatures 時,ApplyDevanagariReorder 會作為前置處理,自動套用在三個 BuildUnicode*FieldContent 輔助方法內。消費端讀取器的 GSUB 引擎接著以正確順序取得音節,並套用它自己的上下文塑形規則。詳見 Automatic Shaping Pipeline。

 

Syriac shaping capability (v2.119.53)

Two new methods expose Syriac's joining behavior:

 

function GetSyriacJoiningClass(CP: Cardinal): TJoiningClass;

function GetSyriacPosition(const Run: array of Cardinal; Index: Integer): TPosition;

 

Syriac 遵循與阿拉伯文相同的 Right-Joining / Dual-Joining / Transparent / Non-Joining 四類 framework;GetSyriacJoiningClass 會依 Unicode joining property 對 U+0700-U+074F block 中每個 codepoint 分類。GetSyriacPosition 會走訪 Syriac run,並依直接相鄰字元的 joining classes,將每個字元解析為 isolated / initial / medial / final position

 

與阿拉伯文不同,Syriac block 沒有預先編入 Unicode 的 Presentation Forms,也沒有相當於 U+FB50-FDFF / U+FE70-FEFC Arabic Presentation Forms blocks 的 Syriac 區塊。因此 consumers 必須透過字型定義的 GSUB lookups(通常是 init / medi / fina / isol + rlig)驅動 Syriac shaping,而不是重寫 codepoint。上述 capability layer 會提供呼叫端為每個 glyph 查詢正確 GSUB feature 所需的 position labels

 

Mongolian shaping capability (v2.119.54)

Two parallel methods for Mongolian:

 

function GetMongolianJoiningClass(CP: Cardinal): TJoiningClass;

function GetMongolianPosition(const Run: array of Cardinal; Index: Integer): TPosition;

 

Coverage 包含 basic Mongolian(U+1820-U+1842)、Todo(U+1843-U+1877)、Sibe(U+1880-U+18A8)、Manchu 與 Ali Gali extensions。Variation Selectors FVS1 / FVS2 / FVS3(U+180B-U+180D)、soft hyphen NIRUGU(U+180A)與 Ali Gali vowel marks 都會分類為 Transparent(T-class),因此可參與 joining 而不會中斷 walk

 

與 Syriac 一樣,Mongolian 沒有預先編入 Unicode 的 Presentation Forms。Mongolian 的傳統直排、複雜 letter-shape variation rules 與 FVS-driven shape selection,都預期由字型定義的 GSUB lookups 驅動(通常是 init / medi / fina / isol + ccmp / rlig / locl);capability layer 會提供查詢這些 features 所需的 position labels

 

Devanagari Indic shaping capability (v2.119.55)RegisterToUnicodeReverseMapping records source codepoints for shaped or synthetic glyph output. ClearToUnicodeReverseMappings resets the table, ToUnicodeReverseMappingCount reports its size, GetUnicodeGlyphForCodepoint returns the registered font glyph ID for a Unicode codepoint, and EnableShapingFeatureForSubset marks substitute glyphs from a GSUB feature for inclusion in the embedded subset

Devanagari 與 Arabic / Syriac / Mongolian 根本不同;它是 Indic abugida script,有意義的單位是 syllable cluster(akshara),不是單一字母,而且 cluster 內 glyphs 的 render order 經常不同於 logical Unicode order。兩個 methods 公開 Devanagari 的 Indic capability layer:

 

function GetDevanagariCategory(CP: Cardinal): TIndicCategory;

procedure ApplyDevanagariReorder(var Run: array of Cardinal);AutoShapeSyriac, Mongolian through sfMongolianShaping, Tibetan through sfTibetanShaping, Indic reorder through sfIndicShaping, and full Indic GSUB shaping through sfIndicGSUB. The detailed entry points are documented in Tibetan/Mongolian/Syriac shaping methods and Indic shaping methods

目前範圍也涵蓋作為 RTL cursive scripts 的 N'Ko 與 Adlam、Thai/Lao SARA AM 與 tone-mark ordering、Hebrew niqqud ordering,以及 Javanese pre-base signs。這些 paths 記錄於 script shaping preprocess methods

 

 

請參閱: Arabic / Persian / Urdu Shaping Support, Automatic Shaping Pipeline (Phase 8), OpenType GSUB Substitution Engine, THotPDF.AssignSyntheticCodepointForGID