THotPDF.FontEmbedding Property

 

THotPDF.FontEmbedding

THotPDF

 

Top  Previous  Next

Determines whether the PDF document embeds the fonts used by the document.

 

Delphi syntax:

property FontEmbedding: Boolean;

 

C++ syntax:

__property bool FontEmbedding;

 

Description

A font can be embedded in the PDF as font program data. Set FontEmbedding to true to embed fonts and to preserve the selected typeface on systems where the font may not be installed.

 

For current Unicode and CIDFontType2 output, HotPDF keeps the original glyph IDs for embedded fonts and writes a ToUnicode map together with CIDToGIDMap /Identity. This provides more reliable rendering in strict PDF viewers.

 

When embedding TrueType fonts, HotPDF reads the font program's PostScript name and keeps /BaseFont, /FontDescriptor /FontName, /FontFamily, and descendant CID font names consistent with the embedded font data. This prevents viewer-side font capture problems when the requested Windows face name differs from the embedded font's internal PostScript name.

 

Set EnableFontSubsetting to true before BeginDoc when the final PDF should embed only the glyphs used by the document.

 

For visual font-fidelity tests, use FontEmbedding = true together with StandardFontEmulation = false. See Demo\Delphi\FontTest for a practical sample.

 

Code Example

HPDF.FontEmbedding := true;                      // Embed selected fonts in the PDF
HPDF.StandardFontEmulation := false;            // Use the actual installed font
HPDF.CurrentPage.SetFont( 'Calibri', [], 12 );
HPDF.CurrentPage.TextOut( 100, 100, 0, 'This text uses embedded Calibri glyphs' );

HPDF.FontEmbedding := false;                    // Disable embedding for following fonts
HPDF.CurrentPage.SetFont( 'Times New Roman', [], 12 );
HPDF.CurrentPage.TextOut( 100, 80, 0, 'This text depends on viewer font availability' );

 

See also: EnableFontSubsetting NotEmbeddedFonts StandardFontEmulation