property FontData[FontIndex: Integer]: TBytes; // read only
返回嵌入字体程序的原始字节,仅在字体已嵌入时才会填充。该属性使用从字符获得的字体句柄(FontHandle[CharIndex])或直接枚举页面字体资源得到的索引
只读。底层值由 PDFium 按需从字体字典或字体程序中查询。当索引不对应已知字体时,该函数会抛出 EPdfError
可与 CharacterFontSize / CharacterFontWeight 一起使用,用于驱动字体替换或文本样式重建流程
| FontIndex | 字体句柄索引,可通过 FontHandle[CharIndex] 或枚举页面字体资源获得 |
FontData 和 TrueType/OpenType 解析器直接查询字体程序
var
FontIdx: Integer;
begin
// inspect the font used by the first character
if Pdf1.CharacterCount > 0 then
begin
FontIdx := Pdf1.FontHandle[0];
Memo1.Lines.Add(Format('%s (embed=%s)',
[Pdf1.FontFamilyName[FontIdx], BoolToStr(Pdf1.FontIsEmbedded[FontIdx], True)]));
end;
end;