Last Updated: 09 Sep 2019 17:18 by ADMIN
Created on: 09 Sep 2019 17:18
Category: PdfProcessing
Type: Bug Report
PdfProcessing: CharCodes to glyph indices are incorrectly mapped when exporting TextBoxField with TrueType font and defined encoding

When a TrueType font is defined, the mapping of character codes to glyph indices depends on the built-in cmap table mappings defined in the font and the Encoding property defined in the PDF dictionary.

However, the current implementation maps all characters with cmap tables for Microsoft Symbolic and Macintosh Roman, which causes incorrect mapping results, e.g. space characters are mapped to an Ê glyph.

The issue is also described in the following public item: TryGetCharCode for OpenTypeFont uses wrong cmap and returns wrong charcode.

Workaround: Change the font  of the TextBoxField's widget appearance:
foreach (var widget in field.Widgets)
    widget.TextProperties.Font = FontsRepository.Helvetica;