GetOpenTypeGlyphRun

文字、字型、診斷、OpenType shaping

描述

以既有字型控制代碼對 Unicode 文字做 shaping,並以 JSON 傳回產生的字形序列

語法

Delphi

Function TPDFlib.GetOpenTypeGlyphRun(FontID: Integer; Const Text: WideString; Options: Integer; Out GlyphRunJSON: WideString): Integer;

參數

FontID來源字型程式可取得的 TrueType 或 OpenType 字型控制代碼
Text要做 shaping 的 Unicode 文字
Options位元 0 選擇由右至左方向;位元 1 強制使用有界的 Pascal 後備
GlyphRunJSON接收方向、總前進量與視覺順序字形陣列

傳回值

成功傳回字形數;輸入無效或 shaping 失敗則為 0

JSON 結構描述

{"rtl":true,"advance":1470,"glyphs":[{"id":993,"cluster":3,"advance":338,"offsetX":0,"offsetY":0}]}

備註

id 是字型字形 ID;cluster 是 0-based 的 UTF-16 來源索引;前進量與位移以 em 的千分之一表示

字形以視覺順序傳回,位置與 DrawOpenTypeText 使用的一致

診斷時可用選項位元 1,把原生結果與受資源限制的 Pascal GSUB/GPOS 回退實作比較

另見

DrawOpenTypeText, GetOpenTypeTextWidth