THPDFFontDecoder Record

保存單一已載入 PDF 字型的解碼表與寬度量測,由字型解碼後備鏈建構

宣告

THPDFFontDecoder= record
  FontKey: AnsiString;             // resource key (e.g. /F1) for diagnostics
  Subtype: AnsiString;             // Type0, Type1, TrueType, CIDFontType2
  Strategies: THPDFFontStrategies; // which fallbacks are populated
  ToUnicodeMap: THPDFCMapParseResult;
  EncodingMap: THPDFCMapParseResult;        // /Encoding stream or named CMap
  PredefinedEncoding: AnsiString;           // 'WinAnsiEncoding' etc
  CIDToGIDIdentity: boolean;
  CIDToGIDs: array of Word;                 // binary CIDToGIDMap stream
  CIDToUnicode: THPDFCIDToUnicodeTable;     // cid2code.txt fallback
  GlyphNameUnicode: array[0.. 255] of Cardinal;
  GIDToUnicode: THPDFUnicodeByGID;
  // v2.505.0 simple-font /Widths (PDF 1.7 9.6.3 Table 111). Index =
  // (code - FirstChar); values are 1/1000-em glyph advances. Empty when
  // the font has no /Widths array (the interpreter falls back to 0.5*fs)
  Widths: array of Double;
  FirstChar: Integer;
  LastChar: Integer;
  CIDWidths: THPDFCIDWidthRanges;
  CIDDefaultWidth: Double;
  // Vertical (WMode 1) counterparts from the descendant CIDFont /W2 and
  // /DW2 (ISO 32000-1 9.7.4.3). Each /W2 metric is a [w1y v1x v1y]
  // triple: w1y is the displacement along the writing axis, v1x/v1y the
  // position vector from the glyph's horizontal origin to its vertical
  // origin. A range entry (cFirst cLast w1y v1x v1y) stores one triple;
  // a list entry (c [w1y v1x v1y ...]) stores one triple per CID from
  // FirstCID to LastCID. VerticalWriting gates the resolver's vertical
  // branch
  CIDVertWidths: THPDFCIDWidthRanges;
  CIDVertDefaultAdvance: Double;       // /DW2 w1y (second entry); default -1000
  CIDVertDefaultOriginY: Double;       // /DW2 v1y (first entry); default 880
  VerticalWriting: boolean;
  Ascent: Double;
  Descent: Double;
  HasVerticalMetrics: boolean;
  CodeUnitBytes: Integer;                    // bytes per char code
  OK: boolean;
end;

單元

HPDFTextExtraction

欄位

欄位用途
FontKey命名字型的資源鍵(例如 /F1),保留供診斷
Subtype字型字典子類型:Type0、Type1、TrueType、CIDFontType2 等
Strategies成功建置的後備策略集合
ToUnicodeMap解析後的 /ToUnicode CMap,含 bfchar 與 bfrange 條目,優先順序最高
EncodingMap解析後的 /Encoding 串流或具名 CMap
PredefinedEncoding預先定義的編碼名稱,例如 WinAnsiEncoding
CIDToGIDIdentityCIDToGIDMap 為 Identity、不需要明確表格時為 True
CIDToGIDs展開為每個 CID 一個 Word 的二進位 CIDToGIDMap 串流
CIDToUnicode來自 cid2code.txt 後備的 CID 對 Unicode 表
GlyphNameUnicode256 項的字形名稱對 Unicode 表,供 /Differences 復原使用
GIDToUnicode由內嵌 cmap 反轉而成的字形 ID 對 Unicode 表
Widths簡單字型 /Widths 的前進量(1/1000 em),以字元碼減 FirstChar 索引
FirstCharWidths 陣列支援的第一個字元碼
LastCharWidths 陣列支援的最後一個字元碼
CIDWidths來自 CIDFont /W 陣列的 CID 寬度範圍
CIDDefaultWidth/DW 的預設 CID 前進量
CIDVertWidths直排 /W2 量測,每個 CID 或範圍存成 [w1y v1x v1y] 三元組
CIDVertDefaultAdvance/DW2 w1y 的預設垂直位移,預設 -1000
CIDVertDefaultOriginY/DW2 v1y 的預設垂直原點,預設 880
VerticalWriting當 WMode 1 量測讓解析器走直排分支時為 True
Ascent從字型描述器量測讀到的字型 ascent
Descent從字型描述器量測讀到的字型 descent
HasVerticalMetrics找到此字型的直排量測時為 True
CodeUnitBytes每個字元碼的位元組數,針對此字型回答內容解譯器
OK至少一個解碼策略可用時為 True

使用說明

相關 API