THPDFSemanticTextLayout 记录
对页面上带位置字形做语义阅读顺序分析的结果
THPDFSemanticTextLayout = record
Lines: THPDFSemanticTextLines;
ColumnCount: Integer;
TableCount: Integer;
MedianAdvance: Double;
MedianFontSize: Double;
end;
所属单元是 HPDFContentStream;Lines 保存检测出的阅读顺序行,带单元格、区域、表格、列表层级和源顺序元数据
行记录
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 点数刻画典型 glyph 步进和字号
该 record 由 HPDFAnalyzeSemanticTextLayout 填充,并经 THPDFHeadlessDocument.AnalyzePageSemanticText 及已加载文档的等价入口按页暴露