PDFiumPas 文件

FPdfTextShaping 單元

單元: FPdfTextShaping
將雙向 Unicode 文字塑形為視覺字形段,供 TPdf.AddShapedText 使用,並具備有界的輸入輸出大小與可擴充的塑形器基底類別

工作流程

APIPurpose
ShapePdfText(Text, FontName, FontSize, Direction, out Shaped)以內建的 Windows Uniscribe 實作與預設資源限制塑形文字
TPdfTextShaper.Shape自訂引擎的抽象塑形合約,傳回字形識別碼、叢集、視覺文字段、前進寬度與選定的字型資料
TPdfUniscribeTextShaper.Shape使用 usp10.dll 對文字段進行分段、塑形、定位與視覺重排
TPdfTextShapingOptions.Default傳回自動方向,限制為 1,000,000 個字元、2,000,000 個字形與 100,000 個文字段
ConfigureTextShaper(Shaper)安裝本單元使用的文字整形後端,自安裝起取代內建實作;執行個體的所有權歸單元所有
ClearTextShaper移除已安裝的後端,回到平台預設實作
ActiveTextShaper目前正在使用的後端;平台上沒有可用的整形器時為 nil
ActiveTextShaperName作用中後端所回報的名稱,用於日誌記錄,也用於區分不同的部署

公用型別

TypeDescription
EPdfTextShapingError輸入無效、違反資源限制、字型資料失敗或塑形引擎錯誤時引發的例外
TPdfTextDirectionptdAutoptdLeftToRightptdRightToLeft
TPdfShapedGlyph單一字元,包含 GlyphIDAdvanceOffsetXOffsetYClusterStartClusterLength
TPdfShapedGlyphsTPdfShapedGlyph 記錄的動態陣列
TPdfShapedRun單一視覺文字段,包含 TextStartTextLengthVisualXWidthBidiLevelIsRightToLeftGlyphs
TPdfShapedRuns以視覺順序排列的 TPdfShapedRun 記錄動態陣列
TPdfShapedText來源 Text、選定的 FontNameFontSize、內嵌的 FontData、塑形後的 Runs、總 WidthGlyphCountLogicalCharacterCount
TPdfTextShapingOptionsDirectionMaxCharactersMaxGlyphsMaxRuns 資源限制
TPdfTextShaper呼叫端提供之塑形實作的抽象基底類別
TPdfUniscribeTextShaperTPdfTextShaper 的內建 Windows 實作

Remarks

Example

var
  Shaped: TPdfShapedText;
  MeasuredWidth: Single;
begin
  if ShapePdfText(Text, 'Segoe UI', 12, ptdAuto, Shaped) then
    MeasuredWidth := Shaped.Width;
end;

See Also

TPdf.AddShapedText