THPDFSemanticTextLayout 記錄

對頁面上已定位 glyph 做語義閱讀順序分析的結果

THPDFSemanticTextLayout = record
  Lines: THPDFSemanticTextLines;
  ColumnCount: Integer;
  TableCount: Integer;
  MedianAdvance: Double;
  MedianFontSize: Double;
end;

單元為 HPDFContentStream;Lines 存放偵測出的閱讀順序行,帶有 cell、zone、table、list 層級與來源順序中繼資料

行記錄

Lines 的每個元素都是 THPDFSemanticTextLine:

THPDFSemanticTextLine = record
  Text: UnicodeString;
  Cells: THPDFSemanticTextCells;
  Kind: THPDFSemanticBlockKind;
  Left, Bottom, Right, Top: Double;
  BaselineY: Double;
  FontSize: Double;
  ColumnIndex: Integer;
  ZoneIndex: Integer;
  TableIndex: Integer;
  TableRowIndex: Integer;
  ListLevel: Integer;
  SourceOrder: Integer;
end;

Text 是該行文字,Cells 持有其選用的表格儲存格,Kind 依區塊角色為該行分類

Left、Bottom、Right 與 Top 是使用者空間中的行框;BaselineY 是基準線,FontSize 是主要字型大小

ColumnIndex 與 ZoneIndex 標出閱讀欄與閱讀區,TableIndex、TableRowIndex、ListLevel 與 SourceOrder 則把該行定位到表格內、清單內的位置以及原始字形順序

儲存格記錄

Cells 的每個元素都是 THPDFSemanticTextCell:

THPDFSemanticTextCell = record
  Text: UnicodeString;
  Left, Bottom, Right, Top: Double;
  FirstGlyphIndex, LastGlyphIndex: Integer;
end;

Text 是儲存格文字,四個框欄位在使用者空間中描述該儲存格;FirstGlyphIndex 與 LastGlyphIndex 是頁面字形陣列中的含頭含尾索引

區塊種類

THPDFSemanticBlockKind 以 sbkParagraph、sbkHeading、sbkListItem、sbkTableRow 與 sbkCaption 為 THPDFSemanticTextLine.Kind 分類

ColumnCount 與 TableCount 彙整偵測到的結構,兩個中位數則描述 user-space points 下典型的 glyph 前進量與字型大小

此記錄由 HPDFAnalyzeSemanticTextLayout 填入,並由 THPDFHeadlessDocument.AnalyzePageSemanticText 及對應的已載入文件版本按頁面提供

AnalyzePageSemanticText