GetFontHasToUnicode

Fonts, Content Extraction

Description

Reports whether the selected font carries a /ToUnicode CMap.

Syntax

Delphi

Function TPDFlib.GetFontHasToUnicode: Integer;

Return values

0No font is selected, or the font has no Unicode mapping.
1The font carries a /ToUnicode CMap.

Remarks

Fonts without a Unicode mapping lose their character identities during text extraction and block conversion to PDF/A-*u and PDF/UA, so an inventory pass should check the flag before promising searchable or accessible output. Fonts generated by this library always emit the CMap; loaded documents only have one where their producer supplied it. EnumDocumentFonts exposes the same information per font as HasToUnicode, and GetDocumentFontDiagnostics counts the fonts lacking it as NoToUnicodeCount.

Example

PDF.SelectFont(FontID);
if PDF.GetFontHasToUnicode= 0 then
  ShowMessage('text extraction will not resolve this font');

See also

EnumDocumentFonts, GetDocumentFontDiagnostics, GetFontIsEmbedded