PDFiumPas 文件

FontIsEmbedded 属性

组件: TPdf  ·  单元: PDFium
指示页面对象所用字体是嵌入在 PDF 内(True),还是仅被引用并在查看时由操作系统解析(False

Syntax

property FontIsEmbedded[Index: Integer]: Boolean; // read only

Description

FontIsEmbedded reports whether the font referenced by the text page object at the given index carries its actual glyph program inside the PDF file. An embedded font travels with the document and renders identically on any platform; a non-embedded (referenced-only) font relies on the viewer finding a font of the same name installed locally, and may be substituted on display.

The indexer is the 0-based page-object index (0..ObjectCount - 1). Non-text objects always return False. A page must be active before reading the property.

Embedding can be full (every glyph from the source font is present) or subset (only the glyphs actually used appear, with a six-letter prefix added to the base name); both forms count as embedded here. For PDF/A compliance every font must be embedded — this property is a quick auditing tool for that requirement.

Parameters

Index0-based page-object index in the range 0..ObjectCount - 1.

Remarks

Example

var
  I, EmbeddedCount, TextCount: Integer;
begin
  Pdf1.PageNumber := 1;
  EmbeddedCount := 0;
  TextCount := 0;
  for I := 0 to Pdf1.ObjectCount - 1 do
  if Pdf1.ObjectType[I] = otText then
  begin
    Inc(TextCount);
    if Pdf1.FontIsEmbedded[I] then Inc(EmbeddedCount);
  end;
  ShowMessage(Format('%d of %d text objects use embedded fonts',
    [EmbeddedCount, TextCount]));
end;

See Also

FontData, FontFamilyName, FontBaseName, FontHandle, ObjectType